[Twisted-Python] twisted.positioning progress report + small review question

Laurens Van Houtven lvh at laurensvh.be
Tue Sep 1 17:22:24 EDT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi :-)


Just reporting progress on twisted.positioning. The NMEA parser is
basically functional, it's got one or two warts I don't quite like but
I intend on fixing once I figured out how (apparently GSV is
*supposed* to be awkward, but I'm going to try very hard to make it
less so).  I'm working on GPSD support. This should take a lot less
time than NMEA support did because GPSD's protocol is not terrible :-)
Again, watch this space, I'll keep reporting of course.

My review question, however small, is a tad urgent. With GPSD support
on the horizon, even more stuff is pretending to be a sentence, and
although they don't share an interface (that wouldn't be very sensible
anyway, since Sentences in t.positioning terminology are
implementation-specific containers), the way these sentences work is
quite important. The longer it takes for me to figure out how people
want me to do it, the more will need to be changed :-)

Personally I'm still not terribly objected towards __getattr__.
Usually I wouldn't like it either, but personally I just really don't
like the look of the bunch of properties alternative. Maybe I'm just
being stupid -- at least not so stupid that I'm not willing to listen
to anyone willing to show me a clean way of doing it.

The obvious objection to __getattr__ (the way it's implemented
currently) is that silently failing and returning None for arbitrary
keys is not a replacement for object attributes. There's a point to
that, and I agree entirely (I've had to hunt a few bugs with NoneType
not having a certain attribute), but I think I have solution:

I propose that we have a given set of attributes that __getattr__
would accept, and simply raise AttributeError (as expected) for
attributes not in that set. This would return None for things that
*can* be in a sentence but aren't -- and that makes perfect sense to
me. This list of allowed attributes can be generated quite easily
programmatically for NMEASentence.


Let me know what you think, thanks in advance for your time
Laurens
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Use GnuPG with Firefox : http://getfiregpg.org (Version: 0.7.8)

iEYEARECAAYFAkqdekoACgkQT5v5zGkvKT7dJACglKUDpDDow65YJrG9sfxnB4Aj
BzoAoLNv+Pm20r3Y0cI1lSGqvzZO7T9g
=/uT+
-----END PGP SIGNATURE-----



More information about the Twisted-Python mailing list