Re: [Tutor] global list

2014-04-24 Thread Steven D'Aprano
On Thu, Apr 24, 2014 at 01:14:33AM -0700, Albert-Jan Roskam wrote: > - Original Message - > > From: Steven D'Aprano > > To: tutor@python.org > > Cc: > > Sent: Thursday, April 24, 2014 3:00 AM > > Subject: Re: [Tutor] global list > > > > > > > You only need to define variables as glob

Re: [Tutor] attributes vs globals (was Re: global list)

2014-04-24 Thread Alan Gauld
On 24/04/14 21:48, Mark Lawrence wrote: On 24/04/2014 21:30, Albert-Jan Roskam wrote: As a side not, I find that variables (attributes) defined in __init__ are also much like globals, but that's probably a different discussion. Would you please be kind enough to explain your logic. I can't

[Tutor] attributes vs globals (was Re: global list)

2014-04-24 Thread Mark Lawrence
On 24/04/2014 21:30, Albert-Jan Roskam wrote: As a side not, I find that variables (attributes) defined in __init__ are also much like globals, but that's probably a different discussion. Would you please be kind enough to explain your logic. -- My fellow Pythonistas, ask not what our langu

Re: [Tutor] global list

2014-04-24 Thread Albert-Jan Roskam
> From: Peter Otten <__pete...@web.de> >To: tutor@python.org >Sent: Thursday, April 24, 2014 1:49 PM >Subject: Re: [Tutor] global list > > >Albert-Jan Roskam wrote: >> - Original Message - >>> From: Steven D'Aprano >>> To: tutor@python.org >>> Cc: >>>

Re: [Tutor] Where does logging put its files?

2014-04-24 Thread Alan Gauld
On 24/04/14 17:08, Peter Otten wrote: >>> logging.basicConfig(file='./log.txt', level=logging.DEBUG) >>> logging.info('some stuff') INFO:root:some stuff The printed logging messages might give a hint that you were not successful in your attempt to specify a log-file. Try "filename" instead

Re: [Tutor] Where does logging put its files?

2014-04-24 Thread Peter Otten
Alan Gauld wrote: > I've been playing with the logging module - long overdue! > > I started with the basic tutorial but fell at the first hurdle. > It says to specify a file in the logging.basicConfig() function then > asks you to open the file after logging some events. > > But I can't find the

[Tutor] Where does logging put its files?

2014-04-24 Thread Alan Gauld
I've been playing with the logging module - long overdue! I started with the basic tutorial but fell at the first hurdle. It says to specify a file in the logging.basicConfig() function then asks you to open the file after logging some events. But I can't find the file anywhere... Here's my c

Re: [Tutor] Groups of mutually exclusive options

2014-04-24 Thread Steven D'Aprano
On Tue, Apr 22, 2014 at 10:47:09AM -0700, Alex Kleider wrote: > On 2014-04-21 19:35, Steven D'Aprano wrote: > > >Does docopt solve the Original Poster's question? If not, that advice > >is not terribly helpful. > > I don't pretend to fully understand the Original Poster's requirement > but I be

Re: [Tutor] global list

2014-04-24 Thread Peter Otten
Albert-Jan Roskam wrote: > > > > > > - Original Message - >> From: Steven D'Aprano >> To: tutor@python.org >> Cc: >> Sent: Thursday, April 24, 2014 3:00 AM >> Subject: Re: [Tutor] global list >> > > > >> You only need to define variables as global if you assign to them: >> >> de

Re: [Tutor] some things work in IDLE but not a command prompt and vice versa

2014-04-24 Thread Alan Gauld
On 24/04/14 00:14, Martin wrote: If I run from a command prompt, however, I get C:\Users\Martin\Documents\College\python>python pickle.py You have called your file pickle.py. So when you try to import pickle the interpreter sees your file first and imports that not the library pickle. Neve

[Tutor] some things work in IDLE but not a command prompt and vice versa

2014-04-24 Thread Martin
Experimenting with pickling... import pickle file1 = open('first.txt','r') contents = file1.read() file1.close() print(contents) file2 = open('pickle.dat','wb') pickle.dump(contents,file2,True) file2.close() contents = '' file3 = open('pickle.dat','rb') contents = pickle.load(file3) print(co

Re: [Tutor] global list

2014-04-24 Thread Gerardo Juárez
On 04/23/2014 06:46 PM, Denis Heidtmann wrote: In a coursera python course video the following code was presented: a = [4,5,6] def mutate_part(x): a[1] = x mutate_part(200) The presenter said something like "a is a global variable, so a becomes [4,200,6] after running mutate_part(200)."

Re: [Tutor] global list

2014-04-24 Thread Mark Lawrence
On 24/04/2014 09:23, Danny Yoo wrote: Should have no runtime performance difference. For similar reasons, using a very long variable name does not change a program's runtime performance. Please quote some context, this is meaningless without it, thanks. -- My fellow Pythonistas, ask not wha

Re: [Tutor] global list

2014-04-24 Thread Danny Yoo
Should have no runtime performance difference. For similar reasons, using a very long variable name does not change a program's runtime performance. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.pyth

Re: [Tutor] global list

2014-04-24 Thread Albert-Jan Roskam
- Original Message - > From: Steven D'Aprano > To: tutor@python.org > Cc: > Sent: Thursday, April 24, 2014 3:00 AM > Subject: Re: [Tutor] global list > > You only need to define variables as global if you assign to them: > > def function(x): >     global a >     a = [1, 2, 3, x]

[Tutor] Fwd: Re: Fwd: Puzzle - Next Step to our interviewing process - Pramati Technologies!

2014-04-24 Thread Danny Yoo
-- Forwarded message -- From: "Danny Yoo" Date: Apr 24, 2014 1:14 AM Subject: Re: [Tutor] Fwd: Puzzle - Next Step to our interviewing process - Pramati Technologies! To: "Sunil Tech" Cc: On Apr 24, 2014 12:50 AM, "Sunil Tech" wrote: > > Hi danny, > > i want to delete this email