Handling 3 operands in an expression without raising an exception

Νίκος nikos.gr33k at gmail.com
Sat Sep 28 05:14:08 EDT 2013


Στις 28/9/2013 4:59 πμ, ο/η Chris Angelico έγραψε:
> On Sat, Sep 28, 2013 at 8:06 AM, Νίκος <nikos.gr33k at gmail.com> wrote:
>> Well to tell the truth no matter what you say to me if something can be
>> written in less lines than another implementation but still retain its
>> simplicity and straightforward logic behind it i would prefer it!
>> I don't know why you think otherwise, especially people who are used to
>> write Perl code(me being one of them) would agree with me!
>
> It's high time you stopped trying to write Perl code that runs under
> the Python interpreter, and started writing Python code that runs
> under the Python interpreter.
>
> There are rules. You first learn the rules and learn to code within
> them; then later, once you actually achieve some measure of
> competence, you begin learning when to break the rules.
>
> ChrisA
> χεχεf
I agree with everything you say, but i also have to say that even 
writing compact code which still retain its simplicity and understanding 
its preferred to me and to other coders too.


For example i wouldn't change this line for anything in my code no 
matter how simple you can get it look..

#check if date entered as intented, format it properly for MySQL
lastvisit = datetime.strptime(lastvisit, '%d %m %Y').strftime('%Y-%m-%d')

why write it in 2-3 lines when you cna have it written in 1-liner?

Isn't it clear as it is now?



More information about the Python-list mailing list