Re: [Tutor] is it possible to create and amend classes during run-time?

2012-05-02 Thread Alan Gauld
Does anyone know if it is possible during run-time to: a) add attributes to classes, which will unknown at program start, but "emerge" later whilst the program is running? Yes, but its not very useful since the rest of your code won't know how to access those attributes. There are ways around t

Re: [Tutor] is it possible to create and amend classes during run-time?

2012-05-02 Thread Prasad, Ramit
> > > > Does anyone know if it is possible during run-time to: > > a) add attributes to classes, which will unknown at program start, but > > "emerge" later whilst the program is running? > > b) add subclasses to class (also during runtime) > > As far as I understand your questions, the answer to

Re: [Tutor] is it possible to create and amend classes during run-time?

2012-05-02 Thread Jerry Hill
On Wed, May 2, 2012 at 3:56 PM, Bjorn Madsen wrote: > Hi, > I have been studying http://docs.python.org/tutorial/classes.html for a > while, but still have two questions which I could not answer. Perhaps you > could help? > > Does anyone know if it is possible during run-time to: > a) add attribut

[Tutor] is it possible to create and amend classes during run-time?

2012-05-02 Thread Bjorn Madsen
Hi, I have been studying http://docs.python.org/tutorial/classes.html for a while, but still have two questions which I could not answer. Perhaps you could help? Does anyone know if it is possible during run-time to: a) add attributes to classes, which will unknown at program start, but "emerge" l

Re: [Tutor] why list is not thread-safe, but deque and queue are thread-safe?

2012-05-02 Thread Alan Gauld
On 02/05/12 17:13, Lion Chen wrote: i have read it, as the "Answer" said, seems like deque is not thread-safe either, because deque has the operator +=, and others like that. I'm no expert and have never used dequeue. But I notice the documentation says: """Deques are a generalization of stack

Re: [Tutor] events and popup menus

2012-05-02 Thread Alan Gauld
On 02/05/12 12:33, Chris Hare wrote: Using the event coordinates to figure out which widget was clicked sounds like a good idea. > So, since the user might have moved the window on the screen, Sorry I wasn't precise enough, I believe the mouse coordinates are the relative coordinates in your

Re: [Tutor] why list is not thread-safe, but deque and queue are thread-safe?

2012-05-02 Thread Lion Chen
i have read it, as the "Answer" said, seems like deque is not thread-safe either, because deque has the operator +=, and others like that. i got some material about atomoperation from google: An operation during which a processor can simult

Re: [Tutor] why list is not thread-safe, but deque and queue are thread-safe?

2012-05-02 Thread spawgi
http://stackoverflow.com/questions/6319207/are-lists-thread-safe On Wed, May 2, 2012 at 7:58 PM, Lion Chen wrote: > Hi, All, > i can not understand why list is not thread-safe, but deque and queue > are thread-safe? > > that's all. thanks. > > Lion Chen > __

[Tutor] why list is not thread-safe, but deque and queue are thread-safe?

2012-05-02 Thread Lion Chen
Hi, All, i can not understand why list is not thread-safe, but deque and queue are thread-safe? that's all. thanks. Lion Chen ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/

Re: [Tutor] events and popup menus

2012-05-02 Thread Chris Hare
Using the event coordinates to figure out which widget was clicked sounds like a good idea. So, since the user might have moved the window on the screen, how do I figure out the widget's coordinates in order to figure out which of the four widgets the mouse was over when the user clicked a butt

Re: [Tutor] Is there space a between "#!" and "/usr/bin/env python" ?

2012-05-02 Thread Mark Lawrence
On 02/05/2012 01:27, Steven D'Aprano wrote: Alan Gauld wrote: If its Windows the line makes no difference. On Windows, the presence or absence of a space will make no difference, because it's just a comment. This is changed by PEP397, which also refers to an implementation. -- Cheers. Mar

Re: [Tutor] Is there space a between "#!" and "/usr/bin/env python" ?

2012-05-02 Thread spawgi
I have observed that either ways, works fine. On Wed, May 2, 2012 at 2:15 PM, Santosh Kumar wrote: > Now its enough info. Thanks all for clearing my doubt. > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > h

Re: [Tutor] Is there space a between "#!" and "/usr/bin/env python" ?

2012-05-02 Thread Santosh Kumar
Now its enough info. Thanks all for clearing my doubt. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor