>> [Antoine Pitrou] >> But magic numbers are ugly, even if they are hidden behind an >> enumeration. If you try to print them for debugging, it will only show >> the numeric values, which is hardly intuitive. >> [...]
>> [Giovanni Bajo] >> No, you're over-generalizing. What if I wanted the buttons Ok/Cancel >> instead? Or "Abort"/"Retry"/"Cancel"? The mental overhead is having >> to remember different APIs from the Yes/No case, if you're going to >> use a specialized version returning just a boolean. > [Greg Erwing] > In PyGUI I've tried to get some consistency here by > returning 1 or 0 for Yes-No dialogs (so you can > use it as a boolean if you want) and 1, 0, -1 for > three buttons (Yes, No, Cancel). Then, I'd like to have a name for 1,0,-1 instead of using the bare numbers (in case there are 4 buttons...). So, we're back to what Qt does: you're using magic numbers too. I don't think there's a way out. Giovanni Bajo _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com