New statement proposal for Python

phil hunt philh at comuno.freeserve.co.uk
Sat Jun 16 16:06:58 EDT 2001


On 16 Jun 2001 03:08:11 GMT, David LeBlanc <whisper at oz.nospamnet> wrote:
>In article <slrn9ijrog.8bp.philh at comuno.freeserve.co.uk>, 
>philh at comuno.freeserve.co.uk says...
>> On 15 Jun 2001 02:37:51 GMT, David LeBlanc <whisper at oz.nospamnet> wrote:
>> >
>> >Creating an inherent means of creating constants (or my preferred 
>> >aliases) is good computer science as someone else mentioned in a reply 
>> >post. Magic numbers are bad - they're sloppy programming and a source of 
>> >errors if they must be used in several places etc. OTOH, aliases clarify 
>> >program meaning and imho make things more comprensible to newbies.
>> 
>> Surely a newbie can understand that if you assign a variable to a 
>> value, and then never change it, then it is working as a constant.
>> 
>> I have no problem having cxonstants like this, e.g.
>> 
>>    programVersion = "0.2.7"
>> 
>> it seems to me that:
>> 
>>    alias programVersion: "0.2.7"
>> 
>> is no clearer, and is an extra something for a learner to have to learn.
>> Entities should not be multiplied unnecessarily!
>
>I absolutely agree that entities shouldn't be multiplied unnecessisarily! 
>However your suggestion in fact does just that: there is nothing that 
>prevents one from reassigning to programVersion in some module you 
>import

On the contrary, there is something that prevents me from reassigning
identifiers intended as constants: the fact that it's a silly think to
do.


-- 
##  Philip Hunt                   ##
##  philh at comuno.freeserve.co.uk  ##






More information about the Python-list mailing list