Python Forum

Full Version: elegant code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
what is it that make code elegant?
you
what would people look for in code to decide to say that some particular code is elegent?
Easy reading and understanding?
Python is good in expressing things.
If you understand this two functions in less than one minute, it's pythonic :-D
It's like poetry.

def qsum(number):
    result = 0
    number = abs(number)
    while number:
        result += number  % 10
        number //= 10
    return result

def qqsum(number):
    result = qsum(number)
    while result > 9:
        result = qsum(result)
    return result
is pythonic a proper subclass of elegant?
I think so. Maybe pythonic is a subclass of elegant and readable.
(Mar-26-2018, 06:31 AM)DeaD_EyE Wrote: [ -> ]I think so. Maybe pythonic is a subclass of elegant and readable.

... a subclass of the intersection of ... ?