non-obvious behavior of the "bunch"

Bug #984408 reported by Alexei M.
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-tempita (Ubuntu)
Opinion
Undecided
Unassigned

Bug Description

Python 3.2.3 (default, Apr 12 2012, 19:08:59)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import tempita
>>> bunch = tempita.bunch(default=None)
>>> bunch.b
>>> print(bunch.b)
None
>>> bunch2 = bunch.copy()
>>> print(bunch2.b)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'dict' object has no attribute 'b'

Using hack for python3:
....

>>> def copy(self):
... return self.__class__(**dict(self.items()))
...
>>> tempita.bunch.copy = copy
>>> bunch = tempita.bunch(default=None)
>>> print(bunch.b)
None
>>> bunch2 = bunch.copy()
>>> print(bunch2.b)
None

Alexei M. (estoesyo)
Changed in python-tempita (Ubuntu):
status: New → Opinion
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.