On 4/26/06, Edward Elliott <[EMAIL PROTECTED]> wrote: > Sion Arrowsmith wrote: > > Absolutely. I've written quite a lot of code (which I wasn't expecting > > anyone else to maintain) using 'I' for the same reasons. Plus, it's > > even shorter in terms of characters (if not keystrokes), stands out > > reasonably well, and for how I read it makes for better English > > grammar (eg I.send_response(...) -- I guess it depends on whether > > you're doing the mental transformation of method call to message > > passing). > > I didn't like 'I' because: > 1. i don't like caps except for constants (which it sorta is, i guess) > 2. it's too close to 'i' which is standard for temporary loop variables
I picked up a tip when I was working with C++ with regards to these sort of indexes (which I don't use so much in Python anyway, but...) and now use "ii", "jj" etc instead of just i. A single i is harder to pick out an (because of how common i is in English) pretty much impossible to search for. On the other hand, searching for (or highlighting, with an appropriate editor) all instances of ii is much more productive. > 3. the bad grammar (for message passing) is all the fun! > > > I stopped doing this when I started (a) maintaining other people's > > Python code, and having them maintain mine and (b) using editors > > whose Python syntax highlighting coloured "self" as special. > > "Readability counts" wins over a couple of extra characters. > > Sadly, tis true. Which makes me wish they'd just hard-coded 'self' for the > damn thing in the first place. Nothing worse than knowing what you're > missing. > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list