branch-formats review

Robert Collins robertc at robertcollins.net
Tue Jan 31 20:02:39 GMT 2006


On Wed, 2006-02-01 at 00:33 +1100, Martin Pool wrote:

> > === modified file 'bzrlib/branch.py'
> > --- bzrlib/branch.py	
> > +++ bzrlib/branch.py	
> > @@ -81,24 +90,38 @@
> >      base
> >          Base directory/url of the branch.
> >      """
> > +    # this is really an instance variable - FIXME move it there
> > +    # - RBC 20060112
> >      base = None
> 
> Yes, it is.  It's initialized here to give the default value, because of
> the Python behaviour that class variables are seen underlying instance
> variables.  I don't particularly *like* this behaviour but it did seem
> to be well established. (?)  Maybe we shouldn't do this?

Its 'standard' python behaviour, but its a barrier to effective
programming for non pythonistas. Unless theres a specific reason to use
it (such as a large object, millions on instances owning such objects, a
default that is not None, or a absolutely performance critical loop that
is somehow not critical enough to redo in C :).

> > @@ -123,10 +151,32 @@
> >              t = new_t
> >  
> >      @staticmethod
> > +    def create(base):
> > +        """Create a new Branch at the url 'bzr'.
> > +        
> > +        This will call the current default initializer with base
> > +        as the only parameter.
> > +        """
> > +        return Branch._default_initializer(safe_unicode(base))
> > +
> 
> Should be "at the url 'base'"

Heh, yup - caught that in my bzr-dir branch.

Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060201/7c71f8e5/attachment.pgp 


More information about the bazaar mailing list