Posts

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

erictleung, to opensource
@erictleung@mastodon.social avatar

food for thought when giving feedback to contributors.

the author reflects on giving feedback in OSS vs corporate.

OSS, you invest in the ppl and give lots of feedback. not in corporate.

and I like this takeaway:

> And so, I’ve learned that a person can absorb only about one piece of feedback per interaction, and then only if it’s labeled very specifically as feedback with the best intentions, and wrapped delicately in a feedback sandwich.

https://matthewrocklin.com/feedback.html

erictleung, to programming
@erictleung@mastodon.social avatar

R has fun codenames for its releases

In case you didn't know, the codenames for each release is in reference to the Peanuts comics or films

With initial research efforts from Lucy D'Agostino McGowan and Martin Monkman, I helped put the full list of R version names on Wikipedia, so that an ongoing list can be updated and referenced.

https://en.wikipedia.org/wiki/R_(programming_language)#Version_names#Version_names)

Enjoy!

erictleung, to python
@erictleung@mastodon.social avatar

for any user who needs a cheatsheet for dealing with f-strings.

it was useful to me to remember how to pad strings and align text quickly

https://fstring.help/cheat/

erictleung, to til
@erictleung@mastodon.social avatar

the source code for the Zen of Python is actually not very Pythonic!

https://github.com/python/cpython/blob/main/Lib/this.py

SnoopJ,
@SnoopJ@hachyderm.io avatar

@erictleung @hugovk the Zen was always meant to be taken as a bit humorous anyway (cf. the missing 20th principle), so this ROT-13 adds to the joke, but at some point it mutated into something more like "dogma"

https://mail.python.org/pipermail/python-list/1999-June/001951.html

hugovk,
@hugovk@mastodon.social avatar

@SnoopJ @erictleung 21 years ago someone pushed a "Simple is better than complex" commit to tidy it up a bit, but was asked to revert it the same day :) https://github.com/python/cpython/commit/d310f13cd2c321f0cca8429f611546c7888ae561

erictleung, to til
@erictleung@mastodon.social avatar

about the Jastrow illusion, where two identical train track-like items will appear different

https://en.wikipedia.org/wiki/Jastrow_illusion?wprov=sfla1

erictleung, to Baduk
@erictleung@mastodon.social avatar

"My guess is that AlphaGo’s success forced the humans to reevaluate certain moves and abandon weak heuristics. This let them see possibilities that had been missed before."

a hopeful take on what AI can do to push us to innovate

https://www.henrikkarlsson.xyz/p/go

erictleung, to python
@erictleung@mastodon.social avatar

I'm more of an R programming who uses Python when it fits better.

and being seven years late, I didn't realize the built-in Python virtual environment, venv, got deprecated in 3.6.

apparently now pyenv is recommended. I've luckily used it in the past, but set up time is variable and sometimes not as straight forward, especially on a non-WSL Windows setup.

https://docs.python.org/3/whatsnew/3.6.html#whatsnew36-venv

erictleung,
@erictleung@mastodon.social avatar

@isagalaev ah good catch! should've reread it a couple more times. trying to catch up on all these updates after being away for a couple of years is hard.

good to know python3 -m venv still works!

jamescooke,
@jamescooke@fosstodon.org avatar

@isagalaev @erictleung

Not all venv tools call "-m venv" especially those that existed before that module was in the stdlib (at py3.3 I think).

For example, Virtualenv uses its default "builtin" creator and does not call "-m venv".

See https://virtualenv.pypa.io/en/latest/user_guide.html#creators and https://virtualenv.pypa.io/en/latest/cli_interface.html#section-creator

erictleung, to programming
@erictleung@mastodon.social avatar

Really cool to see this concise way to read text from a file in Python using the built-in pathlib module.

from pathlib import Path
line_lst = Path("to/the/file.txt").read_text().splitlines()

https://stackoverflow.com/a/71631196/6873133

cazabon,

@erictleung

Looks like you want it as lines. You can do it simpler:

for line in Path("/path/to/file").open("r"):
do_something_with_line(line)

The lines will still have their EOLs, but you can rstrip() them to get rid of it.

This also has the advantage of processing the input file in streaming fashion; it doesn't have to read the whole file into memory at once.

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