On Tue, Apr 03, 2001 at 09:59:32PM +0200, Moshe Zadka wrote: | For all those crying for boolean values, here's a simple module | that will hopefully solve all your needs: | ... | import __builtin__ | __builtin__.true = _true() | __builtin__.false = _false() | __builtin__.dunno = _dunno() Err, >>> __builtins__.true = _true() Traceback (innermost last): File "<console>", line 1, in ? NameError: __builtins__ >>> It didn't work. The first two lines of output are : Jython 2.0 on java1.3.0 (JIT: null) Type "copyright", "credits" or "license" for more information. Jython doesn't allow such trickery like CPython does (I didn't del __builtins__ or something stupid like that). In any case, this would need to be done in each module since a module may be run separately for unittests. The other alternative would be to add it to site.py, but that is horrible for installation on a user's system. As it is, I have true = 1 false = 0 at the beginning of each file. It doesn't do everything I want it to (like some_val == true working properly) but it works for all other cases where it is actually used. | To the people who don't know me yet: when I say "it can be done in | Python in 20 lines, here's the code", I usually mean "I don't think | it has any merit. Nobody's done it not because it's hard, but because | it's useless" ;-) I know it would be a quite trivial implementation, but why do you think the words 'true' and 'false' are useless? (natural language differences don't really count because the rest of Python's keywords and builtin names are in English) -D
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4