Re: Superclass static method name from subclass

2022-11-19 Thread Thomas Passin
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

Re: Superclass static method name from subclass

2022-11-13 Thread Axy via Python-list
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

Re: Superclass static method name from subclass

2022-11-11 Thread Thomas Passin
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

Re: Superclass static method name from subclass

2022-11-11 Thread Cameron Simpson
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

Re: Superclass static method name from subclass

2022-11-11 Thread Cameron Simpson
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

Re: Superclass static method name from subclass

2022-11-11 Thread Ian Pilcher
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

Re: Superclass static method name from subclass

2022-11-11 Thread Ian Pilcher
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

Re: Superclass static method name from subclass

2022-11-11 Thread Dieter Maurer
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(): >

Re: Superclass static method name from subclass

2022-11-11 Thread Thomas Passin
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().

Re: Superclass static method name from subclass

2022-11-11 Thread Lars Liedtke
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

Superclass static method name from subclass

2022-11-11 Thread Ian Pilcher
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