Two and a half examples of "Don't solve the problem I described. Provide the implementation I dream about."
I was asked to see this because sometimes there's just too much abstraction https://stackoverflow.com/questions/2668355/how-much-abstraction-is-too-much
The accepted answer links to some useful design …
Got this in an email.
"Python's multi-threading module seems not efficient because of the global interpreter lock?"
Yep.
Is the trick is to use "Thread-Local Data"?
Nope.
Interestingly, there was no further ask. The questioner had decided on thread-local data because the questioner had decided to focus …
https://sobolevn.me/2019/02/python-exceptions-considered-an-antipattern While eloquent and thorough, I remain unconvinced that this is a significant improvement over try/except. It's common enough in some functional languages to have strong support and a long, successful history. I think it replaces one problem with another. It's not a "solution …
more ...Had a question about an enumerated set of constant values. "Where do I put these constants?" they asked. It was clear what they wanted. This is another variation on their personal quest which can be called "I want Python to have CONST or Final." It's kind of tedious when a …
more ...Consider the following code
def max(m: int, n: int) -> int: if m >= n: return m elif n >= m: return n else: raise Exception(f"Design Error: {vars()}")
There's a question about else: clause and the exception raised there.
See this
Dear Pythonista lazyweb: If I have a property spam and the attribute that backs it is _spam, what do we call that? The "backing attribute"? The "original property"? Something else? Is there an official term for this?
—Al Sweigart (@AlSweigart) January 29, 2019
My answer was -- frankly -- vague …
more ...Today's Example of Starting Badly: Building HTML.
The code has a super-simple email message with f"<html><body><p>stuff {data}</p></body></html>". It was jammed into an email object along with the text version. All very nice. For a moment, I considered suggesting that f-string substitution wasn't a …
more ...I can't actually share all the code. So this feels incomplete. But I can share what I said about the code. Then you can look at your code and decide if you've got similar problems to fix.
My responses were these. I'll expand on them below.
See 10 Reasons to Learn Python in 2019.
I want to dwell on #4 for a moment.
The Python community actually has a Code of Conduct. We try to stick by it and conferences will have reporting mechanisms in place so we can educate folks who are being inconsiderate or …
more ...