Python Trainer & Consultant. Author of unittest.mock. PSF Fellow. A hoopy frood. Python Core Dev. GenX. Also @mfoord He/him.

Northampton, UK
Joined December 2007
Michael Foord retweeted
I want to install Linux on my vacuum cleaner. Which distro sucks the most?
118
137
19
1,348
71,016
#Python tip: Use "pass" to explicitly mean "do nothing" and "..." for "more code should go here." def consume(iterator): for _ in iterator: pass def stub(x, y, z): # Someday, I will get to this ...
6
18
3
165
9,346
Michael Foord retweeted
SIDS risk goes from 11 to 3 per 10,000 when parents sleep babies on their backs. So about 1430 parents need to sleep their baby on their back to save one baby's life, totalling *48620* hours of parental sleep lost per baby saved.
6
5
4
148
21,315
Michael Foord retweeted
84
5,182
381
36,935
1,445,764
#Python can be incredibly expressive. Here is a beautiful snippet for computing a mode from a list of unhashable, unsortable inputs. max(data, key=data.count) The running time is quadratic so only use this with smallish inputs.
2
48
4,648
Michael Foord retweeted
We are happy to release the first results of a RCT of a US program that provided $1,000/month unconditionally for 3 years to 1,000 individuals in the treatment group, with a group of 2,000 people receiving $50/month serving as the control. These are sizable transfers. 1/ 🧵
164
1,150
402
5,666
2,650,410
Michael Foord retweeted
Nate Silver
@NateSilver53819 Jun 2024
Failure to recognize the tremendous progress that humanity has made, literally billions of people lifted out of poverty, vastly longer lifespans, expansion of rights and freedoms, is probably the single biggest sign of midwitism. scientificamerican.com/artic…
286
599
113
4,615
542,457
Michael Foord retweeted
“I see you have a complex problem: it has a real part and an imaginary part.” — Richard Hamming
7
69
8
504
26,063
NumPy 2 comes out tomorrow! Pybind11 2.12 supports it (since March), Numba 0.60 supports it (I just pushed the conda-forge numba 0.60 update earlier today!), PyTorch does, CuPy does, and many more. Some don't, like TensorFlow.
6
26
1
189
38,242
11,170 deaths were registered in England and Wales, week ending 26 April 2024 (Week 17): · 9.2% lower than the expected number (1,127 fewer deaths) · 14.1% involved influenza or pneumonia (1,573 deaths) · 1.0% involved #COVID19 (113 deaths) Read more ➡️ ons.gov.uk/peoplepopulationa…
11
6
1
19
5,794
Michael Foord retweeted
There is no single British culture: some of us are compassionate and open hearted, while others like Tice are callous, mean spirited and intolerant. We are not the same.
'We want people to live in a harmonious country under a single British culture.' 'Multiculturalism has failed', Reform UK's @TiceRichard tells @NickFerrariLBC, emphasising the need to 'train up our own' to fill the gaps left by skills shortages.
7
9
41
2,447
Michael Foord retweeted
There is nothing I hate more than when I start to interact with a UI before it's done loading and shit shifts around and I click the wrong thing. I'm not a front-end guy, idk what it would take to fix this, but holy shit why is this not a priority to solve??
224
92
28
2,318
118,764
Michael Foord retweeted
#Python tip: When debugging, testing, or explaining closures, your new best friend is: >>> pprint.pp(inspect.getclosurevars(func)[0]) It is like locals() but for closure variables.
2
10
138
13,434
Michael Foord retweeted
I can't believe a paid OS needs a tool like this. Here's a GUI tool called OFGB (Oh Frick Go Back) to remove all the ads in Windows 11. It's understandable if a free OS or app needs ad support, but this is just crazy.
120
1,049
93
6,863
515,850
Michael Foord retweeted
🎉New in Python 3.11 🎉 Marking individual `TypedDict` items as required or not-required Before you had to do this using inheritance and now you can simply mark an item as Required or NotRequired:
3
3
1
34
3,733
73939133 is the largest prime number with this curious property: if you take one or more digits off the end, the resulting numbers are all prime.
34
303
11
1,822
321,648
Michael Foord retweeted
Last year 1,436 trials of all offences in the Crown Court were adjourned on the first day due to the absence of either a prosecution or defence advocate, a 20 fold increase on 2019 when 71 trials were similarly adjourned. Of those 252 were trials of sexual offences adjourned due to no prosecution or defence advocate being available while just 16 sexual offence trials similarly adjourned in 2019. It is no wonder that on average last year trials of rape defendants on bail concluded 18 months after first being charged, 80% longer than the 10 months on average it took for similar rape cases’ trials to conclude just 5 years earlier. This brought the total wait on average for a rape case with a bailed defendant to conclude from first reporting of the allegation to the resolution of a trial to on average 5 and a half years, for those cases concluding in 2023. Trial dates are now being booked for mid 2026 which, assuming those listings are not further postponed, will mean many rape cases will have waited well over 2 years from charge to completion bringing the total delay to over 7 years from police-reported allegation to case completion. Whether there will be sufficient criminal barristers left in 2026 to prosecute or defend those rape trials when their listing falls due depends on decisions by government today on funding for counsel so that justice can be done today, tomorrow and the days, weeks, months and years ahead. Rape complainants will have no choice in the matter. #FundRasso #FairTrials
Reaction isn’t a choice. A victim of rape may fight but they may equally freeze. If they freeze it’s not through choice but because their brain is in survival mode. Failing to fight off an attacker is not something that necessarily should inform our judgment about what actually happened.” Vice Chair Mary Prior KC @PriorKc in our next #CriminalJusticeMatters #podcast series, starting Thursday 9 May. In Episode 1, we will hear from a victim of rape and the harrowing ordeal she suffered as a complainant waiting for her case to be brought to trial We, the criminal barristers tasked with prosecuting and defending criminal cases, are working tirelessly in our courts to maintain fair trials and ensure that justice is done. Join us as we take a real-life journey through criminal justice - because Criminal Justice Matters. #FundRasso #FairTrials
2
43
4
55
48,281