On Wed, Jul 1, 2009 at 4:44 PM, Angus Rodgers wrote:
> Hello, world!
>
> This is my first post to the Tutor list (although I've already
> posted to comp.lang.python a couple of times).
>
> I'm currently reading Chapter 4 of Wesley Chun's book, "Core
> Python Programming" (2nd ed.).
>
> I find thi
On Mon, May 25, 2009 at 6:46 PM, phpfood wrote:
> I ran this in IDLE:
> >>> t = 'hi'
> >>> print t
> SyntaxError: invalid syntax (, line 1)
>
> I've also tried this as sample.py :
> import string
> text = 'hello world'
> print text
>
>
> It gives me a syntax error on "print text" line
>
> What's
On Wed, May 13, 2009 at 10:00 AM, Alan Gauld wrote:
>
> I may be coming across a bit strong on this one but it is such a
> fundamentally important feature of OOP that I feel on a list like tutor
> it is important to make it clear that this is not only correct behaviour
> but is very common in prac
On Wed, May 13, 2009 at 9:44 AM, spir wrote:
>
>
> Then someone stated that, except for __init__, this should be considered
> wrong. You and Kent disagreed (and indeed I do too).
Yup, that was me. I was incorrect, and am now searching around for writings
on proper OOP design with a python slant
On Tue, May 12, 2009 at 2:27 PM, Kent Johnson wrote:
> On Tue, May 12, 2009 at 8:44 AM, Jeremiah Dodds
> wrote:
> > On Tue, May 12, 2009 at 12:27 PM, Kent Johnson wrote:
>
> >> I don't agree with this at all. It's not at all unusual for a derived
> >&g
On Tue, May 12, 2009 at 12:27 PM, Kent Johnson wrote:
> On Tue, May 12, 2009 at 6:32 AM, Jeremiah Dodds
> wrote:
>
> > If your superclass has a method with the same name (other than __init__
> > here), that contains some logic that a subclass that overrides the method
&g
On Tue, May 12, 2009 at 11:02 AM, The Green Tea Leaf <
thegreenteal...@gmail.com> wrote:
> > That should not happen! Basic contract is: same name = same meaning.
>
> Same meaning yes, but that doesn't mean that I can't/shouldn't reuse
> code that address a part of the problem.
>
>
>
If your superc
On Tue, May 12, 2009 at 9:55 AM, The Green Tea Leaf <
thegreenteal...@gmail.com> wrote:
> OK, bad example. But assume I have the same method in both classes and
> want to call the method in the parent.
>
>
Can you give a concrete example of _why_ you would want to do this? You can
use super, if yo
On Tue, May 12, 2009 at 9:05 AM, The Green Tea Leaf <
thegreenteal...@gmail.com> wrote:
> Hi,
> I've started to learn Python and I'm a bit confused over how to call a
> method in a parent class. Assume I have:
>
> class Parent(object):
>def somemethod( self, bla ):
>print 'Parent',bla