Re: class implementation

2013-10-10 Thread Ben Finney
Piet van Oostrum writes: > from import * is considered bad practice anyway. It is better just to import > the things you need. > > from pykkar import World, Pykkar, _WorldProper Or, even better, be explicit: import pykkar … foo = pykkar.World() -- \ “Computer perspect

Re: class implementation

2013-10-10 Thread Piet van Oostrum
markot...@gmail.com writes: > > OK so I did a took time of and read the pykkar code through. abd I found that > there is a third class i have to implement. [...] > So I have come up with this code > from pykkar import * > > create_world(""" > > # # > # v# > # # > #

Re: class implementation

2013-10-10 Thread Cameron Simpson
On 10Oct2013 11:34, markot...@gmail.com wrote: > OK so I did a took time of and read the pykkar code through. abd > I found that there is a third class i have to implement. > This Is the pykkar sourcecode [... lots and lots of docstring and code ...] [... and finally a little more messgae ...] > I

Re: class implementation

2013-10-10 Thread markotaht
kolmapäev, 9. oktoober 2013 2:55.28 UTC+3 kirjutas Cameron Simpson: > On 08Oct2013 01:20, wrote: > > > I cant just subclassing doesent work. It seem the init method of the source > > class also calls out another class. And the problem is, i can subclass the > > other class to with the required

Re: class implementation

2013-10-08 Thread Cameron Simpson
On 08Oct2013 01:20, markot...@gmail.com wrote: > I cant just subclassing doesent work. It seem the init method of the source > class also calls out another class. And the problem is, i can subclass the > other class to with the required function but the end result is that it > doesent work, sin

Re: class implementation

2013-10-08 Thread Rhodri James
On Tue, 08 Oct 2013 15:05:26 +0100, wrote: Parent class is at the link. Please quote some context when you reply. What link? Then again, I'm not about to click on some random link someone posts to a newsgroup. Apart from being one of the classic ways to get a virus onto my computer, it

Re: class implementation

2013-10-08 Thread markotaht
Parent class is at the link. -- https://mail.python.org/mailman/listinfo/python-list

Re: class implementation

2013-10-08 Thread Dave Angel
On 8/10/2013 04:20, markot...@gmail.com wrote: > I cant just subclassing doesent work. I can't parse that "sentence." > It seem the init method of the source class also calls out another class. And the problem is, i can subclass the other class to with the required function but the end result i

Re: class implementation

2013-10-08 Thread Mark Lawrence
On 08/10/2013 09:20, markot...@gmail.com wrote: To whom and to what are you replying? -- Roses are red, Violets are blue, Most poems rhyme, But this one doesn't. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list

Re: class implementation

2013-10-08 Thread markotaht
I cant just subclassing doesent work. It seem the init method of the source class also calls out another class. And the problem is, i can subclass the other class to with the required function but the end result is that it doesent work, since the source class cant accsess the subclass functions.

Re: class implementation

2013-10-06 Thread Steven D'Aprano
On Sun, 06 Oct 2013 06:15:51 -0700, markotaht wrote: > There is this class file, it has its functions and variables. What's a class file? Do you mean a file containing only a single class? > Now im > greating my program, that uses the funcions from the class. They are called "methods". >

Re: class implementation

2013-10-06 Thread Terry Reedy
On 10/6/2013 9:15 AM, markot...@gmail.com wrote: There is this class file, it has its functions and variables. Now im greating my program, that uses the funcions from the class. BUt there are some functions missing from the class. So i want to add some extra funtions to the class, whidout alte

Re: class implementation

2013-10-06 Thread markotaht
There is this class file, it has its functions and variables. Now im greating my program, that uses the funcions from the class. BUt there are some functions missing from the class. So i want to add some extra funtions to the class, whidout altering the original source code, but by extending it

Re: class implementation

2013-10-01 Thread 88888 Dihedral
On Tuesday, October 1, 2013 3:34:08 AM UTC+8, Dave Angel wrote: > On 30/9/2013 08:41, markot...@gmail.com wrote: > > > > > under variables, i mean, the int's and lists and strings and floats that > > the parent class uses. IF in parent class there is variable called > > location, then can i us

Re: class implementation

2013-09-30 Thread Ethan Furman
On 09/30/2013 04:45 PM, Steven D'Aprano wrote: I can't speak for others, but in my own experience, I never *quite* understood the semantic differences between Python name bindings and Pascal variables until I came across the meme "Python has no variables". +1 -- https://mail.python.org/mailman

Re: Python variables? [was Re: class implementation]

2013-09-30 Thread Rhodri James
On Tue, 01 Oct 2013 00:45:06 +0100, Ned Batchelder wrote: On 9/30/13 6:02 PM, Ethan Furman wrote: From your blog: Names are Python's variables: they refer to values, and those values can change (vary) over the course of your program. This is partially incorrect. If the value referred

Re: class implementation

2013-09-30 Thread Steven D'Aprano
On Mon, 30 Sep 2013 05:41:16 -0700, markotaht wrote: > under variables, i mean, the int's and lists and strings and floats that > the parent class uses. IF in parent class there is variable called > location, then can i use the same variable in my sub class. Firstly, in Python circles we prefer t

Re: class implementation

2013-09-30 Thread Steven D'Aprano
On Mon, 30 Sep 2013 17:28:30 -0400, Ned Batchelder wrote: > On 9/30/13 3:34 PM, Dave Angel wrote: >> Python doesn't actually have variables, but the things it documents as >> variables are local names within a method. Those are not visible >> outside of the method, regardless of whether you're in

Re: Python variables? [was Re: class implementation]

2013-09-30 Thread Ned Batchelder
On 9/30/13 6:02 PM, Ethan Furman wrote: On 09/30/2013 02:28 PM, Ned Batchelder wrote: On 9/30/13 3:34 PM, Dave Angel wrote: Python doesn't actually have variables, but the things it documents as variables are local names within a method. Those are not visible outside of the method, regardless

Python variables? [was Re: class implementation]

2013-09-30 Thread Ethan Furman
On 09/30/2013 02:28 PM, Ned Batchelder wrote: On 9/30/13 3:34 PM, Dave Angel wrote: Python doesn't actually have variables, but the things it documents as variables are local names within a method. Those are not visible outside of the method, regardless of whether you're in a class or a subclas

Re: class implementation

2013-09-30 Thread random832
On Mon, Sep 30, 2013, at 17:28, Ned Batchelder wrote: > On 9/30/13 3:34 PM, Dave Angel wrote: > > Python doesn't actually have variables, but the things it documents as > > variables are local names within a method. Those are not visible > > outside of the method, regardless of whether you're in a

Re: class implementation

2013-09-30 Thread Ned Batchelder
On 9/30/13 3:34 PM, Dave Angel wrote: Python doesn't actually have variables, but the things it documents as variables are local names within a method. Those are not visible outside of the method, regardless of whether you're in a class or a subclass. Why does this meme persist!? Of course Py

Re: class implementation

2013-09-30 Thread Dave Angel
On 30/9/2013 08:41, markot...@gmail.com wrote: > under variables, i mean, the int's and lists and strings and floats that the > parent class uses. IF in parent class there is variable called location, then > can i use the same variable in my sub class. Python doesn't actually have variables, bu

Re: class implementation

2013-09-30 Thread Piet van Oostrum
markot...@gmail.com writes: > under variables, i mean, the int's and lists and strings and floats that the > parent class uses. IF in parent class there is variable called location, then > can i use the same variable in my sub class. Do you mean class variables or instance variables? -- Piet

Re: class implementation

2013-09-30 Thread Joel Goldstick
On Mon, Sep 30, 2013 at 9:02 AM, Peter Otten <__pete...@web.de> wrote: > markot...@gmail.com wrote: > > > under variables, i mean, the int's and lists and strings and floats that > > the parent class uses. IF in parent class there is variable called > > location, then can i use the same variable i

Re: class implementation

2013-09-30 Thread Peter Otten
markot...@gmail.com wrote: > under variables, i mean, the int's and lists and strings and floats that > the parent class uses. IF in parent class there is variable called > location, then can i use the same variable in my sub class. Please show us some code. Thankyou. -- https://mail.python.or

Re: class implementation

2013-09-30 Thread markotaht
under variables, i mean, the int's and lists and strings and floats that the parent class uses. IF in parent class there is variable called location, then can i use the same variable in my sub class. -- https://mail.python.org/mailman/listinfo/python-list

Re: class implementation

2013-09-30 Thread Peter Otten
markot...@gmail.com wrote: > esmaspäev, 30. september 2013 11:43.19 UTC+3 kirjutas mark...@gmail.com: >> Is there a way to give a class extra functions whidout editing the .py >> file where the class is located? > > But does it have all the variables that the main class have? Yes. You can invoke

Re: class implementation

2013-09-30 Thread markotaht
esmaspäev, 30. september 2013 11:43.19 UTC+3 kirjutas mark...@gmail.com: > Is there a way to give a class extra functions whidout editing the .py file > where the class is located? But does it have all the variables that the main class have? -- https://mail.python.org/mailman/listinfo/python-lis

Re: class implementation

2013-09-30 Thread Peter Otten
markot...@gmail.com wrote: > Is there a way to give a class extra functions whidout editing the .py > file where the class is located? A clean way is subclassing: import vehicles class FlyingCar(vehicles.Car): def lift_off(self): pass flying_car = FlyingCar() flying_car.lift_off()

class implementation

2013-09-30 Thread markotaht
Is there a way to give a class extra functions whidout editing the .py file where the class is located? -- https://mail.python.org/mailman/listinfo/python-list

Re: Basic class implementation question

2008-04-01 Thread Henry Chang
You might want to consult this. http://www.ibiblio.org/g2swap/byteofpython/read/object-methods.html On Tue, Apr 1, 2008 at 9:43 PM, <[EMAIL PROTECTED]> wrote: > I can't get call a class for some reason. This must be one of those > newbie questions I hear so much about: > > class wontwork: >

Re: Basic class implementation question

2008-04-01 Thread Henry Chang
Try this. class wontwork: def really(self): print "Hello World" wontwork().really() On Tue, Apr 1, 2008 at 9:43 PM, <[EMAIL PROTECTED]> wrote: > I can't get call a class for some reason. This must be one of those > newbie questions I hear so much about: > > class wontwo

Basic class implementation question

2008-04-01 Thread hexusnexus
I can't get call a class for some reason. This must be one of those newbie questions I hear so much about: class wontwork: def really(): print "Hello World" wontwork.really() This returns (as an error): Traceback (most recent call last): File "", line 1, in wontw

Re: Reuse base-class implementation of classmethod?

2005-11-01 Thread Giovanni Bajo
David Wahler wrote: >> what's the magic needed to reuse the base-class implementation of a >> classmethod? >> >> class A(object): >>@classmethod >>def foo(cls, a,b): >># do something >>pass >> >> class B(A):

Re: Reuse base-class implementation of classmethod?

2005-10-31 Thread Bengt Richter
On Tue, 01 Nov 2005 00:24:37 GMT, "Giovanni Bajo" <[EMAIL PROTECTED]> wrote: >Hello, > >what's the magic needed to reuse the base-class implementation of a >classmethod? > >class A(object): > @classmethod > def foo(cls, a,b): >

Re: Reuse base-class implementation of classmethod?

2005-10-31 Thread David Wahler
Giovanni Bajo wrote: > Hello, > > what's the magic needed to reuse the base-class implementation of a > classmethod? > > class A(object): >@classmethod >def foo(cls, a,b): ># do something >pass > > class B(A): > @classmetho

Reuse base-class implementation of classmethod?

2005-10-31 Thread Giovanni Bajo
Hello, what's the magic needed to reuse the base-class implementation of a classmethod? class A(object): @classmethod def foo(cls, a,b): # do something pass class B(A): @classmethod def foo(cls, a, b): A.foo(cls, a, b) # WRONG! I need to call the