the.bay.news

Namespace blocks

Discussions on Python.org
Namespace blocks
I started playing with the idea of namespaces in Python due to the recent discussions about public/private. It’s often useful to group related items under a name, but creating a submodule isn’t always desirable. Python currently has two constructs that introduce a new namespace (and scope), class and def. class is fine for grouping constants or even classes, but due to Python’s name resolution rules, not for functions. On the other hand, functions are obviously not evaluated immediately. Thi...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.