Re: class inheritance when not defined

2017-09-08 Thread Ben Finney
Steve D'Aprano writes: > Good way: > > Foreigner speaking English as their second language: > "Who is the father of this class?" > > Native English speaker: > "The father is 'object', but in English we would normally ask > 'what is the parent?' instead." Of the three scenario

Re: class inheritance when not defined

2017-09-08 Thread Steve D'Aprano
On Fri, 8 Sep 2017 07:03 pm, Ben Finney wrote: >> Who is the father of ExampleClass1 ? > > No-one, since classes do not have gender. (The convention is to use the > gender-neutral “parent” to refer to that relationship.) Possibly not the case in Russia. Besides, words have gender in many langua

Re: class inheritance when not defined

2017-09-08 Thread Ben Finney
Andrej Viktorovich writes: > I found several class creation samples: > > class ExampleClass1: > > class ExampleClass2(object): > > > What is difference between them? Very little difference. In Python 3, both create classes that inherit from one other class, ‘object’. In Python 2, the first cre

Re: class inheritance when not defined

2017-09-08 Thread Thomas Jollans
On 2017-09-08 10:17, Andrej Viktorovich wrote: > Hello > > I found several class creation samples: > > class ExampleClass1: > > class ExampleClass2(object): > > > What is difference between them? Who is the father of ExampleClass1 ? > In Python 3, unless you've redefined "object", these are

class inheritance when not defined

2017-09-08 Thread Andrej Viktorovich
Hello I found several class creation samples: class ExampleClass1: class ExampleClass2(object): What is difference between them? Who is the father of ExampleClass1 ? -- https://mail.python.org/mailman/listinfo/python-list

table class - inheritance, delegation?

2017-03-31 Thread duncan smith
Hello, I need to code up a table class, which will be based on numpy arrays. Essentially it needs to behave like a numpy array, but with a variable associated with each array dimension. It must (at least partially) satisfy the API of an existing class. The main reason for the new class is to

Re: Class Inheritance from different module

2014-09-22 Thread Jean-Michel Pichavant
- Original Message - > From: "Jean-Michel Pichavant" > To: "Juan Christian" > Cc: "Python" > Sent: Monday, 22 September, 2014 1:37:41 PM > Subject: Re: Class Inheritance from different module > > > > cl

Re: Class Inheritance from different module

2014-09-22 Thread Jean-Michel Pichavant
> class User(Inheritance from API): > def __init__(self, ID): > steamapi.core.APIConnection(api_key = KEY) > super( " Inheritance SteamUser" (ID)) # creates the user using the > API > > > [...] > > > So that in my code when I need to create a new user, I just call 'usr > = User("XXX")' ins

Re: Class Inheritance from different module

2014-09-20 Thread Peter Otten
Juan Christian wrote: > I have the following structure: > > Third-party API installed via pip: > steamapi / > app.py > consts.py > core.py > users.py > [...] > > My script: > test.py > > > In the API, the module users.py has a class 'SteamUser' and I want to > mimic it's usage on my code, like

Re: Class Inheritance from different module

2014-09-20 Thread Steven D'Aprano
Juan Christian wrote: [...] > In the API, the module users.py has a class 'SteamUser' and I want to > mimic it's usage on my code, like this: > > import steamapi > > [...] > > class User(Inheritance from API): What do you mean, "Inheritance from API"? You can't inherit from an API, only from c

Class Inheritance from different module

2014-09-20 Thread Juan Christian
I have the following structure: Third-party API installed via pip: steamapi / app.py consts.py core.py users.py [...] My script: test.py In the API, the module users.py has a class 'SteamUser' and I want to mimic it's usage on my code, like this: import steamapi [...] class User(Inheritance

Re: class inheritance python2.7 vs python3.3

