Python design failures (was Re: Let's Talk About Lambda Functions!)

Daniel Fackrell unlearned at DELETETHIS.learn2think.org
Mon Jul 29 13:03:02 EDT 2002


"JB" <jb at hotmail.com> wrote in message
news:3d457011_1 at news.newsgroups.com...
> Aahz wrote:
>
> > In article <3d455445_9 at news.newsgroups.com>, JB
> > <jb at hotmail.com> wrote:
> >>Tim Peters wrote:
> >>>
> >>> two language features are mentioned as being "failed
> >>> experiments" that only compatibility prevents throwing
> >>> away:
> >>>
> >>>     `back ticks`
> >>>     lambda
> >>
> >>(1) Why are back ticks a failure? I love them.
> >
> > If you're using backticks frequently, you're probably not
> > programming
> > Pythonically.  There's already repr() to produce the same
> > result as backticks, and backticks have the problem that
> > in many fonts they're nearly indistinguishable from single
> > quotes.
>
> I do not understand this. I use __repr__ *and* backticks.
> For example
>
> class AnyClass:
>   defr __repr__(self):
>     ...
>
> a = AnyClass()
> myfile.write(`a`)
>
> I use this construction rather frequently. What is wrong
> with it?
>
> --
> JB


repr() != __repr__()

`object` == repr(object), both of which will call object.__repr__, if it
exists.

I think that the general consensus is that repr(object) is much more
readable than the relatively obscure syntax `object`.  Also, as written
previously, the ` is easily confused with ' in many fonts.

--
Daniel Fackrell (unlearned at learn2think.org)
When we attempt the impossible, we can experience true growth.





More information about the Python-list mailing list