joseph pareti wrote:
> one more question. In the code below, there are 2 init() methods, one for
> the class 'Fahrzeug' and
> one for the class 'PKW'.
> The program works when I instantiate the class as:
>
> fiat = PKW("Fiat Marea",50,0)
>
> but it fails if I say:
>
> fiat = PKW("Fia
On 2020-03-13 09:46:29 +0100, joseph pareti wrote:
> The program works when I instantiate the class as:
>
> fiat = PKW("Fiat Marea",50,0)
>
> but it fails if I say:
>
> *fiat = PKW("Fiat Marea",50,0,1)*
The __init__ method of PKW has this signature:
> def __init__(self, bez, ge, ins):
You
one more question. In the code below, there are 2 init() methods, one for
the class 'Fahrzeug' and one for the class 'PKW'.
The program works when I instantiate the class as:
fiat = PKW("Fiat Marea",50,0)
but it fails if I say:
*fiat = PKW("Fiat Marea",50,0,1)*
*Traceback (most recent call l
joseph pareti writes:
> thank you, that fixes it. I also noticed that both statements work:
>
> super(PKW, self).__init__(bez,ge)
>
> or
>
>super().__init__(bez,ge)
The first is the required Python 2 calling (at least the first argument is
required). The second way can be used
> On 12 Mar 2020, at 14:28, joseph pareti wrote:
>
> thank you, that fixes it. I also noticed that both statements work:
>
> super(PKW, self).__init__(bez,ge)
This form is for python 2 compatibility.
>
> or
>
> super().__init__(bez,ge)
This is the python 3 way. If you do not
thank you, that fixes it. I also noticed that both statements work:
super(PKW, self).__init__(bez,ge)
or
super().__init__(bez,ge)
Am Do., 12. März 2020 um 12:58 Uhr schrieb MRAB :
> On 2020-03-12 10:54, joseph pareti wrote:
> > The following code that uses a class 'Fahrzeug' an
On 2020-03-12 10:54, joseph pareti wrote:
The following code that uses a class 'Fahrzeug' and an inherited class
'PKW' runs correctly. However, if I use the 'super ' statement in in the
PKW class, it ends with the following error message:
*Traceback (most recent call last): File "erben_a.py",
The following code that uses a class 'Fahrzeug' and an inherited class
'PKW' runs correctly. However, if I use the 'super ' statement in in the
PKW class, it ends with the following error message:
*Traceback (most recent call last): File "erben_a.py", line 19, in
fiat = PKW("Fiat Marea",
Oh wow. You went beyond :-)
Let me rewrite the example. I only want to calculate the wait time
which is basically the depart time minus the arrival time for multiple
days.
This is all on 1 station.
June 26, 2010:
Trian A, Arrived at 6:00AM, Depart at 9:00AM
Trian B, Arrived at 2:00AM, Depart at
uch as automatic code indenting :-), and making my programs
>>> more modular by having functions.
>>>
>>> I know that Python is very OOP friendly, but I could not figure out
>>> why and when to use Classes in it. I mostly use it for simple text
>>> parsing
ostly use it for simple text
>> parsing I suppose when a program gets "complicated" I should start
>> using Classes. Are there any tips or tricks people use to "force" them
>> into the OOP mentality? I would like to force myself to learn the
>> Python wa
ons.
>
> I know that Python is very OOP friendly, but I could not figure out
> why and when to use Classes in it. I mostly use it for simple text
> parsing I suppose when a program gets "complicated" I should start
> using Classes. Are there any tips or tricks people us
programs
more modular by having functions.
I know that Python is very OOP friendly, but I could not figure out
why and when to use Classes in it. I mostly use it for simple text
parsing I suppose when a program gets "complicated" I should start
using Classes. Are there any tips or tri
On 2010-06-24, Bruno Desthuilliers
wrote:
> Not going into OO when you don't need it IS actually the
> "Python way" !-)
My most satisfying classes are the ones that gradually coalesce
from a functional program. They take actual shape during
refactoring.
I find classes to be the most successful w
ate_dp.pdf
I mostly use it for simple text
parsing I suppose when a program gets "complicated" I should start
using Classes.
Not necessarily. OO is one way to organize code and data, but there are
other ways that work as well, depending on the problem at hand and how
your brain is co
functions.
I know that Python is very OOP friendly, but I could not figure out
why and when to use Classes in it. I mostly use it for simple text
parsing I suppose when a program gets "complicated" I should start
using Classes. Are there any tips or tricks people use to "force&quo
Armağan Çelik wrote:
>>/ Have a nice day. Have a nice day.
> />/ Have a nice day.
> />/ Have a nice day.
> />/
> />/ the output is
> />/
> />/ a 4
> />/ day 4
> /
>>/ have 4
> />/ nice 4
> can you send c++ code of this output .This my homework/
>
If it's your homework, shouldn't *you* be doing
* Have a nice day. Have a nice day.
*>* Have a nice day.
*>* Have a nice day.
*>*
*>* the output is
*>*
*>* a 4
*>* day 4
*>* have 4
*>* nice 4
can you send c++ code of this output .This my homework*
--
http://mail.python.org/mailman/listinfo/python-list
trevor lock wrote:
> Hello,
>
> I've just started using python and have observed the following :
>
> class foo:
> a=[]
> def __init__(self, val):
> self.a.append ( val )
> def getA(self):
> print self.a
> return self.a
>
> z = foo(5)
> y = foo(4)
>
At Wednesday 25/10/2006 16:19, trevor lock wrote:
I've just started using python and have observed the following :
class foo:
a=[]
def __init__(self, val):
self.a.append ( val )
It's a common pitfall. As seen just a few days ago:
http://groups.google.com/group/comp.lang.py
trevor lock wrote:
> Hello,
>
> I've just started using python and have observed the following :
>
> class foo:
> a=[]
> def __init__(self, val):
> self.a.append ( val )
> def getA(self):
> print self.a
> return self.a
>
> z = foo(5)
> y = foo(4)
> z.
Hello,I've just started using python and have observed the following :class foo: a=[] def __init__(self, val): self.a.append ( val ) def getA(self): print self.a return self.az = foo(5)y = foo(4)z.getA()>> [5, 4]I was expecting that everytime I created an i
22 matches
Mail list logo