6
votes
Implementing a --assume-yes/--assume-no command line flag to affect a `input()` based `confirm()` function
Of the three approaches, the first seems best to me. We can do a little better by giving names to the the "assume" versions of the function, and include them in ...
5
votes
Implementing a --assume-yes/--assume-no command line flag to affect a `input()` based `confirm()` function
Don't assign to args within the __main__ guard - it's still global; it needs to be moved to a function.
...
4
votes
Increment a large integer represented as array of digits
PEP 20 – The Zen of Python
To write Pythonic code, I think PEP 20 – The Zen of Python is the great place to start.
I think the posted code doesn't do great with respect to these points:
Beautiful is ...
2
votes
Expirable LRU cache
name
A lru_cache
with expiry, nice! I like the requirements.
Calling it LRUCache seems to invite confusion with the well-known
functools decorator, at least during ...
1
vote
Find all combinations of two companies grouped by the projects they are tendering for
What are the options to optimize the code
You wrote
...
for item in items
... dataframe['tender_product'] == item ...
and complained that ...
1
vote
Implementing a --assume-yes/--assume-no command line flag to affect a `input()` based `confirm()` function
An online search for "python configuration management" will return a slew of libraries and articles proposing solutions related to this topic. Which suggests there isn't a single answer that ...
1
vote
Given a list of digits, construct the largest number divisible by 3
The original solution and the proposed solutions include a step of sorting the list of digits. So technically, they are O(n log n), but the list is at most 9 digits long, so the difference may not be ...
1
vote
Leetcode: 2327. Number of People Aware of a Secret
Your approach may be less efficient due to a recursive design that doesn't account for overlapping subproblems effectively, leading to suboptimal runtime and memory usage. The iterative solution ...
1
vote
Highly flexible tic-tac-toe terminal game in python
Overall the code is organized well and easy to follow. Here are my main points of feedback:
board.py
For the coords: tuple ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
python × 15281python-3.x × 5115
performance × 2296
beginner × 1958
python-2.x × 1233
algorithm × 1195
programming-challenge × 998
numpy × 739
object-oriented × 706
pandas × 595
game × 493
strings × 481
web-scraping × 428
time-limit-exceeded × 383
tkinter × 347
django × 317
parsing × 315
csv × 302
hash-map × 294
random × 250
recursion × 245
pygame × 233
regex × 229
file-system × 227
json × 218