Hey guys,
I'm trying to understand how is working base class and derived class.
So, I have to files baseClass.py and derivedClass.py.
baseClass.py :
[CODE]class baseClass():
def bFunction(self):
print We are in a base class[/CODE]
derivedClass.py:
[CODE]import baseClass as
Hey guys,
I'm trying to understand how is working base class and derived class.
So, I have to files baseClass.py and derivedClass.py.
baseClass.py :
class baseClass():
def bFunction(self):
print We are in a base class
derivedClass.py:
import baseClass as baseClassMod
On 11/06/2012 08:50 AM, cyberira...@gmail.com wrote:
Hey guys,
I'm trying to understand how is working base class and derived class.
in what Python version ?
So, I have to files baseClass.py and derivedClass.py.
baseClass.py :
class baseClass():
How did all those angle brackets get into
in what Python version ?
Python 2.7.3
How did all those angle brackets get into the file? Are you confusing
an interactive interpreter session with running source files?
I've used angle brackets just for posting here,becauze this forum doesn't
support [code][/code]
I have a file
Just got answer, I didn't call a class it's self. Correct code is:
class derivedClass(baseClassMod.baseClass):
def ..
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Nov 6, 2012 at 8:03 AM, cyberira...@gmail.com wrote:
I've used angle brackets just for posting here,becauze this forum doesn't
support [code][/code]
This is a Usenet group, not a web forum.
Just got answer, I didn't call a class it's self. Correct code is:
class
On Tuesday, November 6, 2012 4:35:47 PM UTC+1, Ian wrote:
On Tue, Nov 6, 2012 at 8:03 AM,
I've used angle brackets just for posting here,becauze this forum doesn't
support [code][/code]
This is a Usenet group, not a web forum.
Just got answer, I didn't call a class it's
On 6/11/12 14:47:03, cyberira...@gmail.com wrote:
Hey guys,
I'm trying to understand how is working base class and derived class.
So, I have to files baseClass.py and derivedClass.py.
baseClass.py :
[CODE]class baseClass():
def bFunction(self):
print We are in a base
On Nov 7, 1:08 am, cyberira...@gmail.com wrote:
Just got answer, I didn't call a class it's self. Correct code is:
class derivedClass(baseClassMod.baseClass):
def ..
Incidentally, this is why it's recommended to give modules lowercase
names - baseclass - and classes camelcased ones -
Pardon me if this is a silly question.
If I decorate a class, then subclass it, does my subclass feature
whatever the decorator did to my superclass?
Thanks in advance.
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, Jan 16, 2012 at 10:10 AM, deathweaselx86 deathwea...@gmail.com wrote:
If I decorate a class, then subclass it, does my subclass feature
whatever the decorator did to my superclass?
Yes. The following two things are completely equivalent:
@foo
class Bar(...):
...
# and
class
On Mon, Jan 16, 2012 at 8:10 AM, deathweaselx86 deathwea...@gmail.com wrote:
Pardon me if this is a silly question.
If I decorate a class, then subclass it, does my subclass feature
whatever the decorator did to my superclass?
That depends on what the decorator did. Changes made directly to
Paul Rudin wrote:
Gregory Ewing greg.ew...@canterbury.ac.nz writes:
You can clean up dir() by defining __all__ as a list of
names that you want to officially export.
I'm not sure that's necessarily a good idea... when you're trying to figure
out why something behaves in a certain way you
On Sat, 30 Oct 2010 19:30:21 +1300, Gregory Ewing wrote:
(BTW, there are no function names that have a special meaning in a
module dict -- a module is not like a class.)
Pity... it would be nice to have a __main__() function, or perhaps
main(), that was automatically called when you call the
Brendan wrote:
I use
Python sporadically, and frequently use the dir command to learn or
remind myself of class methods.
You can clean up dir() by defining __all__ as a list of
names that you want to officially export. Other names will
still be there, but they won't show up in the dir()
Gregory Ewing greg.ew...@canterbury.ac.nz writes:
Brendan wrote:
I use
Python sporadically, and frequently use the dir command to learn or
remind myself of class methods.
You can clean up dir() by defining __all__ as a list of
names that you want to officially export. Other names will
In message 8idvgaf21...@mid.individual.net, Peter Pearson wrote:
Yes, module w imports x, and therefore w.x exists. Is that bad?
No-one seems to have come out and said this yet (unless it was in one of
those messages that no longer seem to be accessible on my ISP’s news
server): Python has
On Oct 22, 2:21 pm, Peter Pearson ppear...@nowhere.invalid wrote:
On Fri, 22 Oct 2010 07:49:39 -0700 (PDT), Brendan wrote:
[snip]
x.py
class X(object):
pass
y.py
import x
class Y(x.X):
pass
z.py
import x
import y
class ZX(x.X):
pass
class ZY(y.Y):
On Thu, 21 Oct 2010 12:12:34 -0700, Brendan wrote:
Because y.py has from x import x the x class from x.py is added to
the y.py namespace.
~Ethan~- Hide quoted text -
- Show quoted text -
So what is usually done to prevent this? (In my case not wanting class x
added to the y.py
On Oct 22, 5:02 am, Steven D'Aprano st...@remove-this-
cybersource.com.au wrote:
On Thu, 21 Oct 2010 12:12:34 -0700, Brendan wrote:
Because y.py has from x import x the x class from x.py is added to
the y.py namespace.
~Ethan~- Hide quoted text -
- Show quoted text -
So what is
On 2:59 PM, Brendan wrote:
On Oct 21, 3:56 pm, Ethan Furmanet...@stoneleaf.us wrote:
snip
Because y.py has from x import x the x class from x.py is added to the
y.py namespace.
~Ethan~- Hide quoted text -
- Show quoted text -
So what is usually done to prevent this? (In my case not
On Oct 22, 9:16 am, Dave Angel da...@dejaviewphoto.com wrote:
On 2:59 PM, Brendan wrote: On Oct 21, 3:56 pm, Ethan
Furmanet...@stoneleaf.us wrote:
snip
Because y.py has from x import x the x class from x.py is added to the
y.py namespace.
~Ethan~- Hide quoted text -
- Show quoted
On Fri, 22 Oct 2010 07:49:39 -0700 (PDT), Brendan wrote:
[snip]
x.py
class X(object):
pass
y.py
import x
class Y(x.X):
pass
z.py
import x
import y
class ZX(x.X):
pass
class ZY(y.Y):
pass
w.py
import x
import y
import z
class WX(x.X):
pass
class WY(y.Y):
Two modules:
x.py:
class x(object):
pass
y.py:
from x import x
class y(x):
pass
Now from the python command line:
import y
dir(y)
['__builtins__', '__doc__', '__file__', '__name__', '__package__',
'x', 'y']
I do not understand why class 'x' shows up here.
--
On 10/21/2010 08:09 PM, Brendan wrote:
Two modules:
x.py:
class x(object):
pass
y.py:
from x import x
class y(x):
pass
Now from the python command line:
import y
dir(y)
['__builtins__', '__doc__', '__file__', '__name__', '__package__',
'x', 'y']
I do not understand why class 'x'
On Oct 21, 11:09 am, Brendan brendandetra...@yahoo.com wrote:
Two modules:
x.py:
class x(object):
pass
y.py:
from x import x
class y(x):
pass
Now from the python command line: import y
dir(y)
['__builtins__', '__doc__', '__file__', '__name__', '__package__',
'x', 'y']
I
On Oct 21, 3:47 pm, Carl Banks pavlovevide...@gmail.com wrote:
On Oct 21, 11:09 am, Brendan brendandetra...@yahoo.com wrote:
Two modules:
x.py:
class x(object):
pass
y.py:
from x import x
class y(x):
pass
Now from the python command line: import y
dir(y)
Jonas H. wrote:
On 10/21/2010 08:09 PM, Brendan wrote:
Two modules:
x.py:
class x(object):
pass
y.py:
from x import x
class y(x):
pass
Now from the python command line:
import y
dir(y)
['__builtins__', '__doc__', '__file__', '__name__', '__package__',
'x', 'y']
I do not
On Thu, Oct 21, 2010 at 11:53 AM, Brendan brendandetra...@yahoo.com wrote:
On Oct 21, 3:47 pm, Carl Banks pavlovevide...@gmail.com wrote:
On Oct 21, 11:09 am, Brendan brendandetra...@yahoo.com wrote:
Two modules:
x.py:
class x(object):
pass
y.py:
from x import x
class y(x):
On 10/21/10 1:53 PM, Brendan wrote:
On Oct 21, 3:47 pm, Carl Bankspavlovevide...@gmail.com wrote:
On Oct 21, 11:09 am, Brendanbrendandetra...@yahoo.com wrote:
Two modules:
x.py:
class x(object):
pass
y.py:
from x import x
class y(x):
pass
Now from the python command
On Oct 21, 12:53 pm, Brendan brendandetra...@yahoo.com wrote:
So it must never make sense to put subclasses in separate modules?
It doesn't matter to Python whether the subclass is in the same module
or imported. Do it whichever way makes the most sense to you from a
code organization
On Oct 21, 3:56 pm, Ethan Furman et...@stoneleaf.us wrote:
Jonas H. wrote:
On 10/21/2010 08:09 PM, Brendan wrote:
Two modules:
x.py:
class x(object):
pass
y.py:
from x import x
class y(x):
pass
Now from the python command line:
import y
dir(y)
On Oct 21, 11:53 am, Brendan brendandetra...@yahoo.com wrote:
On Oct 21, 3:47 pm, Carl Banks pavlovevide...@gmail.com wrote:
On Oct 21, 11:09 am, Brendan brendandetra...@yahoo.com wrote:
Two modules:
x.py:
class x(object):
pass
y.py:
from x import x
class y(x):
On 10/21/10 2:12 PM, Brendan wrote:
On Oct 21, 3:56 pm, Ethan Furmanet...@stoneleaf.us wrote:
Jonas H. wrote:
On 10/21/2010 08:09 PM, Brendan wrote:
Two modules:
x.py:
class x(object):
pass
y.py:
from x import x
class y(x):
pass
Now from the python command line:
import y
On Sun, 15 Nov 2009 16:26:59 -0800, Pyrot wrote:
On 11월15일, 오후9시52분, Diez B. Roggisch de...@nospam.web.de wrote:
Pyrot schrieb:
class rawDNA:
import string
[...]
(Tthe core reason that I'm bothering with this at all is because I heard
imports are costly(in time, space, processing
class rawDNA:
import string
trans = string.maketrans(GATC,CTAG)
def __init__(self, template = GATTACA):
self.template = template //shouldn't this make template
accessible within the scope of rawDNA??
def noncoding(self):
print
Pyrot schrieb:
class rawDNA:
import string
Importing here is unusual. Unless you have good reasons to do so, I
suggest you put the imports on top of the file.
trans = string.maketrans(GATC,CTAG)
def __init__(self, template = GATTACA):
self.template
Pyrot wrote:
class rawDNA:
import string
trans = string.maketrans(GATC,CTAG)
def __init__(self, template = GATTACA):
self.template = template //shouldn't this make template
accessible within the scope of rawDNA??
No. Python's scope resolution
Diez B. Roggisch schrieb:
Pyrot schrieb:
class rawDNA:
import string
Importing here is unusual. Unless you have good reasons to do so, I
suggest you put the imports on top of the file.
trans = string.maketrans(GATC,CTAG)
def __init__(self, template = GATTACA):
On 11월15일, 오후10시15분, Tim Chase python.l...@tim.thechases.com wrote:
Pyrot wrote:
class rawDNA:
import string
trans = string.maketrans(GATC,CTAG)
def __init__(self, template = GATTACA):
self.template = template //shouldn't this make template
accessible within the
On 11월15일, 오후9시52분, Diez B. Roggisch de...@nospam.web.de wrote:
Pyrot schrieb:
class rawDNA:
import string
Importing here is unusual. Unless you have good reasons to do so, I
suggest you put the imports on top of the file.
trans = string.maketrans(GATC,CTAG)
def
On Nov 15, 6:26 pm, Pyrot sungs...@gmail.com wrote:
what happens when I use the import statement within a class/function
declaration?
I'm thinking either
1) It imports during the class/function declaration
2) It imports the first time a class/function call(x = rawDNA() )
occurs
But if
I can't find a psyco mailing list that I can directly ask to (so point
me to it if there is one), so I'm posting it here. I know very little
about how types and classes work in python and this is probably why
I'm having trouble.
I wrote a class inheriting pysco.classes, and the class structure is
En Tue, 30 Oct 2007 02:51:39 -0300, Donn Ingle [EMAIL PROTECTED]
escribió:
While Java's variable declarations bear a superficial (syntactical)
similarity to C, their semantics is in fact equivalent to the
object-reference semantics we know in Python.
I come from Z80A/GWBASIC/VB and a
Bruno Desthuilliers [EMAIL PROTECTED]
writes:
While Java's variable declarations bear a superficial (syntactical)
similarity to C, their semantics is in fact equivalent to the
object-reference semantics we know in Python. They implicitly refer
to objects allocated on the heap and, just like
Hrvoje Niksic a écrit :
Bruno Desthuilliers [EMAIL PROTECTED]
writes:
It seems to me that in recent times more Python beginners come from
a Java background than from a C one.
Java does have container variables for primitive types, and even
for references, Java's variables are more than
Donn Ingle a écrit :
vzcbeg vafcrpg
qrs _svaq(senzr, bow):
sbe anzr, inyhr va senzr.s_ybpnyf.vgrevgrzf():
vs inyhr vf bow:
erghea anzr
sbe anzr, inyhr va senzr.s_tybonyf.vgrevgrzf():
vs inyhr vf bow:
erghea anzr
envfr XrlReebe(Bowrpg abg sbhaq
Hrvoje Niksic a écrit :
Bruno Desthuilliers [EMAIL PROTECTED]
writes:
While Java's variable declarations bear a superficial (syntactical)
similarity to C, their semantics is in fact equivalent to the
object-reference semantics we know in Python. They implicitly refer
to objects allocated
On Oct 28, 6:01 am, Donn Ingle [EMAIL PROTECTED] wrote:
Is there a way I can, for debugging, access the instance variable name from
within a class?
Shouldn't this be in a FAQ somewhere? It's the second time (at least!)
it comes up this week.
George
--
Hello,
Is there a way I can, for debugging, access the instance variable name from
within a class?
E.g:
Class X:
def debug(self):
print My instance var is %s % (some magic Python stuff)
So that:
x = X()
x.debug()
My Instance var is x
( Without passing the name in like: x=X(name=x) )
Thx.
Donn Ingle a écrit :
Hello,
Is there a way I can, for debugging, access the instance variable name from
within a class?
E.g:
Class X:
def debug(self):
print My instance var is %s % (some magic Python stuff)
So that:
x = X()
x.debug()
My Instance var is x
( Without passing the
On Oct 28, 6:01 am, Donn Ingle [EMAIL PROTECTED] wrote:
Hello,
Is there a way I can, for debugging, access the instance variable name from
within a class?
E.g:
Class X:
def debug(self):
print My instance var is %s % (some magic Python stuff)
So that:
x = X()
x.debug()
My Instance
Donn Ingle [EMAIL PROTECTED] writes:
Is there a way I can, for debugging, access the instance variable name from
within a class?
E.g:
Class X:
def debug(self):
print My instance var is %s % (some magic Python stuff)
As others have answered, an instance can live in many variables, so
2007/10/29, Hrvoje Niksic [EMAIL PROTECTED]:
Sbe unpx inyhr, urer vf n cbffvoyr vzcyrzragngvba:
...
was that on purpose?
martin
--
http://noneisyours.marcher.name
http://feeds.feedburner.com/NoneIsYours
--
http://mail.python.org/mailman/listinfo/python-list
Hrvoje Niksic a écrit :
Donn Ingle [EMAIL PROTECTED] writes:
Is there a way I can, for debugging, access the instance variable name from
within a class?
E.g:
Class X:
def debug(self):
print My instance var is %s % (some magic Python stuff)
As others have answered, an instance can
Bruno Desthuilliers [EMAIL PROTECTED]
writes:
As others have answered, an instance can live in many variables,
be bound to many names would be more accurate IMHO.
Technically more accurate maybe (but see below), but I was responding
to a beginner's post, so I was striving for ease of
Hrvoje Niksic a écrit :
Bruno Desthuilliers [EMAIL PROTECTED]
writes:
As others have answered, an instance can live in many variables,
be bound to many names would be more accurate IMHO.
Technically more accurate maybe (but see below), but I was responding
to a beginner's post, so I was
On Oct 29, 12:46 pm, Martin Marcher [EMAIL PROTECTED] wrote:
2007/10/29, Hrvoje Niksic [EMAIL PROTECTED]:
Sbe unpx inyhr, urer vf n cbffvoyr vzcyrzragngvba:
...
was that on purpose?
martin
--http://noneisyours.marcher.namehttp://feeds.feedburner.com/NoneIsYours
for humans:
For hack
Bruno Desthuilliers [EMAIL PROTECTED]
writes:
The problem is that your formulation implies (to me at least) that the
variable is actually a kind of container for the object.
I really didn't expect it to be read that way, especially since the
sentence claims that the same instance can reside in
Hrvoje Niksic a écrit :
Bruno Desthuilliers [EMAIL PROTECTED]
writes:
The problem is that your formulation implies (to me at least) that the
variable is actually a kind of container for the object.
I really didn't expect it to be read that way, especially since the
sentence claims that
bump :)
--
http://mail.python.org/mailman/listinfo/python-list
vzcbeg vafcrpg
qrs _svaq(senzr, bow):
sbe anzr, inyhr va senzr.s_ybpnyf.vgrevgrzf():
vs inyhr vf bow:
erghea anzr
sbe anzr, inyhr va senzr.s_tybonyf.vgrevgrzf():
vs inyhr vf bow:
erghea anzr
envfr XrlReebe(Bowrpg abg sbhaq va senzr
for humans:
Sweet. Thanks, I'll give it a go. It's only for debugging and will make life
easier.
\d
--
http://mail.python.org/mailman/listinfo/python-list
Bruno Desthuilliers [EMAIL PROTECTED]
writes:
It seems to me that in recent times more Python beginners come from
a Java background than from a C one.
Java does have container variables for primitive types, and even
for references, Java's variables are more than names - they do
hold type
While Java's variable declarations bear a superficial (syntactical)
similarity to C, their semantics is in fact equivalent to the
object-reference semantics we know in Python.
I come from Z80A/GWBASIC/VB and a little C, I would describe a Python
variable as a pointer - in that it contains the
Hello there,
i am pretty new to object-oriented programming and i have a question:
let's say i have a simple class such as:
class father:
age=...
name=
def abcd.
class son(father):
age=
name=
def efgh:
or any other heirarchic
[EMAIL PROTECTED] wrote:
Hello there,
i am pretty new to object-oriented programming and i have a question:
let's say i have a simple class such as:
class father:
age=...
name=
def abcd.
class son(father):
age=
name=
Hi,
I scouted the ng for someone w/ a similar problem and couldn't find
one, so I might be thinking about this probable non-issue in a wrong
way.
What I am trying to accomplish should be pretty self explanatory when
looking at the following:
class heh(object):
... def __init__(self):
...
[EMAIL PROTECTED] wrote:
Hi,
I scouted the ng for someone w/ a similar problem and couldn't find
one, so I might be thinking about this probable non-issue in a wrong
way.
What I am trying to accomplish should be pretty self explanatory when
looking at the following:
class heh(object):
What I am trying to accomplish should be pretty self explanatory when
looking at the following:
It seems to me that what you are after is a nested or inner class like
in JAVA. You can't do that in the same way as in JAVA, as nested classes
in python don't know about their surrounding
[EMAIL PROTECTED] writes:
Sorry folks, this is what I meant:
class heh(object):
... def __init__(self):
... self.foo='hello'
... def change(self):
... self.foo+=' world'
... def show(self):
... return self.foo
...
... class hih(object):
...
I'm trying to use difflib.py from a COM aware language - and, for ease of
use, I'm initially trying to get this going from VB6.
I've wrappered difflib.py correctly I think, and I can now call into it and
call a global method (called 'test' of course). Here's the consuming code:
Dim
pemo wrote:
I'm trying to use difflib.py from a COM aware language - and, for ease of
use, I'm initially trying to get this going from VB6.
I've wrappered difflib.py correctly I think, and I can now call into it and
call a global method (called 'test' of course). Here's the consuming code:
73 matches
Mail list logo