[Tutor] Query - Where to put in global variables, if needed, as a good programming practice

2012-06-15 Thread spawgi
Hello, The point of good-bad-ness of global variables aside, if I needed to use them, which is a better place to put them. 1. In the __init__ function of a class? So they are available at the time an object is initialized or 2. In the actual function of the class where the variables are needed? Pr

Re: [Tutor] Query - Where to put in global variables, if needed, as a good programming practice

2012-06-15 Thread Mark Lawrence
On 15/06/2012 12:44, spa...@gmail.com wrote: Hello, The point of good-bad-ness of global variables aside, if I needed to use them, which is a better place to put them. 1. In the __init__ function of a class? So they are available at the time an object is initialized or 2. In the actual function

Re: [Tutor] Query - Where to put in global variables, if needed, as a good programming practice

2012-06-15 Thread Walter Prins
Hi Spawgi, On 15 June 2012 12:44, wrote: > Hello, > > The point of good-bad-ness of global variables aside, if I needed to use > them, which is a better place to put them. > 1. In the __init__ function of a class? So they are available at the time an > object is initialized or Firstly note as a

Re: [Tutor] Query - Where to put in global variables, if needed, as a good programming practice

2012-06-15 Thread Steven D'Aprano
spa...@gmail.com wrote: Hello, The point of good-bad-ness of global variables aside, if I needed to use them, which is a better place to put them. 1. In the __init__ function of a class? So they are available at the time an object is initialized or 2. In the actual function of the class where th

[Tutor] How does slicing work?

2012-06-15 Thread Kanone Seele
Hello,I'm a beginner in python.I found some qustions in Chapter 9's Quiz of the book* Learning Python,4th ed*, >>> L = [1, 2, 3, 4] >>> L[-1000:100] [1, 2, 3, 4] >>> L[3:1] [] >>> L[3:1] = ['?'] >>> L [1, 2, 3, '?', 4] How does python get the result of slicing?Such as the examples above,t

Re: [Tutor] How does slicing work?

2012-06-15 Thread Emile van Sebille
On 6/15/2012 7:48 PM Kanone Seele said... Hello,I'm a beginner in python.I found some qustions in Chapter 9's Quiz of the book/Learning Python,4th ed/, >> L = [1, 2, 3, 4] >> L[-1000:100] [1, 2, 3, 4] >> L[3:1] [] >> L[3:1] = ['?'] >> L [1, 2, 3, '?', 4] How does python get th

[Tutor] getpass

2012-06-15 Thread Mike Nickey
Hey all, I'm working on a bit of code here and I'm having an issue with getpass. In the documentation, it says it hides the text entered "Prompt the user for a password without echoing." -- http://www.python.org/doc//current/library/getpass.html However when I run it in Eclipse, the password is

Re: [Tutor] getpass

2012-06-15 Thread Steven D'Aprano
Mike Nickey wrote: Hey all, I'm working on a bit of code here and I'm having an issue with getpass. In the documentation, it says it hides the text entered "Prompt the user for a password without echoing." -- http://www.python.org/doc//current/library/getpass.html However when I run it in Ecli