4 points

PyPy exists. (This is news to around 95% of the community.)

permalink
report
reply
7 points

I forget where I originally found this and Google on my phone was unhelpful.

My favorite annoying trick is x -=- 1. It looks like it shouldn’t work because that’s not precisely a valid operator, but it functions as an increment equivalent to x += 1

It works because -= still functions are “subtract and assign”, but the second minus applies to the 1 making it -1.

permalink
report
reply
12 points

If you’re on Linux (or Mac), add an alias to your .bashrc:

alias activate="source env/bin/activate"

Now you can activate your venv by just running activate in the project root!

permalink
report
reply
2 points

Very nice, now acti in my rc.

permalink
report
parent
reply
13 points

If using pyenv to support multiple python versions, when creating venvs, make sure to pass --copies to it.

% python3 -m venv venv --copies

Ordinarily, venv uses symbolic links back to the current version of the python binary. A lot of tools and IDEs don’t traverse symbolic links. That flag actually copies the real binaries over to the venv.

This avoids a metric ton of hard-to-diagnose misery later on.

permalink
report
reply
2 points

Yeah, I wish I knew this about a year ago. Thanks.

permalink
report
parent
reply
6 points

import antigravity

permalink
report
reply
2 points

Uiii, I’m flying!

permalink
report
parent
reply

Programming

!programming@programming.dev

Create post

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



Community stats

  • 3.9K

    Monthly active users

  • 1.7K

    Posts

  • 29K

    Comments