durusmail: durus-users: Redundant code aliases in btree
Redundant code aliases in btree
2006-06-27
2006-06-27
2006-06-27
2006-06-27
2006-06-27
Redundant code aliases in btree
Patrick K. O'Brien
2006-06-27
Jesus Cea wrote:
> Studying a bug in a durus program (I still haven't found if the issue is
> in my code or in durus one; still investigating) I see the following
> code in durus.btree inside the "delete" implementation:
>
> """
>         def is_big(node):
>             # Precondition for recursively calling node.delete(key).
>             return node and len(node.items) >= self.minimum_degree
> ....
>             def is_big(n):
>                 return n and len(n.items) >= n.minimum_degree
> """
>
> That is, inside "delete" we define "is_big()" function TWO TIMES.
> Fortunately both implementations are equivalents, so no problem, But I
> rather prefer to see the redundant code deleted, since a future durus
> version could change one of them and not the other and hell would break
> loose.

Are they indeed equivalent?  One refers to 'n.minimum_degree', the other
to 'self.minimum_degree'.  Is it possible for those to be different?

--
Patrick K. O'Brien
Orbtech       http://www.orbtech.com
Schevo        http://www.schevo.org
Louie         http://www.pylouie.org
reply