Ethan Kennerly a écrit :
> Thanks for the help! Using the "class name (object)" syntax fixed my
> problem.
>
(snip)
>
> I am having to unteach myself some of the defensive programming techniques
> in C++, such as using name mangling to ensure privacy, when privacy is not
> the most important cri
Thanks for the help! Using the "class name (object)" syntax fixed my
problem.
Usually, I don't need properties, but in the case of a dependent attribute,
I used a set method of a property to update that dependent attribute. I
have a stopwatch class with a time limit property. When the time limi
Ethan Kennerly a écrit :
> Hello,
>
> There are a lot of Python mailing lists. I hope this is an appropriate one
> for a question on properties.
It is.
> I am relatively inexperienced user of Python. I came to it to prototype
> concepts for videogames. Having programmed in C, scripted in Uni
Ben Finney a écrit :
> "Ethan Kennerly" <[EMAIL PROTECTED]> writes:
>
>> I really like properties for readonly attributes,
>
> Python doesn't have "readonly attributes",
Err... Ever tried to set a class mro ?-)
> and to attempt to use
> properties for that purpose will only lead to confusion.
Ben Finney <[EMAIL PROTECTED]> wrote:
> "Ethan Kennerly" <[EMAIL PROTECTED]> writes:
>
> > I really like properties for readonly attributes,
>
> Python doesn't have "readonly attributes",
Many Python types do, e.g.:
>>> def f(): pass
...
>>> def g(): pass
...
>>> f.func_name = 'zap'
>>> f.f
On Tue, 19 Jun 2007 18:54:41 +1000, Ben Finney wrote:
> "Ethan Kennerly" <[EMAIL PROTECTED]> writes:
>
>> I really like properties for readonly attributes,
>
> Python doesn't have "readonly attributes", and to attempt to use
> properties for that purpose will only lead to confusion.
class Parr
"Ethan Kennerly" <[EMAIL PROTECTED]> writes:
> I really like properties for readonly attributes,
Python doesn't have "readonly attributes", and to attempt to use
properties for that purpose will only lead to confusion.
> and their ability to make the interface more elegant, by hiding
> uninteres
Jay Loden wrote:
> Can you elaborate (or just point me to a good doc) on what
> you mean by an "old style" class versus the new style? I
> learned Python (well, am still learning) from an older book,
> and I just want to make sure that I'm using the preferred method.
Answering my own question,
Alex Martelli wrote:
>
> class a_class:
>
> This is ALL of the problem: you're using a legacy (old-style) class, and
> properties (particularly setters) don't work right on its instances (and
> cannot, for backwards compatibility: legacy classes exist exclusively to
> keep backwards compatibi
Ethan Kennerly <[EMAIL PROTECTED]> wrote:
...
> There are a lot of Python mailing lists. I hope this is an appropriate one
> for a question on properties.
yep, it's a fine one.
> But a gotcha bit me in the behavior of properties that I didn't expect.
> If another function accesses an underlyi
Hello,
There are a lot of Python mailing lists. I hope this is an appropriate one
for a question on properties.
I am relatively inexperienced user of Python. I came to it to prototype
concepts for videogames. Having programmed in C, scripted in Unix shells,
and scripted in a number of proprie
11 matches
Mail list logo