Posts

This profile is from a federated server and may be incomplete. Browse more on the original instance.

nedbat, to random
@nedbat@hachyderm.io avatar

A fun browser toy: The Blob Toy.
Here's an example: https://oimo.io/works/blob/
https://oimo.io/works/blob/?id=07eb178b

nedbat, (edited ) to random
@nedbat@hachyderm.io avatar

How long am I willing to stick with something if it works? I'm currently editing an XSLT file that underpins my blog... https://nedbatchelder.com/site/xuffpx.html

nedbat, to python
@nedbat@hachyderm.io avatar

Mostly you shouldn't subclass built-in types. But if you do, dict subclasses can define missing: it's called when a key is missing. Instead of hiding a dict in a function as a cache, how about hiding a function in a dict!? A Fibonacci dictionary:

nedbat, to python
@nedbat@hachyderm.io avatar

Nested loops can sometimes be replaced by one itertools.product() from the #Python stdlib:

nedbat, to random
@nedbat@hachyderm.io avatar

Achievement unlocked: found a bug in https://coderpad.io during a coding interview!

Run this Python 3 code:

for l in range(70, 80):
line = (f"{l:2d}: " + "0123456789" * 10)[:l]
print(line)

Why are lines 72 and 73 the same? Where are the "8"s in lines 73 and up?

nedbat,
@nedbat@hachyderm.io avatar

@geos The bug is in the output pane in the picture: the character "8" is in the position where the text wraps, and it is not displayed.

nedbat,
@nedbat@hachyderm.io avatar

@eichin It's the output panel. On Firefox, the 8 is missing where the lines wrap. Font size doesn't seem to matter. On Chrome, the 8 is present.

nedbat, to python
@nedbat@hachyderm.io avatar

Are you sure you know how #Python decorators work? This should be no problem! 😈 🤯 🤓

e_nomem,
@e_nomem@hachyderm.io avatar

@nedbat It took me a moment to remember that the execution happens at load but yeah, you can do some pretty bonkers stuff with decorators.

brohrer,
@brohrer@recsys.social avatar
nedbat, to random
@nedbat@hachyderm.io avatar

Why when I go to my bank's web site is there a "Log Out" button displayed, but then when I click on my account, it asks me to log in?

nedbat, to random
@nedbat@hachyderm.io avatar

One open question in dribbling blog posts for decades: how to highlight the "evergreens" that could be useful into the future?

An attempt: I made a page of "Frequent Python questions" that inspired some of my often-referenced posts over the years:
https://nedbatchelder.com/text/pyfaq.html

uriy,
@uriy@hachyderm.io avatar

@nedbat These are great! In particular I wish I'd read "Why your mock doesn't work" a while back, instead of using a more head-banging and swearing based approach.

nedbat,
@nedbat@hachyderm.io avatar

@llimllib Thanks this piece is interesting both for its content and its form(!). It is easily the most elaborately structured and formatted "blog post" I have seen. It's addressing a slightly different problem than mine: he's talking about how to alert people when a post has been substantially updated.

nedbat, to python
@nedbat@hachyderm.io avatar

New blog post: One way to fix circular imports.

There are better ways, but sometimes simply changing the form of the import statements can untangle the problem:

https://nedbatchelder.com/blog/202405/one_way_to_fix_python_circular_imports.html

Bleyddyn,
@Bleyddyn@mastodon.nz avatar

@nedbat Even without the circular import issue, I prefer the “import module; module.attribute” style because it tells me where that attribute/function came from without me having to look it up.

nedbat,
@nedbat@hachyderm.io avatar

@Bleyddyn Yes, another reason to prefer it.

nedbat, to random
@nedbat@hachyderm.io avatar

Small fix to watchgha: don't truncate lists at 30 items (oops!)
WatchGHA reports on GitHub Action progress in a terminal UI.

https://pypi.org/project/watchgha/

nedbat,
@nedbat@hachyderm.io avatar

@sashk Hmm, good point. I doubt "deployment" only because I've never used any aspect of GitHub's "deployment" stuff.

