Bill Janssen wrote:
The main purpose of that is to be able to catch type mismatches with
static typing, though. Seems kind of pointless for Python.
But catching type mismatches with dynamic typing doesn't
seem pointless for Python. There's nothing static about
the proposals being made here that I can see.
Why not
class Color:
red = (255, 0, 0)
green = (0, 255, 0)
blue = (0, 0, 255)
If all you want is a bunch of named constants, that's fine.
But the facilities being discussed here are designed to give
you other things as well, such as
c = Color.red
print(c)
printing "red" rather than "(255, 0, 0)".
--
Greg
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com