I actually didn't have a definite use case in mind, it was pure curiosity that
arose while writing a few simple test functions. After having considered it
more, I can't come up with a case where it would really be necessary, so I
apologize for that. It makes sense why it wouldn't be possible wit
David wrote:
David wrote:
Hi,
Is this the correct way to handle a ValueError exception and should I
get in the practice of catching them?
Well yes and no.
I think it is better to use the string method isdigit to test for digits
only.
Also IMHO it is bad design to put a lot of code inside
wormwood_3 wrote:
Hello
all,
This might be trivially easy, but I was having a hard time searching on
it since all the component terms are overloaded:-) I am wondering if
there is a way to print out the code of a defined function.
Python does not store the source when compiling thing
wormwood_3 wrote:
> I am wondering if there is a way to
> print out the code of a defined function.
When Python compiles source code, it doesn't store the source code
itself; only the compiled intermediate code. With the 'dis' package you
can disassemble that:
def foo():
print "Show me
Hello all,
This might be trivially easy, but I was having a hard time searching on it
since all the component terms are overloaded:-) I am wondering if there is a
way to print out the code of a defined function. So if I have:
def foo():
print "Show me the money."
then I would like to do so
David wrote:
Hi,
Is this the correct way to handle a ValueError exception and should I
get in the practice of catching them? Also any suggestions on the program.
thanks
-david
Might help if I included the program :)
#!/usr/bin/python
import time
print "Enter year as "
print "Enter month
Hi,
Is this the correct way to handle a ValueError exception and should I
get in the practice of catching them? Also any suggestions on the program.
thanks
-david
--
Powered by Gentoo GNU/LINUX
http://www.linuxcrazy.com
pgp.mit.edu
___
Tutor maillist
Thx for help,
extreme lack of free time lately,
will look into it.
[Wouldn't've noticed myself that urlopen is not a class.]
On Tue, Dec 23, 2008 at 6:03 PM, Richard Lovely
wrote:
> OK, going on Kent's post:
>
> from urllib import urlopen
>
> class fetch(object):
>def __init__(self, *args):
Le dimanche 28 décembre 2008 à 10:17 -0800, Steve Willoughby a écrit :
> On Sun, Dec 28, 2008 at 07:09:51PM +0100, Sander Sweers wrote:
> > I am having issues cathing exceptions from telnetlib. What I am doing is:
> > except gaierror:
> > Which gives me "NameError: name 'gaierror' is not defined" :
On Sun, Dec 28, 2008 at 19:17, Steve Willoughby wrote:
> On Sun, Dec 28, 2008 at 07:09:51PM +0100, Sander Sweers wrote:
>> I am having issues cathing exceptions from telnetlib. What I am doing is:
>> except gaierror:
>> Which gives me "NameError: name 'gaierror' is not defined" :-(
>
> This error
On Sun, Dec 28, 2008 at 07:09:51PM +0100, Sander Sweers wrote:
> I am having issues cathing exceptions from telnetlib. What I am doing is:
> except gaierror:
> Which gives me "NameError: name 'gaierror' is not defined" :-(
This error message contains your clue. If the name you're referencing is n
Hello All,
I am having issues cathing exceptions from telnetlib. What I am doing is:
-
tc = telnetlib.Telnet()
try:
tc.open('abc')
except gaierror:
print 'Invalid hostname'
-
Which gives me "NameError: name 'gaierror' is not define
On Sat, Dec 27, 2008 at 2:55 PM, Matt Herzog wrote:
> What I can't figure out now is how to pass a compiled regex to an optparse
> option. I'm confused ias to "option" versus "arg" when using the optparse
> module. In fact there seems to be no way to define what the arg should be;
> only option
Le samedi 27 décembre 2008 à 19:32 -0500, btk...@email.unc.edu a
écrit :
> Hi everyone,
>
> I'm having trouble with an anagram generating program that I am writing
> in Python. My output is not what it should be and I think the reason
> has something to do with my helper functions creating a re
14 matches
Mail list logo