2014-01-06 Thread jwe . van . dijk
On Monday, 6 January 2014 18:14:08 UTC+1, jwe.va...@gmail.com wrote: > I have problems with these two classes: > > > > class LPU1(): > > def __init__(self, formula): > > """ > > formula is a string that is parsed into a SymPy function > > and several derived func

Re: class inheritance python2.7 vs python3.3

2014-01-06 Thread Steven D'Aprano
jwe.van.d...@gmail.com wrote: > I have problems with these two classes: > > class LPU1(): > def __init__(self, formula): > """ > formula is a string that is parsed into a SymPy function > and several derived functions > """ > self.formula = formula >

Re: class inheritance python2.7 vs python3.3

2014-01-06 Thread Dave Angel
On Mon, 6 Jan 2014 09:14:08 -0800 (PST), jwe.van.d...@gmail.com wrote: I have problems with these two classes: class LPU1() : You forgot to derive from object. That's implied on 3.x, but you say you're also running on 2.7 Without naming your base class you're asking for an old style clas

Re: class inheritance python2.7 vs python3.3

2014-01-06 Thread Chris Angelico
On Tue, Jan 7, 2014 at 4:14 AM, wrote: > class LPU3(LPU1): > def __new__(self): > """ > the same functions as LPU1 but some added functions > and some functions redefined > """ You probably don't want to be using __new__ here. Try using __init__ instead, o

class inheritance python2.7 vs python3.3

2014-01-06 Thread jwe . van . dijk
I have problems with these two classes: class LPU1(): def __init__(self, formula): """ formula is a string that is parsed into a SymPy function and several derived functions """ self.formula = formula ... ... class LPU3(LPU1): def __new_

Re: I am a newbie for python and try to understand class Inheritance.

2011-10-15 Thread DevPlayer
On Oct 15, 2:20 am, aaabb...@hotmail.com wrote: > Test.py > --- > #!/usr/bin/python > > from my_lib import my_function > > class MyClass(my_function): # usually class names start capital > > """We know you're not forgetting to document.""" > >     def __init__(self, name): > sup

Re: I am a newbie for python and try to understand class Inheritance.

2011-10-15 Thread Chris Rebert
: >    def __initial__(self, name): >         pass >    def test(self): >       print "this is a test" > > If __name__ == '__main__': >    my_class.main() > ------- > my_lib.py > class p_test() >

Re: I am a newbie for python and try to understand class Inheritance.

2011-10-15 Thread aaabbb16
this call will fail. how to do it? > > --- > > my_lib.py > > class my_function() > > You're missing a colon after the parentheses. Also, you're writing a > class, not a function, so please rename the class something le

Re: I am a newbie for python and try to understand class Inheritance.

2011-10-15 Thread Chris Rebert
On Sat, Oct 15, 2011 at 12:09 AM, Jason Swails wrote: > For instance, let's say you want to deal with shapes.  You can define a > shape via a class > > class Shape(object): >    """ Base shape class """ > Now we get into inheritance.  Let's suppose that we want a specific type of > shape.  For i

Re: I am a newbie for python and try to understand class Inheritance.

2011-10-15 Thread Jason Swails
if your my_class has a main() attribute function to it. Note that the typical way of dealing with classes is to instantiate different classes. > > Can anyone finish above code and let me try to understand > Class inheritance? > You appear to be confusing functions and classes. Funct

Re: I am a newbie for python and try to understand class Inheritance.

2011-10-15 Thread Chris Rebert
> my_lib.py > class my_function() You're missing a colon after the parentheses. Also, you're writing a class, not a function, so please rename the class something less confusing. > Can anyone finish above code and let me try to understand > Class inheritanc

I am a newbie for python and try to understand class Inheritance.

2011-10-14 Thread aaabbb16
-- my_lib.py class my_function() ... Can anyone finish above code and let me try to understand Class inheritance? TIA. -david -- http://mail.python.org/mailman/listinfo/python-list

Re: class inheritance

2010-12-23 Thread JLundell
That's nice, Ethan, especially in that it saves having to explicitly find and list all the methods being covered. It's perhaps not quite so critical for a Fraction-based class, since the set of methods to be covered is fairly well contained, but that's not always going to be the case. The appro

Re: class inheritance

2010-12-21 Thread Ethan Furman
JLundell wrote: On Saturday, March 13, 2010 9:03:36 AM UTC-8, Jonathan Lundell wrote: I've got a subclass of fractions.Fraction called Value; it's a mostly trivial class, except that it overrides __eq__ to mean 'nearly equal'. However, since Fraction's operations result in a Fraction, not a Valu

Re: class inheritance

2010-12-17 Thread JLundell
On Saturday, March 13, 2010 9:03:36 AM UTC-8, Jonathan Lundell wrote: > I've got a subclass of fractions.Fraction called Value; it's a mostly > trivial class, except that it overrides __eq__ to mean 'nearly equal'. > However, since Fraction's operations result in a Fraction, not a > Value, I end up

