Re: main and dependent objects

2012-09-13 Thread alex23
On Sep 13, 10:52 pm, andrea crotti wrote: > I am in a situation where I have a class Obj which contains many > attributes, and also contains logically another object of class > Dependent. > But I'm not so sure it's a good idea, it's a bit smelly.. It's actually a well regarded technique known as

Re: main and dependent objects

2012-09-13 Thread Jean-Michel Pichavant
- Original Message - > 2012/9/13 Jean-Michel Pichavant : > > > > Nothing shocking right here imo. It looks like a classic > > parent-child implementation. > > However it seems the relation between Obj and Dependent are 1-to-1. > > Since Dependent need to access all Obj attributes, are you s

Re: main and dependent objects

2012-09-13 Thread Ulrich Eckhardt
Am 13.09.2012 14:51, schrieb andrea crotti: I am in a situation where I have a class Obj which contains many attributes, and also contains logically another object of class Dependent. This dependent_object, however, also needs to access many fields of the original class, so at the moment we did

Re: main and dependent objects

2012-09-13 Thread andrea crotti
2012/9/13 Jean-Michel Pichavant : > > Nothing shocking right here imo. It looks like a classic parent-child > implementation. > However it seems the relation between Obj and Dependent are 1-to-1. Since > Dependent need to access all Obj attributes, are you sure that Dependent and > Obj are not a

Re: main and dependent objects

2012-09-13 Thread Jean-Michel Pichavant
- Original Message - > I am in a situation where I have a class Obj which contains many > attributes, and also contains logically another object of class > Dependent. > > This dependent_object, however, also needs to access many fields of > the > original class, so at the moment we did som

Re: main in Python

2009-07-10 Thread Benjamin Kaplan
On Fri, Jul 10, 2009 at 5:52 PM, Tim wrote: > > Hi, > I learned that a Python script is written in this way: > def main(): >    ... > if __name__ == "__main__": >    main() > > Today, when I read a script, I found it has a different way: > > def main(): >    ... > > main() > > It can run as well. C

Re: main in Python

2009-07-10 Thread Tim Harig
On 2009-07-10, Tim wrote: [RE-ORDERED] > It can run as well. Can someone explain why and the rules that Python > scripts get run? Everything gets run by default. The def syntax defines functions but does not run them -- they are only run when they are called > Today, when I read a script, I fou

Re: main

2007-02-03 Thread Paddy
On Feb 3, 10:53 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Sat, 03 Feb 2007 05:51:56 -0300, "Gabriel Genellina" > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > > menction that at all. And no one should expect that a beginner would have > > to read section 26.3 on t

Re: main

2007-02-03 Thread Paddy
On Feb 3, 8:51 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sat, 03 Feb 2007 02:37:11 -0300, Paddy <[EMAIL PROTECTED]> > escribió: > > >> and what is > >> __name__ > >> __main__ > > >> use for in terms of Java? > > > With respect, (hehe), maybe you need to indicate that you've searched >

Re: main

2007-02-03 Thread Gabriel Genellina
En Sat, 03 Feb 2007 02:37:11 -0300, Paddy <[EMAIL PROTECTED]> escribió: >> and what is >> __name__ >> __main__ >> >> use for in terms of Java? >> > > With respect, (hehe), maybe you need to indicate that you've searched > the Python documentation on __name__ and __main__? > (Hah! I did that with

Re: main

2007-02-03 Thread Ben Finney
[EMAIL PROTECTED] writes: > is the main function in python is exact compare to Java main method? > all execution start in main which may takes arguments? There's no such thing in Python; a module is executed sequentially, with no particular regard to the names of any of the attributes. There is,

Re: main

2007-02-02 Thread Paddy
On Feb 3, 4:45 am, [EMAIL PROTECTED] wrote: > is the main function in python is exact compare to Java main method? > > all execution start in main which may takes arguments? > Hi Fatwallet, May I have some of your money? Oh, sorry, the main function... The main function is *not* like that of J

Re: main window in tkinter app

2005-07-20 Thread Christopher Subich
William Gill wrote: > That does it!, thanks. > > Thinking about it, when I created a derived class with an __init__ > method, I overrode the base class's init. It should have been > intuitive that I needed to explicitly call baseclass.__init(self), it > wasn't. It might have hit me if the f

Re: main window in tkinter app

2005-07-20 Thread William Gill
That does it!, thanks. Thinking about it, when I created a derived class with an __init__ method, I overrode the base class's init. It should have been intuitive that I needed to explicitly call baseclass.__init(self), it wasn't. It might have hit me if the fault was related to someting in

Re: main window in tkinter app

2005-07-20 Thread Christopher Subich
William Gill wrote: > O.K. I tried from scratch, and the following snippet produces an > infinite loop saying: > > File "C:\Python24\lib\lib-tk\Tkinter.py", line 1647, in __getattr__ > return getattr(self.tk, attr) > > If I comment out the __init__ method, I get the titled window, and pr

Re: main window in tkinter app

2005-07-19 Thread William Gill
It also seems to operate the same with or without " app.mainloop()". Is an explicit call to mainloop needed? William Gill wrote: > O.K. I tried from scratch, and the following snippet produces an > infinite loop saying: > > File "C:\Python24\lib\lib-tk\Tkinter.py", line 1647, in __getattr__

Re: main window in tkinter app

2005-07-19 Thread William Gill
O.K. I tried from scratch, and the following snippet produces an infinite loop saying: File "C:\Python24\lib\lib-tk\Tkinter.py", line 1647, in __getattr__ return getattr(self.tk, attr) If I comment out the __init__ method, I get the titled window, and print out self.var ('1') import

Re: main window in tkinter app

2005-07-19 Thread William Gill
> I never ran into this problem. ... O.K. That, means I probably have something else wrong. I will need to start with a 'clean slate' instead of trying to modify existing code. It's getting to convoluted to follow anyway after all the cobbling I've done. If I get a repeat of the original pro

Re: main window in tkinter app

2005-07-18 Thread Eric Brunel
On Mon, 18 Jul 2005 16:57:51 GMT, William Gill <[EMAIL PROTECTED]> wrote: > A short while ago someone posted that(unlike the examples) you should > use Tk as the base for your main window in tkinter apps, not Frame. Thus : > >class MyMain(Frame): >def __init__(self, master): >