On May 21, 8:12 am, "Silver Rock" <[EMAIL PROTECTED]> wrote:
> yes, that is the way I a solving the problem. using lists. so it seems
> that there is no way around it then..
There's at least one way to do it that I can think of straight away:
selfmodule = __import__(__name__, None, None, (None,))
On Oct 25, 10:00 pm, "David S." <[EMAIL PROTECTED]> wrote:
> Does something like operator.getattr exist to perform a chained attr
> lookup?
Do you mean something like
class cattrgetter:
def __init__(self, name):
self.names = name.split('.')
def __call__(self, obj):
for nam
[EMAIL PROTECTED] wrote:
> but maybe it reduces code readabilty a bit for people
> that have just started to program:
>
> mul2 = def(a, b):
> return a * b
>
> Instead of:
>
> def mul2(a, b):
> return a * b
For such simple cases, yes. What about:
button.click += def(obj):
# do stuff
[EMAIL PROTECTED] wrote:
> Compared to the Python I know and love, Ruby isn't quite the same.
> However, it has at least one terrific feature: "blocks".
Well, I particularly like how Boo (http://boo.codehaus.org) has done
it:
func(a, b, c) def(p1, p2, p3):
stmts
I was so attached to these
After reading PEP-0328 I wanted to give relative imports a try:
# somepkg/__init__.py
# somepkg/test1.py
from __future__ import absolute_import
from . import test2
if __name__ == "__main__":
print "Test"
# somepkg/test2.py
But it complaints:
C:\1\somepkg>test1.py
Traceback (most recent c