Am 11.07.2013 16:11, schrieb Peter Otten:
Ulrich Eckhardt wrote:
Bug or feature?

No bug. Missing feature if you come up with a convincing use-case.

class Parser:
    def _handle_bool(input):
        # ...
        pass

    types = {'bool': _handle_bool,
             'boolean': _handle_bool,}

    def parse(self, line):
        t,s,v = line.partition(':')
        handler = types[t]
        return handler(v)

I want a utility function that really behaves just like a function. I'd prefer to nest it inside the class that uses it, to make the code easier to understand. Since I don't want the implicit self-binding either, I would use staticmethod to make this clear, too.

Since I can live without any of this, it's not a big issue. What is to me a big issue though is the fact that Python behaves unexpectedly and reading Steven's response and the link there, it seems I'm not alone.

Greetings!

Uli



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

Reply via email to