Re: Did class inheritance from "dict" work in early Python?

2010-07-21 Thread Steven D'Aprano
On Wed, 21 Jul 2010 19:45:24 -0700, John Nagle wrote: > Did class inheritance from "dict" work in early Python? Or did that > only start working when "new objects" came in? Only with the introduction of new-style classes and "object" in version 2.2. htt

Re: Did class inheritance from "dict" work in early Python?

2010-07-21 Thread Stephen Hansen
On 7/21/10 7:45 PM, John Nagle wrote: >Did class inheritance from "dict" work in early Python? Or did > that only start working when "new objects" came in? The latter, that's why UserDict (and UserList) was added. -- Stephen Hansen ... Also: Ixokai

Did class inheritance from "dict" work in early Python?

2010-07-21 Thread John Nagle
Did class inheritance from "dict" work in early Python? Or did that only start working when "new objects" came in? John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: class inheritance

2010-03-18 Thread JLundell
On Mar 17, 5:12 pm, Steven D'Aprano wrote: > On Mon, 15 Mar 2010 16:34:35 -0700,JLundellwrote: > > It's also unfortunate that Python doesn't have an approximately-equal > > operator; it'd come in handy for floating-point applications while > > preserving hash. If only there were a ~= or ≈ operator

Re: class inheritance

2010-03-17 Thread Steven D'Aprano
On Mon, 15 Mar 2010 16:34:35 -0700, JLundell wrote: > It's also unfortunate that Python doesn't have an approximately-equal > operator; it'd come in handy for floating-point applications while > preserving hash. If only there were a ~= or ≈ operator I could overload. > And ~ is unary, so no joy.

Re: class inheritance

2010-03-16 Thread Robert Kern
On 2010-03-16 17:55 PM, JLundell wrote: On Mar 16, 8:06 am, Robert Kern wrote: On 2010-03-16 07:35 AM, Dave Angel wrote: Carl Banks wrote: On Mar 15, 4:34 pm, JLundell wrote: It's also unfortunate that Python doesn't have an approximately-equal operator; it'd come in handy for floating-poi

Re: class inheritance

2010-03-16 Thread JLundell
On Mar 16, 8:06 am, Robert Kern wrote: > On 2010-03-16 07:35 AM, Dave Angel wrote: > > > > > > > > > Carl Banks wrote: > >> On Mar 15, 4:34 pm, JLundell wrote: > >>> It's also unfortunate that Python doesn't have an approximately-equal > >>> operator; it'd come in handy for floating-point applica

Re: class inheritance

2010-03-16 Thread Robert Kern
On 2010-03-16 07:35 AM, Dave Angel wrote: Carl Banks wrote: On Mar 15, 4:34 pm, JLundell wrote: It's also unfortunate that Python doesn't have an approximately-equal operator; it'd come in handy for floating-point applications while preserving hash. If only there were a ~=r ≈ operator I coul

Re: class inheritance

2010-03-16 Thread Dave Angel
Carl Banks wrote: On Mar 15, 4:34 pm, JLundell wrote: It's also unfortunate that Python doesn't have an approximately-equal operator; it'd come in handy for floating-point applications while preserving hash. If only there were a ~=r ≈ operator I could overload. And ~ is unary, so no joy.

Re: class inheritance

2010-03-15 Thread Carl Banks
On Mar 15, 4:34 pm, JLundell wrote: > It's also unfortunate that Python doesn't have an approximately-equal > operator; it'd come in handy for floating-point applications while > preserving hash. If only there were a ~= or ≈ operator I could > overload. And ~ is unary, so no joy. One problem with

Re: class inheritance

2010-03-15 Thread JLundell
On Mar 13, 1:26 pm, Carl Banks wrote: > It's a tad unfortunately Python doesn't make this easier.  If I had to > do it more than once I'd probably write a mixin to do it: > > class ArithmeticSelfCastMixin(object): >     def __add__(self,other): >         return > self.__class__(super(ArithmeticSel

Re: class inheritance

2010-03-15 Thread Jean-Michel Pichavant
JLundell wrote: I've got a subclass of fractions.Fraction called Value; it's a mostly trivial class, except that it overrides __eq__ to mean 'nearly equal'. However, since Fraction's operations result in a Fraction, not a Value, I end up with stuff like this: x = Value(1) + Value(2) where x is

