Fuzzyman a écrit :
On Oct 22, 6:43 pm, Steven Bethard [EMAIL PROTECTED] wrote:
(snip)
# Inherit from object. There's no reason to create old-style classes.
We recently had to change an object pipeline from new style classes to
old style. A lot of these objects were being created and the
Fuzzyman [EMAIL PROTECTED] writes:
We recently had to change an object pipeline from new style classes
to old style. A lot of these objects were being created and the
*extra overhead* of new style classes was killing us. :-)
Can you please expand on this? What extra overhead of new-style
On Oct 29, 11:35 pm, Steven Bethard [EMAIL PROTECTED] wrote:
Fuzzyman wrote:
On Oct 22, 6:43 pm, Steven Bethard [EMAIL PROTECTED] wrote:
# Inherit from object. There's no reason to create old-style classes.
We recently had to change an object pipeline from new style classes to
old style.
On Oct 30, 2007 5:52 AM, Fuzzyman [EMAIL PROTECTED] wrote:
On Oct 29, 11:35 pm, Steven Bethard [EMAIL PROTECTED] wrote:
Fuzzyman wrote:
On Oct 22, 6:43 pm, Steven Bethard [EMAIL PROTECTED] wrote:
# Inherit from object. There's no reason to create old-style classes.
We recently had to
On Oct 22, 6:43 pm, Steven Bethard [EMAIL PROTECTED] wrote:
Sunburned Surveyor wrote:
Contents of input text file:
[Name]
Fire Breathing Dragon
[Properties]
Strength
Scariness
Endurance
[Methods]
eatMaiden argMaiden
fightKnight argKnight
Generated Python Class File:
Fuzzyman wrote:
On Oct 22, 6:43 pm, Steven Bethard [EMAIL PROTECTED] wrote:
# Inherit from object. There's no reason to create old-style classes.
We recently had to change an object pipeline from new style classes to
old style. A lot of these objects were being created and the *extra
On Mon, 22 Oct 2007 17:31:51 -0600, Steven Bethard wrote:
Bruno Desthuilliers wrote:
Computed attributes are IMHO not only a life-saver when it comes to
refactoring. There are cases where you *really* have - by 'design' I'd
say - the semantic of a property, but know from the start you'll
Steven Bethard a écrit :
Bruno Desthuilliers wrote:
Steven Bethard a écrit :
(snip)
In Python, you can use property() to make method calls look like
attribute access. This could be necessary if you have an existing
API that used public attributes, but changes to your code require
those
Marc 'BlackJack' Rintsch wrote:
On Mon, 22 Oct 2007 17:31:51 -0600, Steven Bethard wrote:
Bruno Desthuilliers wrote:
Computed attributes are IMHO not only a life-saver when it comes to
refactoring. There are cases where you *really* have - by 'design' I'd
say - the semantic of a property,
Bruno Desthuilliers wrote:
Steven Bethard a écrit :
Bruno Desthuilliers wrote:
Steven Bethard a écrit :
(snip)
In Python, you can use property() to make method calls look like
attribute access. This could be necessary if you have an existing
API that used public attributes, but changes
Steven Bethard a écrit :
Bruno Desthuilliers wrote:
Steven Bethard a écrit :
Bruno Desthuilliers wrote:
Steven Bethard a écrit :
(snip)
In Python, you can use property() to make method calls look like
attribute access. This could be necessary if you have an existing
API that used
Bruno Desthuilliers wrote:
I guess as long as your documentation is clear about which attributes
require computation and which don't...
Why should it ? FWIW, I mentionned that I would obviously not use
properties for values requiring heavy, non cachable computation. This
set aside, the
Steven Bethard a écrit :
Bruno Desthuilliers wrote:
I guess as long as your documentation is clear about which attributes
require computation and which don't...
Why should it ? FWIW, I mentionned that I would obviously not use
properties for values requiring heavy, non cachable
Bruno Desthuilliers wrote:
Steven Bethard a écrit :
Bruno Desthuilliers wrote:
I guess as long as your documentation is clear about which
attributes require computation and which don't...
Why should it ?
[snip]
I believe we simply disagree on weither properties should be used when
it
Steven Bethard a écrit :
Bruno Desthuilliers wrote:
Steven Bethard a écrit :
Bruno Desthuilliers wrote:
I guess as long as your documentation is clear about which
attributes require computation and which don't...
Why should it ?
[snip]
I believe we simply disagree on weither
Bruno Desthuilliers wrote:
Now how does your desire for documentation imply that if you're
creating a class for the first time, it should *never* use property() ?
Of course, there's *never* any such thing as never in Python. ;-)
STeVe
P.S. If you really don't understand what I was getting
I was thinking of a way I could make writing Python Class Files a
little less painful. I was considering a Ptyhon script that read a
file with a list of property names and method names and then generated
a skeleton class file.
I was even thinking of automatically generating the shell for doc
On 10/22/07, Sunburned Surveyor [EMAIL PROTECTED] wrote:
I was thinking of a way I could make writing Python Class Files a
little less painful. I was considering a Ptyhon script that read a
file with a list of property names and method names and then generated
a skeleton class file.
I was
On Oct 22, 10:26 am, Chris Mellon [EMAIL PROTECTED] wrote:
On 10/22/07, Sunburned Surveyor [EMAIL PROTECTED] wrote:
I was thinking of a way I could make writing Python Class Files a
little less painful. I was considering a Ptyhon script that read a
file with a list of property names
Sunburned Surveyor a écrit :
I was thinking of a way I could make writing Python Class Files
What's a Python Class File ?
a
little less painful.
If you find writing classes in Python painful, then either you have no
experience with any mainstream language or you are doing something wrong.
On 10/22/07, Sunburned Surveyor [EMAIL PROTECTED] wrote:
On Oct 22, 10:26 am, Chris Mellon [EMAIL PROTECTED] wrote:
On 10/22/07, Sunburned Surveyor [EMAIL PROTECTED] wrote:
I was thinking of a way I could make writing Python Class Files a
little less painful. I was considering a
On Mon, 22 Oct 2007 11:05:52 -0700, Sunburned Surveyor wrote:
On Oct 22, 10:26 am, Chris Mellon [EMAIL PROTECTED] wrote:
You wrote: can't think of a single reason why you would ever want to
do this,
since your list of method and property names would be just as
verbose as just typing the
On Oct 22, 11:23 am, Chris Mellon [EMAIL PROTECTED] wrote:
On 10/22/07, Sunburned Surveyor [EMAIL PROTECTED] wrote:
On Oct 22, 10:26 am, Chris Mellon [EMAIL PROTECTED] wrote:
On 10/22/07, Sunburned Surveyor [EMAIL PROTECTED] wrote:
I was thinking of a way I could make writing
Sunburned Surveyor wrote:
Contents of input text file:
[Name]
Fire Breathing Dragon
[Properties]
Strength
Scariness
Endurance
[Methods]
eatMaiden argMaiden
fightKnight argKnight
Generated Python Class File:
def class FireBreathingDragon:
def getStrength(self):
You wrote: can't think of a single reason why you would ever want to
do this,
since your list of method and property names would be just as
verbose as just typing the actual python code.
I don't think I understand how this would be the same amount of
typing. Consider the following example
On Oct 22, 11:43 am, Steven Bethard [EMAIL PROTECTED] wrote:
Sunburned Surveyor wrote:
Contents of input text file:
[Name]
Fire Breathing Dragon
[Properties]
Strength
Scariness
Endurance
[Methods]
eatMaiden argMaiden
fightKnight argKnight
Generated Python Class File:
Sunburned Surveyor wrote:
I also intended to add statements creating properties from the getter
and setter methods. I understand that getters and setters aren't
really necessary if you aren't making a property. I just forgot to add
the property statements to my example.
You still don't want
Sunburned Surveyor a écrit :
On Oct 22, 10:26 am, Chris Mellon [EMAIL PROTECTED] wrote:
(snip)
I can't think of a single reason why you would ever want to do this,
since your list of method and property names would be just as
verbose as just typing the actual python code.
Auto generated
On Oct 22, 11:47 am, Bruno Desthuilliers
[EMAIL PROTECTED] wrote:
Sunburned Surveyor a écrit :
On Oct 22, 10:26 am, Chris Mellon [EMAIL PROTECTED] wrote:
(snip)
I can't think of a single reason why you would ever want to do this,
since your list of method and property names would be just
Sunburned Surveyor a écrit :
On Oct 22, 11:47 am, Bruno Desthuilliers
[EMAIL PROTECTED] wrote:
(snip)
Bruno wrote: You don't need these getters and setters. Python has
support for
computed attributes (look for 'property'), so until you need to
control
access, a plain attribute is all you
Steven Bethard a écrit :
(snip)
In Python, you can use property() to make method calls look like
attribute access. This could be necessary if you have an existing API
that used public attributes, but changes to your code require those
attributes to do additional calculations now.
But if
On Oct 22, 1:23 pm, Bruno Desthuilliers
[EMAIL PROTECTED] wrote:
Steven Bethard a écrit :
(snip)
In Python, you can use property() to make method calls look like
attribute access. This could be necessary if you have an existing API
that used public attributes, but changes to your code
On Oct 22, 11:44 am, Diez B. Roggisch [EMAIL PROTECTED] wrote:
You wrote: can't think of a single reason why you would ever want to
do this,
since your list of method and property names would be just as
verbose as just typing the actual python code.
I don't think I understand how this
Bruno Desthuilliers wrote:
Steven Bethard a écrit :
(snip)
In Python, you can use property() to make method calls look like
attribute access. This could be necessary if you have an existing API
that used public attributes, but changes to your code require those
attributes to do
34 matches
Mail list logo