Python Forum
elegant code - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Forum & Off Topic (https://python-forum.io/forum-23.html)
+--- Forum: Bar (https://python-forum.io/forum-27.html)
+--- Thread: elegant code (/thread-9155.html)



elegant code - Skaperen - Mar-24-2018

what is it that make code elegant?


RE: elegant code - Larz60+ - Mar-24-2018

you


RE: elegant code - Skaperen - Mar-24-2018

what would people look for in code to decide to say that some particular code is elegent?


RE: elegant code - wavic - Mar-24-2018

Easy reading and understanding?


RE: elegant code - DeaD_EyE - Mar-24-2018

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



RE: elegant code - Skaperen - Mar-25-2018

is pythonic a proper subclass of elegant?


RE: elegant code - DeaD_EyE - Mar-26-2018

I think so. Maybe pythonic is a subclass of elegant and readable.


RE: elegant code - Skaperen - Mar-26-2018

(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 ... ?