In article <4bd2e20...@dnews.tpgi.com.au>,
Lie Ryan wrote:
>On 04/24/10 06:07, Aahz wrote:
>> In article <4bc120bd$0$8850$c3e8...@news.astraweb.com>,
>> Steven D'Aprano wrote:
>>>
>>> I can only think of two circumstances where old-style classes are
>>> *wrong*: if you use multiple inheritance
On 04/24/10 06:07, Aahz wrote:
> In article <4bc120bd$0$8850$c3e8...@news.astraweb.com>,
> Steven D'Aprano wrote:
>>
>> I can only think of two circumstances where old-style classes are
>> *wrong*: if you use multiple inheritance with a diamond diagram ("...now
>> you have THREE problems" *wink
In article <4bc120bd$0$8850$c3e8...@news.astraweb.com>,
Steven D'Aprano wrote:
>
>I can only think of two circumstances where old-style classes are
>*wrong*: if you use multiple inheritance with a diamond diagram ("...now
>you have THREE problems" *wink*), if you intend using descriptors such a
Steven D'Aprano wrote:
> On Sat, 10 Apr 2010 16:35:29 +, Duncan Booth wrote:
>
>> Anyway, the moral is never, ever to use old-style classes in Python
>> 2.x. You will get weird and unexpected results.
>
> That's a bit strong. They're only weird and unexpected if you're not
> expecting them
On Sat, 10 Apr 2010 16:35:29 +, Duncan Booth wrote:
> Anyway, the moral is never, ever to use old-style classes in Python 2.x.
> You will get weird and unexpected results.
That's a bit strong. They're only weird and unexpected if you're not
expecting them and don't understand them.
Why are
vsoler wrote:
> On Apr 10, 4:46 pm, Duncan Booth wrote:
>> vsoler wrote:
>> > I get the following error message:
>>
>> > TypeError: m() takes no arguments (1 given)
>>
>> Which version of Python are you using? Python 2.6 gives:
>>
>> TypeError: unbound method m() must be called with Uno i
On Apr 10, 9:26 am, vsoler wrote:
> class Uno:
> a=1
> def m():
> print "mouse"
>
...
> I cannot write
> Uno.m()
By default (at least in Python 2.x), Python will pass any function
which is accessed through getattr on class or instance (usually called
a "method") an instan
On Apr 10, 5:28 pm, Laszlo Nagy wrote:
> > class Uno:
> > a=1
> > def m():
> > print "mouse"
>
> > Say that I have this "silly" class.
>
> > While I can then write
>
> > print Uno.a
>
> > I cannot write
> > Uno.m()
>
> > I get the following error message:
>
> > Typ
class Uno:
a=1
def m():
print "mouse"
Say that I have this "silly" class.
While I can then write
print Uno.a
I cannot write
Uno.m()
I get the following error message:
TypeError: m() takes no arguments (1 given)
As a workaround, use this pattern:
>>> cl
On Apr 10, 4:46 pm, Duncan Booth wrote:
> vsoler wrote:
> > I get the following error message:
>
> > TypeError: m() takes no arguments (1 given)
>
> > Since I have not created any instances of Uno, there is no self
> > object, and I do not understand what object is supplied to the
> > functi
On Apr 10, 4:46 pm, Duncan Booth wrote:
> vsoler wrote:
> > I get the following error message:
>
> > TypeError: m() takes no arguments (1 given)
>
> > Since I have not created any instances of Uno, there is no self
> > object, and I do not understand what object is supplied to the
> > functi
On 4/10/10, vsoler wrote:
> Still learning python, especially OOP.
>
> While testing classes, I sometimes think of them as "ordinary
> containers" of values and functions (methods). That is, values and
> functions can be grouped together inside "namespaces" calles classes.
>
> class Uno:
> a=1
vsoler wrote:
> I get the following error message:
>
> TypeError: m() takes no arguments (1 given)
>
> Since I have not created any instances of Uno, there is no self
> object, and I do not understand what object is supplied to the
> function call.
>
> Could anybody explain what argument
13 matches
Mail list logo