I see this as a micro-optimization. IMO we should *not* rely on these
assumptions because we cannot expect that all developers of third party
modules will be able to write perfect code, and some (lazy developers!)
may prefer to use a fixed maximum character (e.g. 0xFFFF).

Hmm. I'd like to declare that it is incorrect usage of the API, only allowing maxchar to be at the next boundary (i.e. 127, 255, 65536,
larger).

There are always cases of incorrect usage of all API. For example,
not filling out a list entirely (i.e. leaving NULL in some fields)
may also cause strange results.

Users will need to learn what the API is. At the first approximation,
maxchar should be the true maximum character.

To be able to rely on such assumption, we have to make sure that strings
are in canonical forms (always check before using a string?).

No, we don't need that: garbage in, garbage out. If people use the API
incorrectly, they will get incorrect results. It's useful to have checks
in debug mode, but that's the most that people should reasonably expect.

Regards,
Martin
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to