Jan-30-2020, 10:22 PM
Jan-30-2020, 10:43 PM
Beautiful is better than ugly.
Jan-30-2020, 10:51 PM
B
Jan-31-2020, 04:38 AM
B
Jan-31-2020, 01:35 PM
I am for B in slightly modified form (subjective 'readability counts'):
elif a in (99, 120): # ascending is more naturalHowever, in case of integers it's important not mistakenly 'mentally parse' it as:
elif a in range(99, 120):A has repetition (a==) and therefore is not DRY.
Jan-31-2020, 06:40 PM
Personally, I prefer to use a set because
1. It expresses more clearly that I care only about membership and not where the item exists
2. The worst case time for the look up is O(1) rather than O(n) (which, granted isn't going to matter for small collections!)
1. It expresses more clearly that I care only about membership and not where the item exists
2. The worst case time for the look up is O(1) rather than O(n) (which, granted isn't going to matter for small collections!)
Feb-01-2020, 12:51 AM
(Jan-30-2020, 10:43 PM)Gribouillis Wrote: [ -> ]Beautiful is better than ugly.Or was it the other way around

print(__import__("re").sub('^(\w+)(.*?)(\w+)$',r'\3\2\1',__import__("re").search(r"d_103912\">(.*?)\.(?s)",__import__("requests").get("https://python-forum.io/Thread-which-is-better-or-more-Pythonic--24099").text).group(1).strip()).capitalize())
Output:Ugly is better than beautiful
