On Fri, Feb 11, 2011 at 5:36 PM, Coen <c...@coachcoen.com> wrote:
> Thanks Tom and Shawn. I read that some weeks ago, but it didn't make
> sense at the time. It works, just what I needed
> Tom, re. naming: After 30 years (on and off) of programming, I've
> ended up with my own coding standards :-)  I'll change it if/when I
> work with others
>
> Coen
>

And of course, you are entirely free to do so. My warning was more due
to things like this:

>>> class Foo(object):
...   Foo = 'hello'
...   @classmethod
...   def bar(klass):
...     print "hi"
...   quuz = Foo.bar # FAIL
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 6, in Foo
AttributeError: 'str' object has no attribute 'bar'

The python interpreter will fail to parse this class, because 'Foo'
inside the class definition will refer to the member 'Foo.Foo' rather
than the class 'Foo'.

My warning wasn't about following convention, only that having the
same convention for class names and member names, and having a member
with the exact same name as the class - well, if it isn't exactly
shooting yourself in the foot, it is loading and aiming the shotgun
there, whilst stroking the trigger.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to