Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Fri Jun 1 13:18:27 CEST 2007
In <mailman.8524.1180689593.32031.python-list at python.org>, Warren Stringer
>> Warren Stringer wrote:
>> > As mentioned a while back, I'm now predisposed towards using `do(c)()`
>> > because square brackets are hard with cell phones. The one mitigating
>> > for more general use, outside of cell phones, is speed.
>> The speed at which you can type code is almost _never_ a valid reason to
>> make something brief. Code gains readability from verbosity. (That can
>> be taken too far, of course, but that certainly doesn't apply here.)
> There is code that you type which persists and code that you type from a
> command line. Two completely different idioms. A credo inside the cell phone
> game industry is that you lose half your audience with each menu keystroke.
> That's how precious keystrokes are.
> What may be confusing is speaking about both idioms at once.
>> In short, your repeated use of `c[:]()` indicates a fundamental
>> misunderstanding about Pythonic style _and_ substance.
> Please define Pythonic. Is this like a certain US senator who defined porn
> as "I know it when I see it."
Yes you are right, "pythonic" is not a hard fact. But one indicator is
consistency and no surprising behavior if possible. And that your
insisting on ``c[:]()`` instead of just ``c()`` seems to indicate you want
a change that is quite surprising. It would mean that a slice of a list
returns an other type with the __call__ method implemented.
> 28 years ago, I wrote a hierarchical DBMS that used lexical indentation. 15
> years ago I wrote a multimedia script language that used lexical indentation
> and automatic garbage collection - it was deployed on millons of clients. 2
> years ago I hand coded every line of the Python 2.2 BNF into another style
> of language description. Up until last month, I had tokenized a subset of
> said definition in C++, using templates to manage cardinality. Recently, I
> decided to forgo the C++ parser and am now rewriting it in Python. This is a
> risk. So, what hoop does one jump though to earn that oh so coveted
> "pythonic" merit badge?
Grok The Zen of Python (``import this`` at the interpreter prompt)?
Write "pythonic" code?
I don't see how writing other languages and Python parsers and translators
into other representations tells you much about the spirit and idiomatic
*usage* of a language. Your proposal is not about syntax, it's about
semantics. ``obj[:]()`` is basically syntactic sugar for:
``obj.__getitem__(slice(None)).__call__()`` and you want a change in the
implementation of `list.__getitem__()` and `tuple.__getitem__()`.
Marc 'BlackJack' Rintsch
More information about the Python-list