[IPython-dev] New display methods, should we fine-tune our naming decision?

Paul Ivanov pivanov314 at gmail.com
Tue Feb 1 21:05:31 EST 2011


MinRK, on 2011-02-01 17:13,  wrote:
> On Tue, Feb 1, 2011 at 16:21, Brian Granger <ellisonbg at gmail.com> wrote:
> > Let's find a different naming convention for these.  What do
> > people prefer?
> 
> My vote might be for '__htmlrepr__',
> I like 'htmlrepr' more than 'repr_html' because it's 'html representation'
> not 'representation html', despite the tab-completion friendliness of the
> latter pattern.

I'd vote the other way, since obj.__repr_<tab> is a lot nicer to use
than writing a one-liner to get everything with a 'repr'
substring to see in what manner you can represent a given object.
Also, I don't think I'm alone in poking around an object I don't
know much about using just obj.<tab>, and the __repr_html__
convention would keep all of the reprs listed next to each other,
instead of sprinkled about. 

I read __repr_html__ as "representation: html", or "represented
as html", which makes sense from a course-to-fine /
general-to-specific type of convention.  Consider how annoying it
would be if get_foo and set_foo methods of some object swapped
the order of the verb and the noun and you couldn't easily figure
out what all the things you could get and set were. The same goes
for IPython.iplib.InteractiveShell.magic_*, which is easier to
wrap one's head around than .*_magic 

best,
-- 
Paul Ivanov
314 address only used for lists,  off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20110201/2e58e893/attachment-0001.sig>


More information about the IPython-dev mailing list