corator doesn't need a "slots" class.
>
> AFAICT this differs from your proposal in that in your proposal you
> want to use '.' as an include prefix the above uses '_' as an exclude
> prefi
if there is a way to hide the _ or self_ from the user of the
class, i.e. given:
class foo(object):
@attribute_decorator
def __init__(self, x, _y, z):
pass
can we make it such that the user can still write
foo(x=1,y=2,z=3)
without the underscore?
Cheers,
Ral
it immediately:
in __init__() _y = 2
self.x = 1
self.z = 3
in __init__() _y = 3
self.x = 2
self.z = 1
Traceback (most recent call last):
File "/net/cci/rwgk/decorated_init.py", line 45, in ?
MyClass( z = 1, x = 2, _y = 3 ).show()
File "/net/cci/rwgk/de
plain_adopt_grouping: 0.69
autoinit_grouping: 1.14
autoinit_setattr_grouping: 1.07
autoattr_grouping: 1.01
decorated_init_grouping: 0.94
I think your decorator solution looks nice and has a good potential time-wise.
Cheers,
Ralf
> file_object, data
sys.stdout = StringIO()
show("hello, world.")
If you run this, you will see "hello, world." on the screen. This means the
right side of file_object=sys.stdout is evaluated when the Python code is
parsed/compiled, not when it is executed.
Chee
% python
Python 2.4.1 (#1, Apr 7 2005, 11:06:30) [C] on osf1V5
Type "help", "copyright", "credits" or "license" for more information.
>>> execfile.__doc__
'execfile(filename[, globals[, locals]])\n\nRead and execute a Python script
from a file.\nThe globals and locals are dictionaries, defaulting
ind. This is my preferred solution after thinking about it for a
while (and asking myself "what would be best" while writing new Python code):
def __init__(self, self.x, y, self.z)
An approximation to this is attached for experimentation. It is based heavily
on code posted by others in t
101 - 107 of 107 matches
Mail list logo