[Python-Dev] Initialization of __builtins__
vinay_sajip at yahoo.co.uk
Sat Oct 10 22:03:52 CEST 2009
Antoine Pitrou <solipsis <at> pitrou.net> writes:
> Why do you do this?
> In py3k, unicode is always enabled but it's called "str" and the name "unicode"
> doesn't exist.
That wasn't done by me but by GvR (according to svn annotate) in r55818,
presumably during the stdlib porting to py3k. I just copied the line over, not
thinking it wouldn't work for 2.7.
> Why don't you simply write:
> unicode_support = True
> except NameError:
> unicode_support = False
That's just about what I've actually done: I was just curious about the
difference between py3k and trunk :-)
If __builtins__ is an implementation detail which can't be relied on, should the
py3k code be changed to the try: form? Or shall I just remove the checks
altogether, since Unicode should always be there in 3.x?
More information about the Python-Dev