Proposal for adding symbols within Python

Grant Edwards grante at visi.com
Mon Nov 14 16:54:21 EST 2005


On 2005-11-14, Rocco Moretti <roccomoretti at hotpop.com> wrote:
>
>> Please, note that I am entirely open for every points on this proposal
>> (which I do not dare yet to call PEP).
>
> I still don't see why you can't just use strings.

Same here.  In the situations described, I always use strings
and have never felt the need for something else:

 file.state = 'closed'

 ...

 if file.state == 'open':
     whatever
 elif file.state == 'error':
     something_else
     

> The only two issues I see you might have with them are a) two
> identical strings might not be identical by id(), b) they
> aren't local in scope.
>
> The objection a) is minor. 
[...]
>
> The objection b) is a little harder to dismiss. But I'm not
> sure if you've completely thought what it means for a symbol
> to be "local to a module".

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.

-- 
Grant Edwards                   grante             Yow!  And furthermore,
                                  at               my bowling average is
                               visi.com            unimpeachable!!!



More information about the Python-list mailing list