On Mon, Aug 1, 2011 at 12:46 AM, Noufal Ibrahim <nou...@gmail.com> wrote:
> Venkatraman S <venka...@gmail.com> writes:
>
>
>> Hang around in #django or #python. The most elegant code that you
>> *should* write would invariably be pretty fast (am not ref to asm).
>
> I agree with you here. Pythonicity is best defined as what the
> experienced python core devs do and the stuff they use the most is
> optimised a lot. Pythonic python code is often the fastest python code.

This is one aspect of python that I am not a fan of. Because being
pythonic conflates the idioms for expression and idioms for
performance. There are situations when the needs of performance
overshadow the needs of expression. As an example creating classes
with attributes - and setting them is more expensive than creating a
dict, and writing a bigger block of sequential code is preferable
(again due to performance considerations) rather than breaking it into
multiple functions and especially when calling functions along with
map, filter, reduce or other itertool constructs (as opposed to say
list comprehensions).

Other languages also have situations where one has to do such
tradeoffs, but these are more in python, and especially alternative
styles of expression imo get buried under the label pythonic. So yes
there is a lot of importance associated with what is pythonic, but I
would've felt more comfortable if these were influence by expression,
rather than performance.

Dhananjay
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to