Charles D Hixson wrote:
> Peter Otten wrote:
>> Charles D Hixson wrote:
>>
>>
>>> I want a hundred or so read-only variables, and I'm not sure the best
>>> way to achieve it.
>>>
>>
>> What do you really want to do? I recommend that you forget about bondage
>> and rely upon displine:
>>
>>
Peter Otten wrote:
> Charles D Hixson wrote:
>
>
>> I want a hundred or so read-only variables, and I'm not sure the best
>> way to achieve it.
>>
>
> What do you really want to do? I recommend that you forget about bondage and
> rely upon displine:
>
> class Test(object):
> """Never ch
Charles D Hixson wrote:
> I want a hundred or so read-only variables, and I'm not sure the best
> way to achieve it.
What do you really want to do? I recommend that you forget about bondage and
rely upon displine:
class Test(object):
"""Never change an attribute with an uppercase name."""
On Apr 13, 12:33 am, Charles D Hixson <[EMAIL PROTECTED]>
wrote:
> Arnaud Delobelle wrote:
> class MetaX(type):
>
> > ... @property
> > ... def spam(self): return 'eggs'
> > ...
>
> class X(object):
>
> > ... __metaclass__ = MetaX
> > ...
>
> X.spam
>
> > 'eggs'
>
> > HT
Arnaud Delobelle wrote:
> On Apr 12, 8:36 pm, Charles D Hixson <[EMAIL PROTECTED]>
> wrote:
>
>> I'm trying to construct read-only variables at the class level. I've
>> been unsuccessful. Any suggestions?
>>
>> Mixing @classmethod and @property doesn't appear to produce workable
>> code. Ditt
On Apr 12, 8:36 pm, Charles D Hixson <[EMAIL PROTECTED]>
wrote:
> I'm trying to construct read-only variables at the class level. I've
> been unsuccessful. Any suggestions?
>
> Mixing @classmethod and @property doesn't appear to produce workable
> code. Ditto for mixing @classmethod and __getatt
I'm trying to construct read-only variables at the class level. I've
been unsuccessful. Any suggestions?
Mixing @classmethod and @property doesn't appear to produce workable
code. Ditto for mixing @classmethod and __getattr__. (The property
approach compiles, but execution says that you can