Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#21 Changing return type of *copy methods.

closed-fixed
nobody
None
5
2005-04-26
2005-02-11
No

Currently, _g_copy() and copy() methods from leaf
objects, as well as *copyChildren() methods, do return
a tuple of numbers with some statistics. I think that
it may make more sense to return the newly created
object (maybe not for *copyChildren) and use an
optional argument to pass in an object used to collect
statistics:

stats = Statistics()
newleaf = oldleaf.copy(stats = stats)
print stats

Discussion

    • status: open --> open-fixed
     
  • Logged In: YES
    user_id=1064183

    This behaviour is implemented right now in the repository.
    Copying operations return the new node, and statistics are
    collected via an optional keyword argument (``stats``),
    which may be a dictionary with keywords ``'nleaves'``,
    ``'ngroups'`` and ``'nbytes'``::

    stats = {'nleaves':0, 'ngroups':0, 'nbytes':0}
    newarray = array.copy('/', 'test', stats=stats)
    # Now stats['nleaves'] should be 1.

    For the moment there is no Statistics class for it lack of
    functionality (but this might change). All the changes have
    been properly documented.

     
  • Logged In: YES
    user_id=1064183

    This bug was actually closed by 2005-03-10. The previous
    message is slightly incorrect, since keys are called
    ``bytes``, ``groups`` and ``leaves``.

     
    • status: open-fixed --> closed-fixed