Hallöchen! Grant Edwards writes:
> On 2008-06-14, Torsten Bronger <[EMAIL PROTECTED]> wrote: > >>> You're saying that having the user or-together a bunch of >>> bitmasks and pass the result as an integer is a common way for >>> Python functions/object allow the user to turn optional features >>> on and off? >> >> "Common" doesn't matter. > > Yes it does. "Common in Python" is what defines "Pythonic". Then I have your definition of it. I don't think that it leads to good design, though. In case of doubt, choose what's common in Python, but other characteristics must have higher priority. >> Legibility and practicality matter. > > [...] With a little practice and care, functional programming in > prefix-notation (a-la Scheme) can both practical and legible, Not legible for a Python-only programmer like me, and I am the target audience. > but it still isn't Pythonic. > > [...] > >>> They are sources of bugs. >> >> I don't think so. What do you mean? > > Because certain flags are only to be used in certain contexts, but > there's no way to force (or even to indicate) that usage to the > user. Related flags are orthogonal so that the library can well detect an error. Okay, you can pass a *very* wrong parameter, like telling wxPython that this event should have an OK button, but I find this problem case artificial. > [...] > >> I used to use C++ before I switched to Python, but I don't see >> any C++ in wxPython. > > The whole "flags" thing with a truckload of globally defined > integer constants competing for a single namespace is pure C/C++. > Were wxWidgets written in Python, I guarantee that wouldn't be the > way it was done. Well, of course it would look heavily different with a different history but this applies to every piece of software. As I said, I used flags in my own package, designed with Python 2.4. And I consider myself a purist. So, there are things that are bad or sub-optimal, but flags are a matter of personal preference. Tschö, Torsten. -- Torsten Bronger, aquisgrana, europa vetus Jabber ID: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list