devork

E pur si muove

Time to read standards

Thursday, April 17, 2008

Sometimes I like quotes out of context...

Anyway, I don't think it really is an ambiguity in practice -- only in the minds of those that have too much time to read standards documents.
-- Greg Ewing (on distutils-sig)

@x.setter syntax in Python 2.5

Friday, April 11, 2008

The new property.setter syntax in Python 2.6 and 3.0 looks very clean to me. So I couldn't wait and wanted it in Python 2.5. With the help of comp.lang.python I finally got there (thanks especially to Arnaud Delobelle):

_property = property

class property(property):
    def __init__(self, fget, *args, **kwargs):
        self.__doc__ = fget.__doc__
        super(property, self).__init__(fget, *args, **kwargs)

    def setter(self, fset):
        cls_ns = sys._getframe(1).f_locals
        for k, v in cls_ns.iteritems():
            if v == self:
                propname = k
                break
        cls_ns[propname] = property(self.fget, fset,
                                    self.fdel, self.__doc__)
        return cls_ns[propname]

The __init__() wrapper is needed to get __doc__ set properly (this surprised me). The whole cls_ns stuff and the loop are required since the properties are defined in C and their fset attribute is read-only. Which is why the entire property needs to be replaced. The implementation of deleter() can now be regarded as an exercise to the reader...

(O)OXML and ISO voting processes

Friday, April 11, 2008

Many have recently complained about ISO's voting processes, mainly how they need to be revised as currently it seems it's possible to buy yourself a standard given enough lobbyist and money.

But part of this is ISO's trust in ECMA. ISO allows ECMA to submit standards for the fast-track process because it trusts it to approve good standards. If OXML (as it seems to be called now it's approved, formerly OOXML) was indeed such a bad standard (which I don't doubt personally) then ISO should maybe review it's relationship with ECMA too?

This is only a tiny part of the picture obviously, but one I haven't seem mentioned elsewhere.

Shell history

Thursday, April 10, 2008

hehe

flub@signy:~$ history | awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}'|sort -rn |head
79 nosetests
74 ls
46 cd
36 ssh
28 man
22 apt-cache
19 vi
19 ack
17 svn
17 sudo
flub@signy:~$ 

It must be noted that most of my editing happens in emacs, but that only gets started a few times a day and then stays there (oh and emacs is started from a shortcut icon, not the shell).

nose and ipython

Sunday, April 06, 2008

I wish there was a simple way to integrate nose and ipython. Something like a command line option not to catch exceptions would be sufficient I think, so that you could do:

In [1]: %run tests/test_module.py --do-not-catch-exceptions

Obviously you'd want a shorter option switch...

Seems like Test.run() in case.py is where this happens, but I tried changing that with no success.

And to be really useful I'd want the default behaviour of test selection in a module where if __name__ == '__main__': nose.main() is used to be just that module. But maybe that's already supported and I'm just not finding it.

Last random thought: Maybe if nose's -d option did expand dotted names I wouldn't be wishing for any of this. Who knows.

One s3fs to rule them all?

Thursday, April 03, 2008

Sometimes I wish we could fast forward 6 or 12 months or so. Hopefully by then there will be just one s3fs that is mature and maintained. Right now it's hard to tell which one will turn out the best.

Interstingly, of the ones that look like they could have potential (trying to word it carefully here) two are written in Python (all are using fuse).

Subscribe to: Posts (Atom)