On 11/13/2022 7:27 AM, Axy via Python-list wrote:
On 11/11/2022 16:21, Ian Pilcher wrote:
Is it possible to access the name of a superclass static method, when
defining a subclass attribute, without specifically naming the super-
class?
A instance's __bases__ attribute is a sequence that conta
On 11/11/2022 16:21, Ian Pilcher wrote:
Is it possible to access the name of a superclass static method, when
defining a subclass attribute, without specifically naming the super-
class?
Contrived example:
class SuperClass(object):
@staticmethod
def foo():
pass
class
On 11/11/2022 5:07 PM, Ian Pilcher wrote:
On 11/11/22 11:02, Thomas Passin wrote:
You can define a classmethod in SubClass that seems to do the job:
class SuperClass(object):
@staticmethod
def spam(): # "spam" and "eggs" are a Python tradition
print('spam from SuperCla
On 12Nov2022 09:17, Cameron Simpson wrote:
On 11Nov2022 10:21, Ian Pilcher wrote:
class SubClass(SuperClass):
bar = SuperClass.foo
^^
Is there a way to do this without specifically naming 'SuperClass'?
I think not.
Then I saw your "Dealing with non-callable classmeth
On 11Nov2022 10:21, Ian Pilcher wrote:
Is it possible to access the name of a superclass static method, when
defining a subclass attribute, without specifically naming the super-
class?
Contrived example:
class SuperClass(object):
@staticmethod
def foo():
pass
class SubCl
On 11/11/22 11:02, Thomas Passin wrote:
You can define a classmethod in SubClass that seems to do the job:
class SuperClass(object):
@staticmethod
def spam(): # "spam" and "eggs" are a Python tradition
print('spam from SuperClass')
class SubClass(SuperClass):
@cla
On 11/11/22 11:29, Dieter Maurer wrote:
Ian Pilcher wrote at 2022-11-11 10:21 -0600:
class SuperClass(object):
@staticmethod
def foo():
pass
class SubClass(SuperClass):
bar = SuperClass.foo
^^
Is there a way to do this without specifi
Ian Pilcher wrote at 2022-11-11 10:21 -0600:
>Is it possible to access the name of a superclass static method, when
>defining a subclass attribute, without specifically naming the super-
>class?
>
>Contrived example:
>
> class SuperClass(object):
> @staticmethod
> def foo():
>
You can define a classmethod in SubClass that seems to do the job:
class SuperClass(object):
@staticmethod
def spam(): # "spam" and "eggs" are a Python tradition
print('spam from SuperClass')
class SubClass(SuperClass):
@classmethod
def eggs(self):
super().
yes,
just use SubClass.foo
at least this works for me:
class SuperClass:
@staticmethod
def test():
print("yay")
class SubClass(SuperClass):
def __init__(self):
super().__init__()
SubClass.test()
subclass = SubClass()
Output:
python3.11 test.py
yay
Is it possible to access the name of a superclass static method, when
defining a subclass attribute, without specifically naming the super-
class?
Contrived example:
class SuperClass(object):
@staticmethod
def foo():
pass
class SubClass(SuperClass):
bar = SuperCl
11 matches
Mail list logo