Re: class inheritance

2010-03-13 Thread Carl Banks
On Mar 13, 9:03 am, JLundell wrote: > I've got a subclass of fractions.Fraction called Value; it's a mostly > trivial class, except that it overrides __eq__ to mean 'nearly equal'. > However, since Fraction's operations result in a Fraction, not a > Value, I end up with stuff like this: > > x = Va

Re: class inheritance

2010-03-13 Thread JLundell
On Mar 13, 9:37 am, Jack Diederich wrote: > If Fraction.__add__ returns a new object but the subclass Value is > compatible (as I would except since it is a sublcass) then just change > all references in Franction.__add__ to be more generic, ex/ > > class Franction(): >   def __add__(self, other):

Re: class inheritance

2010-03-13 Thread Patrick Maupin
On Mar 13, 11:37 am, Jack Diederich wrote: > If Fraction.__add__ returns a new object but the subclass Value is > compatible (as I would except since it is a sublcass) then just change > all references in Franction.__add__ to be more generic, ex/ > > class Franction(): >   def __add__(self, other)

Re: class inheritance

2010-03-13 Thread Jack Diederich
On Sat, Mar 13, 2010 at 12:03 PM, JLundell wrote: > I've got a subclass of fractions.Fraction called Value; it's a mostly > trivial class, except that it overrides __eq__ to mean 'nearly equal'. > However, since Fraction's operations result in a Fraction, not a > Value, I end up with stuff like th

Re: class inheritance

2010-03-13 Thread Patrick Maupin
On Mar 13, 11:03 am, JLundell wrote: > I've got a subclass of fractions.Fraction called Value; it's a mostly > trivial class, except that it overrides __eq__ to mean 'nearly equal'. > However, since Fraction's operations result in a Fraction, not a > Value, I end up with stuff like this: > > x = V

class inheritance

2010-03-13 Thread JLundell
I've got a subclass of fractions.Fraction called Value; it's a mostly trivial class, except that it overrides __eq__ to mean 'nearly equal'. However, since Fraction's operations result in a Fraction, not a Value, I end up with stuff like this: x = Value(1) + Value(2) where x is now a Fraction, no

Re: Automatic Attribute Assignment during Class Inheritance

2009-09-09 Thread gizli
On Sep 9, 9:00 pm, Steven D'Aprano wrote: > On Wed, 09 Sep 2009 20:14:33 -0700, gizli wrote: > > I do not want to force the consumers of this framework to write this > > obscure line of code. I was wondering if it is possible (at class > > definition time) to capture the fact that MyTask extends T

Re: Automatic Attribute Assignment during Class Inheritance

2009-09-09 Thread Steven D'Aprano
On Wed, 09 Sep 2009 20:14:33 -0700, gizli wrote: > I do not want to force the consumers of this framework to write this > obscure line of code. I was wondering if it is possible (at class > definition time) to capture the fact that MyTask extends Task and > automatically insert the polymorphic_ide

Automatic Attribute Assignment during Class Inheritance

2009-09-09 Thread gizli
Hi all, I have been trying to do a programming trick with python and so far I failed. I am using sqlalchemy in my code and writing a framework with it. This framework uses something called polymorphic identity attribute to define the do single table inheritance. Here's roughly how it works: 1. De

Re: Visualize class inheritance hierarchy

2008-09-23 Thread Rob Kirkpatrick
On Sep 23, 4:58 pm, Christian Heimes <[EMAIL PROTECTED]> wrote: > Rob Kirkpatrick wrote: > > I'm assuming this has been discussed before, but I'm lacking any > > Google keywords that bring up the appropriate discussion. > > You are looking for "mro" aka method resolution order. The inspect > module

Re: Visualize class inheritance hierarchy

2008-09-23 Thread Aaron "Castironpi" Brady
On Sep 23, 5:53 pm, Rob Kirkpatrick <[EMAIL PROTECTED]> wrote: > Hi All, > > I just finished debugging some code where I needed to determine why > one subclass had a bound method and another did not.  They had > different pedigree's but I didn't know immediately what the > differences were. > > I e

Re: Visualize class inheritance hierarchy

2008-09-23 Thread Aaron "Castironpi" Brady
On Sep 23, 5:53 pm, Rob Kirkpatrick <[EMAIL PROTECTED]> wrote: > Hi All, > > I just finished debugging some code where I needed to determine why > one subclass had a bound method and another did not.  They had > different pedigree's but I didn't know immediately what the > differences were. > > I e

