On 6/11/07, Jim Jewett <[EMAIL PROTECTED]> wrote:
> "In fact, it might even use something downright misleading, and
> you won't have any warning, because we thought that maybe someone,
> somewhere, might have wanted that character in a different context."
>
> And no, I don't think I'm exagerating with that last one; we aren't
> proposing rules against mixed script identifiers (or even limiting
> script switches to occur only at the _ character).
This isn't limited to identifiers, though. You can already write "tricky"
code in 2.5, but the coding directive and the unicode/str separation
make it obvious that something funny is going on. The former will not
be necessary in 3.0 and the latter will be gone. Won't restricting
identifiers only give you false sense of security?
Small example using strings:
authors = ['Michélle Mischié-Vous', 'Günther Gutenberg']
clearances = ['infrared', 'red', 'orange', 'yellow', 'green',
'blue', 'indigo', 'violet', 'ultraviolet']
class ClearanceError(ValueError):
pass
def validate_clearance(clearance):
if clearance not in clearances:
raise ClearanceError(clearance)
def big_red_button451(clearance):
validate_clearance(clearance)
if clearance == 'infrarеd': # cyrillic e
# Even this button has *some* standards! -- Michélle
raise ClearanceError(clearance)
# Set Günther's printer on fire
def main():
try:
big_red_button451('infrarеd') # cyrillic e
except ClearanceError:
pass
else:
print('BRB 451 does not check clearances properly!')
if __name__ == '__main__':
main() # run tests
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com