Raphael Clifford <drr...@gmail.com> writes:

I did not closely follow the previous conversation, please forgive me if
I'm off topic.

> Is it possible for use pyflakes with some suitably defined annotation
> to do something equivalent?  Getting python devs to accept the
> suggestion for the core python language more not be at all plausible.

Well, it might be interesting if pyflakes or some similar tool was able
to make sense out of a few:

   assert isinstance(argument-identifier, some-class)

statements at the beginning of a function.  That would be not only valid
Python, but meaningful code whenever executed, as it would ascertain the
sanity of function arguments.

Such "assert insinstance()" could be sprankled in other places as well
for pyflakes to recognize, but I'm not sure it would not become fairly
complex to process them all correctly and make proper/useful inferences.

The drawback is that this would slow down the execution when used in
frequently used, smallish functions.  One might argue that assertions
might be all turned into noops by using -O on the python call, but I do
not buy this argument: turning off all assertions is like activating a
kind of unsafe-mode, which people would not do in practice.

François
_______________________________________________
code-quality mailing list
code-quality@python.org
http://mail.python.org/mailman/listinfo/code-quality

Reply via email to