[PATCH 1 of 3 RFC] vfs: add "vfs" fields to localrepository for migration from "opener"
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Thu Jun 28 07:41:35 UTC 2012
At Wed, 27 Jun 2012 15:25:01 -0500,
Matt Mackall wrote:
>
> On Wed, 2012-06-27 at 17:19 +0900, FUJIWARA Katsunori wrote:
> > At Tue, 26 Jun 2012 16:28:09 -0500,
> > Matt Mackall wrote:
> > >
> > > On Tue, 2012-06-26 at 12:59 +0200, Adrian Buehlmann wrote:
> >
> > > > BTW, has anyone thought about renaming __call__ on the opener class to
> > > > open? After all, vfs is not just an "opener" any more...
> > >
> > > Adding an alias is fine.
> >
> > Would "adding an alias" mean adding code like below ?
> >
> > def open(self, path, mode="r", text=False, atomictemp=False):
> > return self(path, mode, text, atomictemp)
> >
> > (or "self.open = self.__call__" in "__init__()")
>
> Why does it need to be in __init__?
I just think that:
- defining "open()" causes indirect invocation of "__call__()" via
"open()", so it requires one more "function invocation" overhead
than direct "__call__()" invocation
- setting "self.__call__" to "self.open" seems to reduce such
overhead (but it may be wrong, because I'm not so expert for
Python)
But, I don't know the other way to set "self.__call__" to "self.open"
than doing it in "__init__()".
If there are any other good ways (or there is no need to mind such
trivial overhead), please tell me and I'll do so.
----------------------------------------------------------------------
[FUJIWARA Katsunori] foozy at lares.dti.ne.jp
More information about the Mercurial-devel
mailing list