[Python-ideas] Operator as first class citizens -- like in scala -- or yet another new operator?

Ricky Teachey ricky at teachey.org
Wed May 29 15:34:24 EDT 2019


> This means, for a
> middle-sized class implementation, you will start to worry about name
> space collisions pretty quickly among all the class methods.
> Information is no longer perfectly localized but spreading across all
> over your class (and its parents ... which probably in a different
> file ...). thoughts?
>

I agree it has a lot of potential to do most of what you've described.

Seems to me that namespace collisions are a possibility no matter what
namespace you are working in, right? If you are in the global (module)
namespace, and use up a, b, and c, that doesn't seem any different to me
than using up ns.a, ns.b, and ns.c.

In fact, you could say it *expands* your namespace. You can have multiple
HDL namespaces and interact between them without any problems:

# these will be descriptors that store Signal instances
ns1.x = 1
ns2.x = 2
# you can combine them into another namespace
ns3.x = ns1.x+ns2.x
# or into an existing namespace
ns1.y = ns1.x+ns2.x
# or put them into a data structure
x = [ns1.x,  ns2.x, ns3.x]
# and pull them back out again:
ns4.a,  ns4.b, ns4.c = x

Behavior is preserved in all cases.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190529/723f7474/attachment-0001.html>


More information about the Python-ideas mailing list