Quoting Jason Ekstrand (2017-07-17 10:42:05) > Generally available things tend to be painful in Python because you have to > set > the python path if you ever want to import anything that isn't in your > directory. That doesn't mean we shouldn't do it, just that the pain may be > too > high. Also, having a copyright block at the top of the file as suggested > means > that the python file still has a copyright block.
I agree about the pain of PYTHONPATH, but putting an assignment before imports is a really, really, really, really bad idea. In python import is an overloaded keyword, it does two related things. It does the familiar "give me module <X> in my namespace", but it also can change the semantics of the language. That's what "from __future__ import <x>" does, and one of the things you can change that way is whether a string is a unicode or a bytearray in python2 (they default to bytearrays in python2, but unicode in python3), which is something we'll want to toggle if hybridize for python2 and 3. What would happen in this file now if we added "from __future__ import unicode_literals" is that the COPYRIGHT would visually look like a unicode object, but would actually be a bytearray, while the rest of the naked strings in the file would be unicode. What would actually be much easier, is putting the function in a mako file and loading that, mako has filesystem based loader for such things, and injecting mako into mako templates is pretty easy. I'll send a patch for that.
signature.asc
Description: signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev