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
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 cl
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
On Tue, Nov 6, 2012 at 8:03 AM, 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 derivedClass(baseClassMod.baseClass)
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
> 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 c
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
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
reload(
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 baseClas
On Mon, Jan 16, 2012 at 8:10 AM, deathweaselx86 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 the
class itself,
On Mon, Jan 16, 2012 at 10:10 AM, deathweaselx86 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 Bar(...)
...
# immedi
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 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
Paul Rudin wrote:
Gregory Ewing 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 want to check for the
presence
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
Gregory Ewing 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
> still be there, but
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() listing
On Oct 22, 2:21 pm, Peter Pearson 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
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):
>
On Oct 22, 9:16 am, Dave Angel wrote:
> On 2:59 PM, Brendan wrote:> On Oct 21, 3:56 pm, Ethan
> Furman 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 usu
On 2:59 PM, Brendan wrote:
On Oct 21, 3:56 pm, Ethan Furman 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 th
On Oct 22, 5:02 am, Steven D'Aprano 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 usually done to prevent
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 th
On 10/21/10 2:12 PM, Brendan wrote:
On Oct 21, 3:56 pm, Ethan Furman 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)
['__builtins
On Oct 21, 11:53 am, Brendan wrote:
> On Oct 21, 3:47 pm, Carl Banks wrote:
> > On Oct 21, 11:09 am, 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
On Oct 21, 3:56 pm, Ethan Furman 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 Oct 21, 12:53 pm, Brendan 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 perspective.
--
http://mail.pytho
On 10/21/10 1:53 PM, Brendan wrote:
On Oct 21, 3:47 pm, Carl Banks wrote:
On Oct 21, 11:09 am, 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_
On Thu, Oct 21, 2010 at 11:53 AM, Brendan wrote:
> On Oct 21, 3:47 pm, Carl Banks wrote:
>> On Oct 21, 11:09 am, 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 l
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 understand
On Oct 21, 3:47 pm, Carl Banks wrote:
> On Oct 21, 11:09 am, 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__',
On Oct 21, 11:09 am, 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 n
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' sh
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.
--
http://mail.python.o
On Sun, 15 Nov 2009 16:26:59 -0800, Pyrot wrote:
> On 11월15일, 오후9시52분, "Diez B. Roggisch" 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 power). I
On Nov 15, 6:26 pm, Pyrot 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 it's 2) then i
On 11월15일, 오후9시52분, "Diez B. Roggisch" 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 __init__(s
On 11월15일, 오후10시15분, Tim Chase 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 scope of
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"):
s
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 resolutio
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.tem
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):
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
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
--
http://mail.python.org/mailman/listi
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 ob
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
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,
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
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 an
> 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 t
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
>
> 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
> 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
bump :)
--
http://mail.python.org/mailman/listinfo/python-list
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 cl
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
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 p
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 hu
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 u
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
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 variabl
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
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
>
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
[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=
>
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 s
[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
>>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 class/c
[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
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):
...
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:
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 PythonU
73 matches
Mail list logo