[Python-Dev] Suggested changes to PEP 215

Jason Orendorff jason@jorendorff.com
Mon, 14 Jan 2002 21:36:57 -0600


Paul Prescod wrote:
> Jason Orendorff wrote:
> > ...
> > It should be specified that $-strings do not use the local
> > "str" and "unicode" names to find str() and unicode(); nor
> > do they look in the current __builtins__ or the __builtin__
> > module.  They should use the actual python C implementations
> > of str() and unicode(). 
> 
> Why? Wouldn't it be better to look in __builtin__? If someone overrides
> str() or unicode() they may well want that behaviour to be respected in
> interopolations.

I was thinking it should parallel what the other similar
features already do:

>>> import __builtin__
>>> __builtin__.str = 'a suffusion of yellow'
>>> str
'a suffusion of yellow'
>>> print 32
32
>>> print "xyz %s 123" % 4.5
xyz 4.5 123
>>>

## Jason Orendorff    http://www.jorendorff.com/