Proposal for adding symbols within Python

Grant Edwards grante at visi.com
Tue Nov 15 09:59:26 EST 2005


On 2005-11-15, Ben Sizer <kylotan at gmail.com> wrote:
> 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.

I don't see how that's an argument in favor of the proposal
being discussed.  Aren't $Value1 and $value1 both legal and
distinct symbols in the proposed syntax?  Won't you have the
exact same issue that you do with mis-typing strings?

-- 
Grant Edwards                   grante             Yow!  .. Do you like
                                  at               "TENDER VITTLES?"?
                               visi.com            



More information about the Python-list mailing list