Syntax highlighting in REPL as you type is big
- 0 Posts
- 42 Comments
pip
cannot install some system dependencies your library might need. Windows is extra difficult sometimes, as the library might require some paths during installation, Linux is way easier for this kind of stuff. Either you use WSL, or you follow these instructions for Windows I found by googling https://github.com/luarocks/luarocks/blob/main/docs/installation_instructions_for_windows.mdI use Mint btw
gigachad@sh.itjust.worksto Technology@lemmy.world•Python Performance: Why 'if not list' is 2x Faster Than Using len()English1·2 months agoSir, I will make sure to never bother you with a PR and my terrible, terrible code ;)
gigachad@sh.itjust.worksto Technology@lemmy.world•Python Performance: Why 'if not list' is 2x Faster Than Using len()English3·2 months agoThis is what I would come up with:
try: if len(foo) == 0: ... except TypeError: ...
There is no need to add a
None
check, asfoo
beingNone
should be considered as a faulty input. Avoiding the possibility offoo
beingNone
from the beginning using static checks or testing is of course the preferred solution. But in reality we do not work in such optimal environments, at least I can say that from the perspective of data science, where often procedural, untested code is produced that runs only a few times. But I get your point and I think both paths are viable, but I am also okay with being in the wrong here,
gigachad@sh.itjust.worksto Technology@lemmy.world•Python Performance: Why 'if not list' is 2x Faster Than Using len()English1·2 months agoI am not saying it’s better, just that I don’t like the proposed way :) I would argue that being “pythonic” has even less value than the Zen, which I quoted because it’s true, not because it is some strict rule (which it isn’t anyway).
You could argue I also need to write that extra code for the
if not
case, as I explicitly have to check if it isNone
if my program somewhere further down expects only lists.Hunting for those sweet milliseconds is a popular game in the Python community ;) if this mechanism is that important for your program, you should definitely use it, I would do as well!
gigachad@sh.itjust.worksto Technology@lemmy.world•Python Performance: Why 'if not list' is 2x Faster Than Using len()English6·2 months agoBut
None
has nolen
if not foo:
-> foo could be an empty list or
None
, it is ambiguous.len(foo)
will lead to an exceptionTypeError
iffoo
isNone
, I can cleanly catch that.It suggests I deal with a boolean when that is not the case. Explicit is better than implicit, and
if not foo
to check for an empty list may be pythonic, but it’s still implicit af
gigachad@sh.itjust.worksto Technology@lemmy.world•Python Performance: Why 'if not list' is 2x Faster Than Using len()English71·2 months agoI don’t like it very much, my variable could also be
None
here
gigachad@sh.itjust.worksto Technology@lemmy.world•AI isn’t ready to replace human coders for debugging, researchers sayEnglish12·2 months agoAbsolutely agree. I just use it for some simple stuff like “every nth row in a pandas dataframe slice a string from x to y if column z is True” or something like that. These logics take time to write, and GPT usually comes up with a right solution or one that doesn’t need a lot of modification.
But debugging or analyzing an error? No thanks
gigachad@sh.itjust.worksto Technology@lemmy.world•Not just Switch 2: ESA warns Trump’s tariffs will hurt the entire game industryEnglish24·3 months agoWhy is the European Space Agency speaking up to this topic
gigachad@sh.itjust.worksto Python@programming.dev•Python 3.13.2 and 3.12.9 now available!7·5 months agoWow, I hope you’re not connected to the web
gigachad@sh.itjust.worksto Python@programming.dev•Yes, you should use a Python venv in a container like docker41·5 months agoThis article is about Python venvs using Docker. That I wouldn’t want to pollute the base installation on my local machine should be clear.
But you can just create a venv and install everything in there, no need to create dozens of venvs if that’s what you want.
gigachad@sh.itjust.worksto Python@programming.dev•Yes, you should use a Python venv in a container like docker52·5 months agoI am not sure what you mean. Once you created a venv you can always reuse it.
gigachad@sh.itjust.worksto Python@programming.dev•Yes, you should use a Python venv in a container like docker21·5 months agoSoon, you won’t have a choice because major distros are adopting PEP 668. This will make pip install fail in the default system Python and show an error telling you to use a virtual environment.
Well, if this is true then why bother convincing people ;)
gigachad@sh.itjust.worksto Python@programming.dev•Python 3.13, what didn't make the headlines10·8 months agoWdym? It’s a text about the lesser known features and changes in Python 3.13.
gigachad@sh.itjust.worksto Linux@lemmy.ml•Phoronix: Linus Torvalds Comments On The Russian Linux Maintainers Being Delisted15·8 months agoRemoved by mod
gigachad@sh.itjust.worksto Linux@lemmy.ml•Phoronix: Linus Torvalds Comments On The Russian Linux Maintainers Being Delisted93·8 months agoIt makes no sense to discuss here.They probably follow Russia’s narrative of Europe being a puppet of the US.
gigachad@sh.itjust.worksto Linux@lemmy.ml•Phoronix: Linus Torvalds Comments On The Russian Linux Maintainers Being Delisted2721·8 months agoLol, ml. users getting wild in the comments
gigachad@sh.itjust.worksto Linux@lemmy.ml•Unable to get IP address via DHCP on HP ProLiant DL380 Gen9 with Debian11·9 months agodeleted by creator
gigachad@sh.itjust.worksto Python@programming.dev•Python 3.13.0 (final) has been released15·9 months agoNice I guess it’s time to check if my daily used libraries have stable 3.12 releases already.
I guess the free-threaded mode and the JIT compiler will be the most important features from what I read, but their significance is out of my expertise.
My absolute favorite with this update is the new REPL! It features Multiline-editing and a paste mode for easier pasting code. It also added the spaces automatically in my example.
Sometimes I want to make some quick tests on some data in the terminal without installing IPython to my environment first, this is great news!
This new error message will also be very useful for beginners and relieve StackOverflow:
AttributeError: module 'numpy' has no attribute 'array' (consider renaming '/home/me/numpy.py' if it has the same name as a third-party module you intended to import)
Nope. I am working with geodata so I need geopandas for my work. Sadly, there is no serious alternative until now. If, in the future, that will change, I am am absolutely on board giving polars a try.