metal a écrit :
The actual situation is I'm coding with a immuable set-like datatype
XSet which supports XSet(['al']) XSet(['ah'] = XSet(['ax']
I assume it was '==', not '='
if I
declare ax is consists of al and ah
That means I can't explian it very well 'cause my english...
Now I try to
metal a écrit :
Consider the following:
(snip)
class Parent:
def some_method(self):
return Parent(...)
class Child:
pass
Child().some_method() returns a Parent instance.
It actually raises an AttributeError. You forgot to make Child inherit
from Parent.
On 10月30日, 上午8时03分, metal metal...@gmail.com wrote:
The actual situation is I'm coding with a immuable set-like datatype
XSet which supports XSet(['al']) XSet(['ah'] = XSet(['ax'] if I
declare ax is consists of al and ah
A typo, XSet(['al']) | XSet(['ah'] = XSet(['ax']
--
On 10月30日, 下午4时44分, Bruno Desthuilliers bruno.
42.desthuilli...@websiteburo.invalid wrote:
metal a écrit :
The actual situation is I'm coding with a immuable set-like datatype
XSet which supports XSet(['al']) XSet(['ah'] = XSet(['ax']
I assume it was '==', not '='
if I
declare ax is
metal a écrit :
On 10月30日, 下午4时44分, Bruno Desthuilliers bruno.
42.desthuilli...@websiteburo.invalid wrote:
metal a écrit :
(snip)
def methods(cls):
return [k for k, v in cls.__dict__.items() if callable(v)]
All callables are not functions or methods... The inspect module might
Consider the following:
class Parent:
def some_method(self):
return Parent(...)
class Child:
def some_method(self):
...
return Parent.some_method(self)
metal wrote:
But this style makes code full with ugly self.__class__
Any standard/pythonic way out there?
You are already using one standard way to implement an alternative
constructor.
If you don't need any instance attributes you can use another way:
class Egg(object):
@classmethod
On Thu, Oct 29, 2009 at 3:45 PM, metal metal...@gmail.com wrote:
Consider the following:
snip
class Parent:
def some_method(self):
return Parent(...)
class Child:
pass
Child().some_method() returns a Parent instance.
On Thu, 29 Oct 2009 22:45:45 -, metal metal...@gmail.com wrote:
Consider the following:
[fixed to actually inherit...]
class Parent:
def some_method(self):
return Parent(...)
class Child(Parent):
pass
metal wrote:
Consider the following:
class Parent:
def some_method(self):
return Parent(...)
class Child:
def some_method(self):
...
return Parent.some_method(self)
The actual situation is I'm coding with a immuable set-like datatype
XSet which supports XSet(['al']) XSet(['ah'] = XSet(['ax'] if I
declare ax is consists of al and ah
That means I can't explian it very well 'cause my english...
Now I try to make some mess like this...I know it's not good to
11 matches
Mail list logo