[BangPypers] Why the None ?

2009-09-03 Thread Abhishek Mishra
Hi, I'm trying to pass 5 as default value for this function... def gimmetaste(length=5): print length if __name__ == '__main__': print gimmetaste() Output - 5 None I wonder

Re: [BangPypers] Why the None ?

2009-09-03 Thread Venkatraman S
On Thu, Sep 3, 2009 at 7:27 PM, Abhishek Mishra ideam...@gmail.com wrote: def gimmetaste(length=5): print length if __name__ == '__main__': print gimmetaste() Output - 5

Re: [BangPypers] Why the None ?

2009-09-03 Thread Carl Karsten
Try this, it should all become clear: def gimmetaste(length=5): print A, length return length * 2 if __name__ == '__main__': print B, gimmetaste() On Thu, Sep 3, 2009 at 8:57

Re: [BangPypers] Why the None ?

2009-09-03 Thread Anand Balachandran Pillai
On Thu, Sep 3, 2009 at 7:29 PM, Carl Karsten c...@personnelware.com wrote: Try this, it should all become clear: def gimmetaste(length=5): print A, length return length * 2 if __name__ == '__main__': print B, gimmetaste()

Re: [BangPypers] Why the None ?

2009-09-03 Thread Noufal Ibrahim
On Thu, Sep 3, 2009 at 7:27 PM, Abhishek Mishraideam...@gmail.com wrote: Hi, I'm trying to pass 5 as default value for this function... def gimmetaste(length=5):        print length if __name__ == '__main__':        print gimmetaste()

Re: [BangPypers] Why the None ?

2009-09-03 Thread Mehndi, Sibtey
Any python function by default return None in your gimmetaste function you are not returning any value. That's why gimmetaste returns None -Original Message- From: bangpypers-bounces+sibtey.mehndi=genpact@python.org [mailto:bangpypers-bounces+sibtey.mehndi=genpact@python.org] On

Re: [BangPypers] Why the None ?

2009-09-03 Thread Abhishek Mishra
damn, where did i forget the return. This is a big Oops! thanks anyways :) Abhishek Mishra ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers

Re: [BangPypers] link

2009-09-03 Thread bhaskar jain
:) He is Guido! I am a mere mortal! On Thu, Sep 3, 2009 at 10:46 PM, Noufal Ibrahim nou...@gmail.com wrote: On Thu, Sep 3, 2009 at 10:43 PM, bhaskar jainbhaskar.jain2...@gmail.com wrote: Nice link - http://aymanh.com/python-debugging-techniques We can have this thread were we discuss our

Re: [BangPypers] link

2009-09-03 Thread Noufal Ibrahim
On Thu, Sep 3, 2009 at 10:50 PM, bhaskar jainbhaskar.jain2...@gmail.com wrote:  :) He is Guido! I am a mere mortal! It is an interesting point though. Back when I used to code in C, I always jumped for gdb and GUD whenever I needed chase a bug. WIth Python, I don't really know how to use pdb.

Re: [BangPypers] link

2009-09-03 Thread steve
On 09/03/2009 10:46 PM, Noufal Ibrahim wrote: On Thu, Sep 3, 2009 at 10:43 PM, bhaskar jainbhaskar.jain2...@gmail.com wrote: Nice link - http://aymanh.com/python-debugging-techniques We can have this thread were we discuss our own debugging techniques. I uses syslog :( and kind of like

Re: [BangPypers] link

2009-09-03 Thread srid
On Thu, Sep 3, 2009 at 10:16 AM, Noufal Ibrahimnou...@gmail.com wrote: * Debugging: Guido uses print statements for 90% of his debugging and a debugger for the times when his brain stops working or he has to debug some wierd code that someone else wrote.

Re: [BangPypers] link

2009-09-03 Thread Roshan Mathews
On Fri, Sep 4, 2009 at 7:33 AM, sridsridhar.ra...@gmail.com wrote: I too use print statements almost all the time. Even for debugging CPython code. I guess it is due to my own laziness. Putting `print` or `LOG.debug` is much easier/quicker compared to firing up a debugging console (and