nedbat,
@nedbat@hachyderm.io avatar

@sashk Do you mind testing this doc update? https://github.com/nedbat/watchgha/commit/b84b61c3efbf782167d495d3af65eaa40f409662

"No authentication is needed for public repos. For private repos, OAuth or
classic tokens need the repo scope, and fine-grained tokens need the
"Actions (read)" repository permission."

nedbat, to python
@nedbat@hachyderm.io avatar

The joy of trying to be on the cutting edge of :

HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/
'Programming Language :: Python :: 3.14' is not a valid classifier.

henryiii,
@henryiii@fosstodon.org avatar

@nedbat @SnoopJ IMO you should not add a classifier till beta 1. A classifier states you are testing on a particular version of Python and things can dramatically change and break up till beta 1, at which point it’s stable minus bugs and-or emergency removals. It’s great to test on alphas/main, but I wouldn’t consider it a valid classifier until beta 1.

nedbat, (edited )
@nedbat@hachyderm.io avatar

@henryiii @SnoopJ I'll compromise with you: no classifiers until alpha 1. No wheels until release candidate. https://github.com/nedbat/coveragepy/commit/242adea66966b941d2e62bd261652b14f0c88e95

nedbat, (edited ) to random
@nedbat@hachyderm.io avatar

I was a guest on the TeenCast podcast made by /r/teenagers. Mostly I said, "find your tribe," "don't listen to the haters," and "things will change" a lot, but it was a fun chat. The audio lag is strange in the recording: I swear I was not talking over the hosts like it seems in the recording!! :)
https://www.youtube.com/watch?v=QaEQHq2X8aM

nedbat, to random
@nedbat@hachyderm.io avatar

At the same time that bad-faith "pollers" are asking about #PyConUS masking, the attendee survey asks about it as well. But that survey only goes to attendees, meaning people put off by the requirement this year will not be asked. How do we get a complete view of the entire population of potential attendees?

boxed,
@boxed@mastodon.social avatar

@nedbat Calling other peoples actions "bad faith" seems like not a good way to start an honest discussion.

nedbat,
@nedbat@hachyderm.io avatar

@boxed I'm happy to have an honest discussion. Did you see the poll? It asked a question, then he started abusing people who voted one way. "You are blathering", "that is BS", etc. Then he deleted the poll because it wasn't going his way.

nedbat, to random
@nedbat@hachyderm.io avatar

@andreasjung It seems like you started this poll in bad faith. You have a clear opinion on the subject. You were not looking for opinions from people, you were trying to start arguments.

treyhunner,
@treyhunner@mastodon.social avatar

@nedbat @andreasjung ☝️ this

I was considering suggesting more poll options to drill into the likely policy opinions and reasoning a bit more in 4 poll options rather than a simple yes/no, but after reading Andreas' replies realized this poll lacks nuance on purpose. ☹️

hugovk,
@hugovk@mastodon.social avatar

@treyhunner @nedbat @andreasjung Certainly looks bad faith when the Mastodon poll is deleted (79% yes, 66 votes) but not the one on Twitter (33% yes, 3 votes)

Twitter: Pinned Andreas Jung @_andreas_jung 8h @pycon 2025 should/must have a masking mandate (if the situation is comparable to 2024)? @thepsf Yes 33% No 67% 3 votes. 6 days 15 hours left

nedbat, to random
@nedbat@hachyderm.io avatar

It's impossible to sum up . But i wanted to note a few things, including yet another appearance of Sleepy Snake: https://nedbatchelder.com/blog/202405/echos_of_the_people_api_user_guide.html

  • All
  • Subscribed
  • Moderated
  • Favorites
  • anitta
  • InstantRegret
  • mdbf
  • ngwrru68w68
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • osvaldo12
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • DreamBathrooms
  • JUstTest
  • tacticalgear
  • ethstaker
  • modclub
  • cisconetworking
  • tester
  • GTA5RPClips
  • cubers
  • everett
  • megavids
  • provamag3
  • normalnudes
  • Leos
  • lostlight
  • All magazines