Kamilche wrote:

Yeah, but still. If they even had the most basic check, like 'an object
is being referred to on this line, but you're not doing anything with
it' would be handy in catching that. When you use an object like that,
usually you're doing something with it, like assigning it to a variable.


In many cases, however, it's not possible to distinguish this.

    def get_pi():
        import math
        return math.pi

    print my_func(get_pi)

Now, am I trying to pass the function object get_pi into my_func(), or do I want to call get_pi() and pass the return value?

There are also many times when it's sensible to do nothing with an object reference -- i.e. ignoring the return value of a function which you're calling for its side-effects.

It seems to me that it's reasonable for the Python interpreter to *not* attempt to guess at whether a questionable usage is an error or not. Better to have that done by a developer tool (pychecker) than through runtime checks every time the program is used.

Jeff Shannon
Technician/Programmer
Credit International

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

Reply via email to