On 2021-05-20, Terry Reedy wrote:
> On 5/20/2021 2:53 PM, Grant Edwards wrote:
>> On 2021-05-20, Mats Wichmann wrote:
>>
>>> many fonts squish together repeated underscores in the display so it's
>>> hard to see this visually,
>>
>> Is it just me, or does it seem foolish to use such fonts for
>>
On 5/20/2021 2:53 PM, Grant Edwards wrote:
On 2021-05-20, Mats Wichmann wrote:
On 5/20/21 4:54 AM, Richard Damon wrote:
On 5/20/21 3:24 AM, Peter Otten wrote:
On 20/05/2021 06:00, Richard Damon wrote:
class GedcomHead(Gedcom0Tag):
"""GEDCOM 0 HEAD tag"""
def ___init___(self, *
On 2021-05-20, Mats Wichmann wrote:
> On 5/20/21 4:54 AM, Richard Damon wrote:
>> On 5/20/21 3:24 AM, Peter Otten wrote:
>>> On 20/05/2021 06:00, Richard Damon wrote:
>>>
class GedcomHead(Gedcom0Tag):
"""GEDCOM 0 HEAD tag"""
def ___init___(self, *, parent):
>>>
>>> An __
On 5/20/21 4:54 AM, Richard Damon wrote:
On 5/20/21 3:24 AM, Peter Otten wrote:
On 20/05/2021 06:00, Richard Damon wrote:
class GedcomHead(Gedcom0Tag):
"""GEDCOM 0 HEAD tag"""
def ___init___(self, *, parent):
An __init__ with three underscores; you must me joking ;)
Yes, that i
On 5/20/21 1:58 AM, Chris Angelico wrote:
> On Thu, May 20, 2021 at 2:02 PM Richard Damon
> wrote:
>> Given the following definition of classes, I am getting an unexpected
>> error of :
>>
>> TypeError: __init__() missing 2 required keyword-only arguments:
>> 'idcode' and 'tag'
>>
>> On the call
On 5/20/21 3:24 AM, Peter Otten wrote:
> On 20/05/2021 06:00, Richard Damon wrote:
>
>> class GedcomHead(Gedcom0Tag):
>> """GEDCOM 0 HEAD tag"""
>> def ___init___(self, *, parent):
>
> An __init__ with three underscores; you must me joking ;)
>
Yes, that is what I was missing, too many un
On 20/05/2021 06:00, Richard Damon wrote:
class GedcomHead(Gedcom0Tag):
"""GEDCOM 0 HEAD tag"""
def ___init___(self, *, parent):
An __init__ with three underscores; you must me joking ;)
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, May 20, 2021 at 2:02 PM Richard Damon wrote:
>
> Given the following definition of classes, I am getting an unexpected
> error of :
>
> TypeError: __init__() missing 2 required keyword-only arguments:
> 'idcode' and 'tag'
>
> On the call to create a GedcomHead in the call to GedcomHead()
Given the following definition of classes, I am getting an unexpected
error of :
TypeError: __init__() missing 2 required keyword-only arguments:
'idcode' and 'tag'
On the call to create a GedcomHead in the call to GedcomHead() in
Gedcom0Tag.add()
Code:
class GedcomTag:
"""Represents a Le
On Sat, Sep 21, 2013 at 10:17 AM, Peter Cacioppi
wrote:
> It's too bad, I really lean on reload(). It appears to be incompatible with
> inheritance more than one level deep.
Python's really not designed for reload of this nature. You can easily
make a nasty mess of things. If you're working in t
On Thursday, March 21, 2002 2:03:23 PM UTC-7, Marc wrote:
> I have classes defined in different files and would like to inherit
> from a class in file A.py for a class in file B.py but am running into
> problems. I'm using Python 1.5.2 on Windows NT
>
> Here's a specific example:
>
> ***
On Wed, 18 Sep 2013 20:38:10 -0400, Ned Batchelder wrote:
> super() takes a class and an instance for a reason. If you could use
> self.__class__ for the class, then it would only take the instance.
> Super() needs to know the instance, but also needs to know the class
> it's being called from.
Y
On 9/18/13 7:54 PM, Peter Cacioppi wrote:
This is a very old topic, but here is a trick for single inheritance. (The
problem you allude to isn't restricted to multiple inheritance).
Any class with a single parent simply defines this function.
def mySuper(self) :
return super(sel
One more comment - my trick has some utility with multiple inheritance, but you
really need to understand super() to and method resolution ordering in that
case (as, I suppose, you ought to whenever you cross the Rubicon beyond single
inheritance). So it's a nice trick but YMMV
On Wednesday, Se
This is a very old topic, but here is a trick for single inheritance. (The
problem you allude to isn't restricted to multiple inheritance).
Any class with a single parent simply defines this function.
def mySuper(self) :
return super(self.__class__, self)
And then any parent
On Wed, Nov 5, 2008 at 6:59 PM, Diez B. Roggisch <[EMAIL PROTECTED]> wrote:
> You need to call the __init__ of NoteSet inside Scale, as otherwise the
> instance isn't properly initialized.
Thanks, solved.
--
http://mail.python.org/mailman/listinfo/python-list
Mr.SpOOn wrote:
> Hi,
> I have a problem with this piece of code:
>
>
> class NoteSet(OrderedSet):
> def has_pitch(self):
> pass
> def has_note(self):
> pass
>
> class Scale(NoteSet):
> def __init__(self, root, type):
> self.append(root)
> self.type =
Hi,
I have a problem with this piece of code:
class NoteSet(OrderedSet):
def has_pitch(self):
pass
def has_note(self):
pass
class Scale(NoteSet):
def __init__(self, root, type):
self.append(root)
self.type = type
ScaleType(scale=self)
OrderedS
Hi all,
I have a python module (M) with the following structure
M (directory)
| __init__.py (class Base(object) ...)
| - a.py (class A(Base) ...)
| - b.py (class B(Base) ...)
| - c.py (class C(Base) ...)
The __init_.py has a class which all the sub-modu
On May 9, 12:09 pm, [EMAIL PROTECTED] wrote:
> I'm trying to solve a problem using inheritance and polymorphism in
> python 2.4.2
>
> I think it's easier to explain the problem using simple example:
>
> class shortList:
>
> def __init__(self):
>
> self.setList()
>
> def setList(self
On May 9, 11:33 am, Bjoern Schliessmann wrote:
> [EMAIL PROTECTED] wrote:
> > class longList(shortList):
>
> > def __init__(self):
>
> > shortList.setList()
>
> > self.setList()
>
> Addition: Always call the base class __init__ in your constructor if
> there exists one, i. e.
>
[EMAIL PROTECTED] wrote:
> class longList(shortList):
>
> def __init__(self):
>
> shortList.setList()
>
> self.setList()
Addition: Always call the base class __init__ in your constructor if
there exists one, i. e.
class longList(shortList)
def __init__(self):
s
On 2007-05-09, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I'm trying to solve a problem using inheritance and
> polymorphism in python 2.4.2
It's not an inheritance problem, it's a notation problem. Python
uses explicit 'self', saving you the trouble of
I'm trying to solve a problem using inheritance and polymorphism in
python 2.4.2
I think it's easier to explain the problem using simple example:
class shortList:
def __init__(self):
self.setList()
def setList(self):
a = [1,2,3]
print a
class longList
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Name: Sleepy Hollow
# Author: .nu
import wx
import os
import sys
NEW_ID = 1; OPEN_ID = 2; SAVE_ID = 3; SAVE_AS_ID = 4;
QUIT_ID = 5; UNDO_ID = 6; REDO_ID = 7; HELPME_ID = 8;
ABOUT_ID = 9; OPTIONS_ID = 10
APP_NAME = 'Sleepy Hollow'
class SleepyHoll
KraftDiner wrote:
> So ok I've written a piece of code that demonstrates the problem.
> Can you suggest how I change the Square class init?
>
> class Shape(object):
> def __init__(self):
> print 'MyBaseClass __init__'
>
> class Rectangle(Shape):
> def __init__(self):
> #
KraftDiner a écrit :
> So ok I've written a piece of code that demonstrates the problem.
> Can you suggest how I change the Square class init?
>
> class Shape(object):
> def __init__(self):
> print 'MyBaseClass __init__'
>
> class Rectangle(Shape):
> def __init__(self):
So ok I've written a piece of code that demonstrates the problem.
Can you suggest how I change the Square class init?
class Shape(object):
def __init__(self):
print 'MyBaseClass __init__'
class Rectangle(Shape):
def __init__(self):
super(self.__clas
Xavier Morel <[EMAIL PROTECTED]> writes:
> Pierre Barbier de Reuille wrote:
>> Well, I would even add : don't use super !
>> Just call the superclass method :
>> MyClass.__init__(self)
>> Simon Percivall a écrit :
>>> Don't use self.__class__, use the name of the class.
> Bad idea if you're using n
Pierre Barbier de Reuille wrote:
> Xavier Morel a écrit :
>> Pierre Barbier de Reuille wrote:
>>
>>> Well, I would even add : don't use super !
>>> Just call the superclass method :
>>>
>>> MyClass.__init__(self)
>>>
>>>
>>>
>>> Simon Percivall a écrit :
>>>
Don't use self.__class__, use the n
Xavier Morel a écrit :
> Pierre Barbier de Reuille wrote:
>
>> Well, I would even add : don't use super !
>> Just call the superclass method :
>>
>> MyClass.__init__(self)
>>
>>
>>
>> Simon Percivall a écrit :
>>
>>> Don't use self.__class__, use the name of the class.
>>>
> Bad idea if you're usi
Pierre Barbier de Reuille wrote:
> Well, I would even add : don't use super !
> Just call the superclass method :
>
> MyClass.__init__(self)
>
>
>
> Simon Percivall a écrit :
>> Don't use self.__class__, use the name of the class.
>>
Bad idea if you're using new-style classes with a complex inh
Well, I would even add : don't use super !
Just call the superclass method :
MyClass.__init__(self)
Simon Percivall a écrit :
> Don't use self.__class__, use the name of the class.
>
--
http://mail.python.org/mailman/listinfo/python-list
Don't use self.__class__, use the name of the class.
--
http://mail.python.org/mailman/listinfo/python-list
I have a class
class MyClass(MyBaseClass)
def __init__(self)
super(self.__class__, self).__init__()
self.type = MyClassType
return self
It has a few methods...
I have another class and the only difference is the __init__ method..
I tried this:
class MySpecialClass(MyClass)
Not always easy to follow but great !
Using __str__ instead of __repr__ makes it work also with old style
(thanks to Simon Brunning for suggesting it, and with your link I even
now understand why !)
--
http://mail.python.org/mailman/listinfo/python-list
The stuff on Descriptor.htm was really good .
Thanks
--
http://mail.python.org/mailman/listinfo/python-list
Thanks, at least makes it running !
I'll have to teach myself to move to this new style classes by default
anyway...
--
http://mail.python.org/mailman/listinfo/python-list
tooper wrote:
> Hello all,
>
> I'm trying to implement a common behavior for some object that can be
> read from a DB or (when out of network) from an XML extract of this DB.
> I've then wrote 2 classes, one reading from XML & the other from the
> DB, both inheritating from a common one where I wan
On Wed, 24 Aug 2005 03:34:36 -0700, tooper wrote:
> Hello all,
>
> I'm trying to implement a common behavior for some object that can be
> read from a DB or (when out of network) from an XML extract of this DB.
> I've then wrote 2 classes, one reading from XML & the other from the
> DB, both inhe
Hello all,
I'm trying to implement a common behavior for some object that can be
read from a DB or (when out of network) from an XML extract of this DB.
I've then wrote 2 classes, one reading from XML & the other from the
DB, both inheritating from a common one where I want to implement
several co
Matthew Thorley wrote:
> So is elementtree a module of modules? I didn't know you could do that.
"elementtree" is a package. see:
http://docs.python.org/tut/node8.html#SECTION00840
for a bit more information.
--
http://mail.python.org/mailman/listinfo/python-list
So is elementtree a module of modules? I didn't know you could do that.
I just assumed that from elementtree import ElementTree imported a class
from the module elementtree.
It works now. Thanks guys.
Fredrik Lundh wrote:
> Matthew Thorley wrote:
>
>
>>I am trying to inherit from ElementTree so
Matthew Thorley wrote:
> I am trying to inherit from ElementTree so I can add some methods. This
> is the code I am trying to make work, and the following is the error I
> am getting.
>
> from elementtree import ElementTree
> class AcidTree(ElementTree):
> def write_string(self):
> ...
It looks like ElementTree is a module and not a class.
The same error message was posted here few weeks ago.
Actually, I discuss it in my Oxford lectures, page 30:
see
http://www.reportlab.org/~andy/accu2005/pyuk2005_simionato_wondersofpython.zip
(there also everything you want to know about new-s
I am trying to inherit from ElementTree so I can add some methods. This
is the code I am trying to make work, and the following is the error I
am getting.
from elementtree import ElementTree
class AcidTree(ElementTree):
def write_string(self):
File "/home/hope/var/proj/acid/serve
This is almost the same code as Greg's with the only difference being that
test for configuration having been done. But the test is unnecessary. I
don't see how setConfig could be invoked in the super of the base class (A),
so such a test would be relevant only in subclasses, if they DO invoke
Dan Perl wrote:
Here is a problem I am having trouble with and I hope someone in this group
will suggest a solution. First, some code that works. 3 classes that are
derived from each other (A->B->C), each one implementing only 2 methods,
__init__ and setConfig.
Thank you very much, Greg, that does the job! Somehow I couldn't see it and
I needed someone to point out to me.
Dan
"Greg Ewing" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Dan Perl wrote:
>> So far, so good! But let's assume that I want to change the __init__
>> methods s
Dan Perl wrote:
So far, so good! But let's assume that I want to change the __init__
methods so that they take a configuration as an argument so the objects are
created and configured in one step, like this:
alpha = A(config)
One way would be to make the setConfig call only
in the root class, an
Here is a problem I am having trouble with and I hope someone in this group
will suggest a solution. First, some code that works. 3 classes that are
derived from each other (A->B->C), each one implementing only 2 methods,
__init__ and setConfig.
51 matches
Mail list logo