On 10 Aug 2005 12:01:01 -0700, Qopit <[EMAIL PROTECTED]> wrote:
>> Why not just find out, by trying to compile it? :-)
>
>This will likely certify me as a python newbie, but... how do you mean?
> How do you compile a .py file?

At the command prompt:

$ python yourfile.py

This compiles it, then runs it.

>If you mean to .pyc by doing an import on it,

Indeed so.

> that may work fine for
>the simple example I typed up earlier, but that is easy to bypass by
>slapping the offending line in a function.  The sample below also
>passes PyChecker with not even a warning:
>
>#----
>def tester(a,b,c):
>  print "bogus test function",a,b,c
>
>def try1():
>  tester(1,2,3)
>def try2():
>  tester(1,2)    #still no error here
>#----
>
>Do you mean something different?

I've never used PyChecker myself, so can't comment on it.

I've not personally had problems with the wrong number of argumnets 
to a function call -- they get caught at run-time and are easy 
enough to fix -- but I do sometimes get errors because a varialbe is 
the wrong time, e.g. a string when it should be an int.

One problem I once encountered was wit this and I waasn't picking it 
up because my debugging code looked like this:

   if debug: print "v=%s" % (v,)

Which of course prints the same output whether v is '2' or 2.

For this reason I tend to debug print statements like this now:

   if debug: print "v=%s" % (v,)


-- 
Email: zen19725 at zen dot co dot uk


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to