Proposal for adding symbols within Python

Ben Sizer kylotan at gmail.com
Tue Nov 15 04:57:53 EST 2005


Grant Edwards wrote:
> In the situations described, I always use strings
> and have never felt the need for something else:

...

> I don't think I even understand what the objection is.  What is
> needed is a code fragment that shows how the use of strings is
> untenable.

myObject.value = 'value1'

#... 100 lines of code elided...

if myObject.value = 'Value1':
    do_right_thing()
else:
    do_wrong_thing()


I don't actually think string use is 'untenable', but it is definitely
more error-prone. With some sort of named object on the right hand side
you will at least get a helpful NameError.

-- 
Ben Sizer.




More information about the Python-list mailing list