Typed python comparison / code analysis questions

Lucas Vickers lucasvickers at gmail.com
Wed Jan 4 15:42:05 EST 2012

Thank you!

At the moment python3 isn't an option.  There's a variety of dependencies
I'm working around.
Is there any type of 2.x add-on?

either way thanks for the info


On Wed, Jan 4, 2012 at 3:34 PM, Ian Kelly <ian.g.kelly at gmail.com> wrote:

> On Wed, Jan 4, 2012 at 1:09 PM, Lucas Vickers <lucasvickers at gmail.com>
> wrote:
> > Hello,
> >
> > I'm relatively new to Python.  I come from C/C++ so I love the
> flexibility
> > but I am slightly irked by the lack of compilation time checking.
> >
> > I've got two questions
> > 1) Are there any tools that do an analysis of code and attempt to catch
> > potential issues such as undefined variables, etc?  I use xdebug in php
> for
> > this purpose and it's a life saver.  Currently for Python I use module
> test
> > cases and simulate situations but this doesn't catch everything and on a
> > larger scale of development becomes difficult.
> Yes, try pylint, pychecker, or pyflakes.
> > 2) Is there a way to error when comparing variables of different types?
>  I
> > was up late last night coding and caused a few bugs with the below code,
> > which turns out to compare a type<str> to a type<int>.  I know good
> > programming I should know what my variable types are, but it would be
> even
> > better if I could always abide by a rule of using <_ (or something) which
> > would spit an exception when comparing non-equal types/instances.
> This is a well-known wart in Python 2.  The recommended solution would
> be to upgrade to Python 3, which no longer allows ordered comparisons
> between unrelated built-in types.
> Cheers,
> Ian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120104/202c68bf/attachment-0001.html>

More information about the Python-list mailing list