str(list) calls repr() on elements?
Ulf Engström
alexis at mobiliant.com
Wed Oct 18 08:34:12 EDT 2000
More information about the Python-list mailing list
Wed Oct 18 08:34:12 EDT 2000
- Previous message (by thread): str(list) calls repr() on elements?
- Next message (by thread): str(list) calls repr() on elements?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
OKi, I'm not familiar with the interior of repr and str, but I believe none of the functions are called for each element of a list or a tuple, but rather stringifying the whole list. '[the,elements,will,just,be,part,of,the,string]' Am I wrong here? Ulf > It seems that the built-in function 'str', when applied to a list/tuple, > constructs its result by calling 'repr' on the elements of the list/tuple, > rather than 'str'. How come? > > e.g. > >> str(1L) > '1' > >> repr(1L) > '1L' > >> str( [1L] ) > '[1L]' # not '[1]' > > -Michael Dyck > -- > http://www.python.org/mailman/listinfo/python-list
- Previous message (by thread): str(list) calls repr() on elements?
- Next message (by thread): str(list) calls repr() on elements?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list