Re: [Tutor] How to perform variable assignment and

2009-10-03 Thread Oxymoron
Hello, On Sat, Oct 3, 2009 at 3:56 PM, Didar Hossain didar.hoss...@gmail.comwrote: homedir = os.environ.get('HOME') if homedir: print My home directory is %s % homedir I do this in Perl - my $home; if ($home = $ENV{'HOME'}) { print My home directory is $home\n; } Can I do a

Re: [Tutor] How to perform variable assignment and

2009-10-03 Thread wesley chun
On Fri, Oct 2, 2009 at 11:14 PM, Oxymoron moron@gmail.com wrote: Hello, On Sat, Oct 3, 2009 at 3:56 PM, Didar Hossain didar.hoss...@gmail.com wrote: homedir = os.environ.get('HOME') if homedir:    print My home directory is %s % homedir I do this in Perl - my $home; if ($home =

Re: [Tutor] How to perform variable assignment and

2009-10-03 Thread Rich Lovely
2009/10/3 wesley chun wes...@gmail.com: On Fri, Oct 2, 2009 at 11:14 PM, Oxymoron moron@gmail.com wrote: Hello, On Sat, Oct 3, 2009 at 3:56 PM, Didar Hossain didar.hoss...@gmail.com wrote: homedir = os.environ.get('HOME') if homedir:    print My home directory is %s % homedir I do

Re: [Tutor] small program

2009-10-03 Thread Andrius
Ok ok, smarty! Don't be very cool! Nobody asks you a favor, nobody asks your advices as well. There are plenty 'advisers' to say where to see, but not too much able to explain. Keep quiet. Regards, Andrius On 02/10/2009, bob gailer bgai...@gmail.com wrote: Andrius wrote: Hi! There are

Re: [Tutor] How to perform variable assignment and

2009-10-03 Thread Didar Hossain
On Sat, Oct 3, 2009 at 1:34 PM, Rich Lovely roadier...@googlemail.com wrote: 2009/10/3 wesley chun wes...@gmail.com: On Fri, Oct 2, 2009 at 11:14 PM, Oxymoron moron@gmail.com wrote: Hello, On Sat, Oct 3, 2009 at 3:56 PM, Didar Hossain didar.hoss...@gmail.com wrote: homedir =

Re: [Tutor] How to perform variable assignment and

2009-10-03 Thread Oxymoron
(Did not reply to list earlier, apologies) On Sat, Oct 3, 2009 at 7:47 PM, Didar Hossain didar.hoss...@gmail.comwrote: There are probably various syntactic tricks to achieve the same, however, the main reason you can't do it is that assignment in Python is a statement rather than an

[Tutor] Fwd: UnboundLocalError and Break

2009-10-03 Thread Luke Paireepinart
Corey, please reply on list (use reply-all). I know it's annoying to have to remember that. -- Forwarded message -- From: Corey Richardson kb1...@aim.com Date: Thu, Oct 1, 2009 at 4:15 AM Subject: Re: [Tutor] UnboundLocalError and Break To: Luke Paireepinart

Re: [Tutor] How to perform variable assignment and

2009-10-03 Thread Mark Tolonen
wesley chun wes...@gmail.com wrote in message [snip] ... however, there is a tiny bug: if the $HOME environment variable is *not* set, you will get a KeyError exception. one solution is to add a default value to your get() method call so that it returns an object with a Boolean False value:

Re: [Tutor] How to perform variable assignment and

2009-10-03 Thread Steve Willoughby
Oxymoron wrote: While having an assignment as an expression could be convenient in places (I have had my moments where I wish it was!), that particular usage is also a source of common bugs. Often in conditional statements Me, too. I grumble every time I have to take two separate statements

Re: [Tutor] small program

2009-10-03 Thread wesley chun
I would like to create a program which should repeat a simply string several times with list number before. Like 1. Wanna more. 2. Wanna more. ... Suppose to a loop here repeating, say x times. Should it look like that: y=Wanna more. x=1 x=x+d: d=100 print d+y How to create a program

Re: [Tutor] small program

2009-10-03 Thread Luke Paireepinart
Bob's a very highly respected member of this group, and I suggest you try not to insult the people you're asking for help.He's spot-on with the intention of this mailing list. We aren't here to do work for you. I, for one, am making it a point not to answer any of your queries in the future. So