Tuesday, March 29, 2011

Re: Two way many-to-many relationships

On Monday, March 28, 2011 02:32:52 pm Dilan wrote:
> Thanks Mike !

you're welcome
> That was a really helpful page that I missed in Doc. In this
> particular case 1 solves 2.
>
Nice

> > In python you can't forward declare outside of the module the object is
> > in.

I also want to clarify that python can't forward declare outside of the object
that is in scope. It can't forward declare in a module... sorry, my bad.

example:

class MyStuff:
def __init__(self):
self. doStartup()

def doStartup(self):
pass

That's completely legal and python will see doStartup just fine, but this
isn't:

doStartup()

def doStartup():
pass

test output:
[deployuser@priss ~]$ cat test.py
doStartUp()

def doStartUp(): pass
[deployuser@priss ~]$ python test.py
Traceback (most recent call last):
File "test.py", line 1, in <module>
doStartUp()
NameError: name 'doStartUp' is not defined
[deployuser@priss ~]$ vi test.py
[deployuser@priss ~]$ cat test.py

def doStartUp(): pass

doStartUp()

[deployuser@priss ~]$ python test.py
[deployuser@priss ~]$


Mike

--
"Neighbors!! We got neighbors! We ain't supposed to have any neighbors, and
I just had to shoot one."
-- Post Bros. Comics

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment