[C++-sig] Need help on enum--a concrete example
Peter Bienstman
Peter.Bienstman at rug.ac.be
Tue Sep 10 21:27:57 CEST 2002
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Tuesday 10 September 2002 08:04, David Abrahams wrote:
> <<
> From: "Peter Bienstman" <Peter.Bienstman at rug.ac.be>
>
> Small question: is there a trick to pollute the global namespace with the
> constants, such that one can write just 'red' in Python, rather than
> 'choice.red'?
>
> I know it's less clean, but it's easier for the user and ties in better
> with
> Python's weak typing.
>
>
> It doesn't tie in well with Python's "strong namespaceing".
> There is no global namespace in Python. Do you mean that you'd like the
> constants to be in the enclosing scope?
Yep, point taken, that's what I mean.
For backwards compatibility and ease of use, I'd like my users to be able to
write:
set_polarisation(TE)
rather than
set_polarisation(polarisation.TE)
Is this possible? I'm perfectly fine with being burnt on the stake for being a
namespace heretic ;-)
Cheers,
Peter
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE9fkfA4dgPAIjyquoRAuZBAKDyiOdbn6QLtJEBf1M1znLOe2AGugCfcOdC
cWUZu8uT+Yr/uhSkLg0T6XY=
=6vnf
-----END PGP SIGNATURE-----
More information about the Cplusplus-sig
mailing list