Applications Google
Menu principal

Post a Comment On: Only Python

"True constants in Python - part 2, and a challenge"

3 Comments -

1 – 3 of 3
Blogger Veky said...

You really need to define your rules more strictly. For example, how about defining a module test2, copying over everything from test to test2 except UPPERCASE, putting test2.UPPERCASE = whatever, and then test = test2 (or even sys.modules['test'] = test2?

5:06 AM

Blogger André Roberge said...

The challenge is to create an import hook that creates a custom module instead of relying on Python's semantics, and have that custom module use something like the FinalDict of the module constants. See https://github.com/aroberge/ideas/blob/master/ideas/import_hook.py#L131 for the step where that custom module would be used.

5:16 AM

Blogger AlbertMietus said...

Nice idea . **Good challenge**

Have to think a bit about it (deeply) to *invent* a elegant solution...

Thanks

5:39 PM

Spammers: none shall pass.
You can use some HTML tags, such as <b>, <i>, <a>

Comments on this blog are restricted to team members.

You will be asked to sign in after submitting your comment.
Please prove you're not a robot