Re: Visualize class inheritance hierarchy

2008-09-23 Thread Christian Heimes
Rob Kirkpatrick wrote: I'm assuming this has been discussed before, but I'm lacking any Google keywords that bring up the appropriate discussion. You are looking for "mro" aka method resolution order. The inspect module contains several helper functions to inspect a class hierarchy. The foll

Visualize class inheritance hierarchy

2008-09-23 Thread Rob Kirkpatrick
Hi All, I just finished debugging some code where I needed to determine why one subclass had a bound method and another did not. They had different pedigree's but I didn't know immediately what the differences were. I ended up walking the hierarchy, going back one class at a time through the cod

Re: Class Inheritance - What am I doing wrong?

2008-04-25 Thread Brian Munroe
On Apr 24, 10:11 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > In python, use attributes starting with a single underscore (such as > _name). It tells users that they shouldn't mess with them. By > design, python doesn't include mechanisms equivalent to the Java / C++ > 'private'. Arnaud, G

Re: Class Inheritance - What am I doing wrong?

2008-04-25 Thread Bruno Desthuilliers
Brian Munroe a écrit : Ok, so thanks everyone for the helpful hints. That *was* a typo on my part (should've been super(B...) not super(A..), but I digress) I'm building a public API. Along with the API I have a few custom types that I'm expecting API users to extend, if they need too. If I d

Re: Class Inheritance - What am I doing wrong?

2008-04-24 Thread Arnaud Delobelle
Brian Munroe <[EMAIL PROTECTED]> writes: > Ok, so thanks everyone for the helpful hints. That *was* a typo on my > part (should've been super(B...) not super(A..), but I digress) > > I'm building a public API. Along with the API I have a few custom > types that I'm expecting API users to extend,

Re: Class Inheritance - What am I doing wrong?

2008-04-24 Thread Gabriel Genellina
En Thu, 24 Apr 2008 18:18:01 -0300, Brian Munroe <[EMAIL PROTECTED]> escribió: Ok, so thanks everyone for the helpful hints. That *was* a typo on my part (should've been super(B...) not super(A..), but I digress) I'm building a public API. Along with the API I have a few custom types that I

Re: Class Inheritance - What am I doing wrong?

2008-04-24 Thread Brian Munroe
Ok, so thanks everyone for the helpful hints. That *was* a typo on my part (should've been super(B...) not super(A..), but I digress) I'm building a public API. Along with the API I have a few custom types that I'm expecting API users to extend, if they need too. If I don't use name mangling, i

Re: Class Inheritance - What am I doing wrong?

2008-04-24 Thread Gary Herron
Brian Munroe wrote: My example: class A(object): def __init__(self, name): self.__name = name def getName(self): return self.__name class B(A): def __init__(self,name=None): super(A,self).__init__() def setName(

Re: Class Inheritance - What am I doing wrong?

2008-04-24 Thread Arnaud Delobelle
Arnaud Delobelle <[EMAIL PROTECTED]> writes: > That is, if you also pass the name parameter to super(A,self).__init__ > in B's __init__ method Oops. should be super(B, self).__init__(name), of course. -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Class Inheritance - What am I doing wrong?

2008-04-24 Thread Arnaud Delobelle
Brian Munroe <[EMAIL PROTECTED]> writes: > My example: > > class A(object): > > def __init__(self, name): > self.__name = name > > def getName(self): > return self.__name > > class B(A): > > def __init__(self,name=None): > super(A,self)._

Re: Class Inheritance - What am I doing wrong?

2008-04-24 Thread Virgil Dupras
On Apr 24, 10:22 pm, Brian Munroe <[EMAIL PROTECTED]> wrote: > My example: > > class A(object): > >         def __init__(self, name): >                 self.__name = name > >         def getName(self): >                 return self.__name > > class B(A): > >         def __init__(self,name=None): >

Class Inheritance - What am I doing wrong?

2008-04-24 Thread Brian Munroe
My example: class A(object): def __init__(self, name): self.__name = name def getName(self): return self.__name class B(A): def __init__(self,name=None): super(A,self).__init__() def setName(self, name):

Re: str class inheritance prob?

2008-04-18 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > so I’m trying to create a class that inherits from str, but I want to > run some code on the value on object init. this is what I have: Others already gave you the technical solution (use __new__, not __init__). A couple remarks still: 1/ > > class Path(str): >

Re: str class inheritance prob?

2008-04-16 Thread s0suk3
On Apr 16, 1:43 pm, [EMAIL PROTECTED] wrote: > so I’m trying to create a class that inherits from str, but I want to > run some code on the value on object init. this is what I have: > > class Path(str): > def __init__( self, path ): > clean = str(path).replace(

Re: str class inheritance prob?

2008-04-16 Thread Jerry Hill
On Wed, Apr 16, 2008 at 2:35 PM, Hamish McKenzie <[EMAIL PROTECTED]> wrote: > so I'm trying to create a class that inherits from str, but I want to run > some code on the value on object init. this is what I have: You actually want to run your code when creating the new object, not when initializ

str class inheritance prob?

2008-04-16 Thread Hamish McKenzie
so I'm trying to create a class that inherits from str, but I want to run some code on the value on object init. this is what I have: class Path(str): def __init__( self, path ): clean = str(path).replace('\\','/') while clean.f

str class inheritance prob?

2008-04-16 Thread jkazoo
so I’m trying to create a class that inherits from str, but I want to run some code on the value on object init. this is what I have: class Path(str): def __init__( self, path ): clean = str(path).replace('\\','/') while clean.find('//'

Re: Class Inheritance

2008-03-13 Thread Bruno Desthuilliers
Andrew Rekdal < a écrit : > I am trying to bring functions to a class by inheritance... for instance in > layout_ext I have.. > > > --- layout_ext.py- > class Layout() > def...some function that rely on css in Layout.py It shouldn't, definitively. The Layout instance should have a r

Re: Class Inheritance

2008-03-13 Thread Marc 'BlackJack' Rintsch
On Thu, 13 Mar 2008 00:06:52 -0500, "Andrew Rekdal" < wrote: > Problem is layout_ext and Layout code is dependant on a Class instance > 'css'. Then pass that instance to the `Layout` class in the `__init__()` so both, the base class and the subclass use the same `CSS` instance. Ciao, Ma

Class Inheritance

2008-03-12 Thread "Andrew Rekdal"
I am trying to bring functions to a class by inheritance... for instance in layout_ext I have.. --- layout_ext.py- class Layout() def...some function that rely on css in Layout.py def... ---EOF-- in the main application file I have... Layout.py--- from layout_ext import Lay

Re: Case study: library class inheritance with property declarations

2007-08-08 Thread cdleary
On Aug 2, 7:05 am, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] a écrit : > (snip) > > > Last post -- I swear. > > > I failed to realize that it's all part of an extremely well defined > > attribute resolution protocol, and handled via the descriptor > > specification. Discuss

Re: Case study: library class inheritance with property declarations

2007-08-02 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : (snip) > Last post -- I swear. > > I failed to realize that it's all part of an extremely well defined > attribute resolution protocol, and handled via the descriptor > specification. Discussing descriptors was on the TODO list for the > type/class unification document,

Re: Case study: library class inheritance with property declarations

2007-08-02 Thread Steve Holden
[EMAIL PROTECTED] wrote: > On Aug 2, 7:08 am, [EMAIL PROTECTED] wrote: >> On Aug 2, 6:49 am, [EMAIL PROTECTED] wrote: >> >> >> >>> Hi all, >>> It's possible that I'm missing the obvious -- I've been up for over 24 >>> hours and I'm most likely dehydrated from mass coffee intake, but I >>> figure ma

Re: Case study: library class inheritance with property declarations

2007-08-02 Thread cdleary
On Aug 2, 7:08 am, [EMAIL PROTECTED] wrote: > On Aug 2, 6:49 am, [EMAIL PROTECTED] wrote: > > > > > Hi all, > > > It's possible that I'm missing the obvious -- I've been up for over 24 > > hours and I'm most likely dehydrated from mass coffee intake, but I > > figure many people in similar circumst

Re: Case study: library class inheritance with property declarations

2007-08-02 Thread cdleary
On Aug 2, 6:49 am, [EMAIL PROTECTED] wrote: > Hi all, > > It's possible that I'm missing the obvious -- I've been up for over 24 > hours and I'm most likely dehydrated from mass coffee intake, but I > figure many people in similar circumstances will be searching > comp.lang.python one day, so here

Case study: library class inheritance with property declarations

2007-08-02 Thread cdleary
Hi all, It's possible that I'm missing the obvious -- I've been up for over 24 hours and I'm most likely dehydrated from mass coffee intake, but I figure many people in similar circumstances will be searching comp.lang.python one day, so here goes! class LibraryClass(object): """ A clas

Re: How to set a class inheritance at instance creation?

2007-05-29 Thread glomde
On 29 Maj, 22:45, Steve Holden <[EMAIL PROTECTED]> wrote: > glomde wrote: > > Hi I wonder if you can set what subclass a class should > > have at instance creation. > > > The problem is that I have something like: > > > class CoreLang(): > > def AssignVar(self, var, value): > > pass >

Re: How to set a class inheritance at instance creation?

2007-05-29 Thread Steve Holden
glomde wrote: > Hi I wonder if you can set what subclass a class should > have at instance creation. > > The problem is that I have something like: > > class CoreLang(): > def AssignVar(self, var, value): > pass > > class Lang1(CoreLang): > def AssignVar(self, var, value): >

Re: How to set a class inheritance at instance creation?

2007-05-29 Thread Stargaming
glomde schrieb: > Hi I wonder if you can set what subclass a class should > have at instance creation. > > The problem is that I have something like: > > class CoreLang(): > def AssignVar(self, var, value): > pass > > class Lang1(CoreLang): > def AssignVar(self, var, value): >

Re: How to set a class inheritance at instance creation?

2007-05-29 Thread Ramashish Baranwal
On May 29, 8:52 pm, glomde <[EMAIL PROTECTED]> wrote: > Hi I wonder if you can set what subclass a class should > have at instance creation. > > The problem is that I have something like: > > class CoreLang(): > def AssignVar(self, var, value): > pass > > class Lang1(CoreLang): >

Re: How to set a class inheritance at instance creation?

2007-05-29 Thread glomde
On 29 Maj, 19:20, Ramashish Baranwal <[EMAIL PROTECTED]> wrote: > On May 29, 8:52 pm, glomde <[EMAIL PROTECTED]> wrote: > > > > > Hi I wonder if you can set what subclass a class should > > have at instance creation. > > > The problem is that I have something like: > > > class CoreLang(): > > d

Re: How to set a class inheritance at instance creation?

2007-05-29 Thread glomde
On 29 Maj, 19:27, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Why not just have Lang1 and Lang2 inherit from WriteStruct as well? This wont work I think since if add antoher Class: class WriteStruct(): def func1(self); print "Hello2" def Generate(self): self.func1() class

Re: How to set a class inheritance at instance creation?

2007-05-29 Thread [EMAIL PROTECTED]
Why not just have Lang1 and Lang2 inherit from WriteStruct as well? On May 29, 8:52 am, glomde <[EMAIL PROTECTED]> wrote: > Hi I wonder if you can set what subclass a class should > have at instance creation. > > The problem is that I have something like: > > class CoreLang(): > def AssignVar(

Re: How to set a class inheritance at instance creation?

2007-05-29 Thread Ramashish Baranwal
On May 29, 8:52 pm, glomde <[EMAIL PROTECTED]> wrote: > Hi I wonder if you can set what subclass a class should > have at instance creation. > > The problem is that I have something like: > > class CoreLang(): > def AssignVar(self, var, value): > pass > > class Lang1(CoreLang): >

How to set a class inheritance at instance creation?

2007-05-29 Thread glomde
Hi I wonder if you can set what subclass a class should have at instance creation. The problem is that I have something like: class CoreLang(): def AssignVar(self, var, value): pass class Lang1(CoreLang): def AssignVar(self, var, value): return var, "=", value class

Re: Dynamic class inheritance && something else

2005-06-14 Thread Chinook
On Tue, 14 Jun 2005 12:39:09 -0400, Vero wrote (in article <[EMAIL PROTECTED]>): > Hi. My name is Veronica, I am a master student at UNAM. I am working on > something related to Artificial Inteligence and I have been looking for the > most appropriated programming language to implement my algo

Dynamic class inheritance && something else

2005-06-14 Thread Vero
Hi.  My name is Veronica, I am a master student at UNAM.  I am working on something related to Artificial Inteligence and I have been looking for the most appropriated programming language to implement my algorithms.  I found python to be very close to what I need, but there are still a couple of