Immutable instances, constant values

2005-11-17 Thread Ben Finney
Howdy all, I've recently packaged 'enum' in PyPI. In its description, I make the claim that it creates "immutable" enumeration objects, and that the enumeration values are "constant" values. This raises questions. Is there any difference between a Python immutable value, and a constant? I suppos

Re: Immutable instances, constant values

2005-11-18 Thread Bengt Richter
On Fri, 18 Nov 2005 14:32:46 +1100 (EST), Ben Finney <[EMAIL PROTECTED]> wrote: >Howdy all, > >I've recently packaged 'enum' in PyPI. In its description, I make the >claim that it creates "immutable" enumeration objects, and that the >enumeration values are "constant" values. > >This raises questi

Re: Immutable instances, constant values

2005-11-19 Thread Steven D'Aprano
On Fri, 18 Nov 2005 14:32:46 +1100, Ben Finney wrote: > Is there any difference between a Python immutable value, and a > constant? I suppose "constant" also implies that the *name* binds > unchangeably to a particular value. Is that meaningful? That's precisely how I understand "constant" to be

Re: Immutable instances, constant values

2005-11-19 Thread Bengt Richter
On Sat, 19 Nov 2005 21:45:40 +1100, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >On Fri, 18 Nov 2005 14:32:46 +1100, Ben Finney wrote: > >> Is there any difference between a Python immutable value, and a >> constant? I suppose "constant" also implies that the *name* binds >> unchangeably to a parti

Re: Immutable instances, constant values

2005-11-19 Thread Ben Finney
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 18 Nov 2005 14:32:46 +1100, Ben Finney wrote: > > Is there any difference between a Python immutable value, and a > > constant? I suppose "constant" also implies that the *name* binds > > unchangeably to a particular value. Is that meaningful? >

Re: Immutable instances, constant values

2005-11-19 Thread Steven D'Aprano
On Sun, 20 Nov 2005 08:56:33 +1100, Ben Finney wrote: > Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> On Fri, 18 Nov 2005 14:32:46 +1100, Ben Finney wrote: >> > Is there any difference between a Python immutable value, and a >> > constant? I suppose "constant" also implies that the *name* binds >>

Re: Immutable instances, constant values

2005-11-21 Thread George Sakkis
Steven D'Aprano wrote: > Yes, that would be how I interpret constants: You want a name which can't > be re-bound to something else. > > One work-around is to use the convention of writing the name in all caps: > > CONSTANT = some_value > > and then trust that your module user doesn't rebind CONSTA

Behaviour of enumerated types (was: Re: Immutable instances, constant values)

2005-11-18 Thread Ben Finney
Bengt Richter <[EMAIL PROTECTED]> wrote: > Ben Finney <[EMAIL PROTECTED]> wrote: > >I've recently packaged 'enum' in PyPI. > [...] > My notion of enum comes from (what I remember of) Pascal You might want to investigate the 'enum' package for my idea of how an enumerated type can work. > which is

Re: Behaviour of enumerated types (was: Re: Immutable instances, constant values)

2005-11-18 Thread Bengt Richter
On Fri, 18 Nov 2005 23:43:10 +1100 (EST), Ben Finney <[EMAIL PROTECTED]> wrote: >Bengt Richter <[EMAIL PROTECTED]> wrote: >> Ben Finney <[EMAIL PROTECTED]> wrote: >> >I've recently packaged 'enum' in PyPI. >> [...] >> My notion of enum comes from (what I remember of) Pascal > >You might want to in