Better HN
topnewbestaskshowjobs
Log inSign up

BiteCode_dev

24,628 karma · joined Oct 21, 2019 (7y ago) · 5,512 submissions

I write to save you time and effort when dealing with Python:

https://www.bitecode.dev/

Email: contact at bitecode.dev

Submissions

comment 3y ago · link · parent

But when is it going to make regex obsolete? :)

comment 3y ago · link · parent

Yes I would.

Purpose has a very specific definition.

comment 3y ago · link · parent

I use my keys to open my amazon packages.

But keys are still made to open doors.

comment 3y ago · link · parent

Guns have only one purpose: physical combat. Either commit it, or, hopefully, prevent it.

Blades and encryption main purposes are not physical combat. Blades are mostly use for cutting material we use in our daily life, encryption is mainly use to hide communications.

I don't agree with Brazil move, mind you. Flippers are not dangerous to the point I would consider seizing them a priority.

comment 3y ago · link · parent

I'm not exactly on this trend, but I noticed something going into that direction:

15 years ago, I wanted the latest everything. Now I usually want the latest minus one. Python 3.11 is out? It's finally time to use 3.10. The new phone model is ready? Let me buy the one from last year.

Because it's almost as good, but a lot more reliable.

You get all the patches, all the user report, all the ecosystem support that has accumulated since then. And this has a LOT of value.

comment 3y ago · link · parent

If you code in Python, your probably should use the language as much as possible and avoid calling shell commands.

E.G:

- manipulate the file system with pathlib

- do hashes with hashlib

- zip with zipfile

- set error code with sys.exit

- use os.environ for env vars

- print to stderr with print(..., file=...)

- sometimes you'll need to install lib. Like, if you want to manipulate a git repo, instead of calling the git command, use gitpython (https://gitpython.readthedocs.io/en/stable/)

But if you don't feel like installing a too many libs, or just really want to call commands because you know them well, then the "sh" lib is going to make things smoother:

https://pypi.org/project/sh/

Also, enjoy the fact Python comes with argparse to parse script arguments (or if you feel like installing stuff, use typer). It sucks to do it in bash .

If what you need is more build oriented, like something to replace "make", then I would instead recommend "doit":

https://pydoit.org/

It's the only task runner that I haven't run away from yet.

Remember to always to everything in a venv. But you can have a giant venv for all the scripts, and just she-bang the venv python executable so that it's transparent. Things don't have to be difficult.

Finally, sometimes it's just easier to do things in ipython directly. Indeed, with a good PYTHONSTARTUP script, you don't have to import everything, you get superb completion+help, and you can call any bash command by just doing "!cmd". In fact, the result can be store in a python variable. Also you can set autocall so that you don't have to write parenthesis in simple function calls.

comment 3y ago · link · parent

Pdb comes to mind.

comment 3y ago · link · parent

If I ask why is the sky blue, telling me because blue is the color or the sky doesn't help.

comment 3y ago · link · parent

Oh, so it's for performance reason: the default choice is not the easiest, the the cheapest, and they force you to be explicit about paying the price of a reference?

comment 3y ago · link · parent

You would use an explict "&", just that &T is implicit by default.

I have to assume rust creators knew what they were doing since they are obviously way more experienced at this than me, but I still don't get it.

comment 3y ago · link · parent

I don't understand, why is "&" not the default and passing ownership something you must explicitly request ?

It seems the latter is more common than the former, and that would avoid to have to add "&" everywhere.

comment 3y ago · link · parent

As a geek, I'd love syntactic macros. As a professional, I'm instinctively lead to believe it will kill Python with a 1000 paper cuts.

2203.

PEP 638 – Syntactic Macros(peps.python.org ↗)

2 points · by BiteCode_dev · 3y ago · 1 comment

comment 3y ago · link · parent

So no dropbox, no firefox/chrome, no thunderbird, no whatsapp client, no telegram client, not git ?

comment 3y ago · link · parent

cp /boot/efi/EFI/ubuntu/grubx64.efi /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi 1>/dev/null 2>&1

cp /boot/efi/EFI/ubuntu/grubx64.efi /boot/efi/EFI/BOOT/bootx64.efi 1>/dev/null 2>&1

:D

comment 3y ago · link · parent

Not only this will speed up comprehensions (which are already faster than map/filter), but it will likely solve this annoying weird edge case with the scoping of lambdas in comprehensions.

Last but not least, since it removes the additional frame that the comprensions used be wrapped in, it will fix the way you interact with them using pdb, which has always been rough thanks to this invisible indirection layer.

I assume JIT will also appreciate the change, so let's see if pypy moves on this.

Migrating to a PEG parser opened so many opportunities for Python. I never expected we would see so many good things come out of it, after years of defending LL1 to keep the reference implementation simple. E.G: the new error messages are awesome.

comment 3y ago · link · parent

> They pay for CYA and the ability to point a finger at the vendor instead of themselves.

That's a very good point. Nobody every been fired to buy IBM is still a stong motto as ever, except for the IBM part.

comment 3y ago · link · parent

Given how terrible NMEA formats are, this is fantastic.

comment 3y ago · link · parent

Provided you hire an entire team of consultants for years until they change all your workflow to adapt to SAP/Oracle, then code specific routines for each role in your org because their tool cannot do most of what they say it does.

At this point, you have a completely custom stack that could have been developed entirely for half the price, that would run faster, without licensing cost. Money you could invest in hiring a company that will actually provide you support instead sending you interns they bill as experts.

2210.

PEP 709 – Inlined Comprehensions(peps.python.org ↗)

126 points · by BiteCode_dev · 3y ago · 17 comments

2211.

DbDeclare: Python declarative layer for db administration(github.com ↗)

1 points · by BiteCode_dev · 3y ago · discuss

comment 3y ago · link · parent

Also, abuse complaints are themselves abused so much that it's easily to want to tell the complainer to go to hell.

Running 0bin.net, we have complaints from outside of our jurisdiction, false claims, idiotic claims, DMCA used for censorship, and so on.

Once in a while we have a serious one, like CP or doxxing, so we read everything.

But honestly, our hosting is forcing us to delete so much content based of BS complaints it's tiring. And if we refuse, we have to make our case, which unlike complaints, cannot be automatized. 9 times out of 10, the hosting tells us we should delete the content anyway, and if we wait to much, proceed to cut the power cord until we comply.

I'm sure Meta does report some real website and phishing attempts, but I'm certain they also abuse their power like the GAFAM they are.

comment 3y ago · link · parent

Not what. Whom with.

comment 3y ago · link · parent

What's amazing about all it is that HP being hostile to its own customers is nothing new:

- In 2005, they had one printer that refused to print if the cartridge was past a certain date, even if full. Several also underestimated the volume of ink in cartridges and told you it was empty when not.

- In 2007, HP refused to honor hardware warranty if you install any other OS on their laptop.

- in 2010, HP refused to provide drivers for the new windows Vista for its old ScanJet scanners (linux worked fine though).

- in 2020 they hardcoded the path to the EFI of their laptop to be windows only.

That's just the examples I could easily google, I remember that HP was having one scandal every 6 months in 2000, and we didn't have twitter back then.

So if a brand has been very publicly misbehaving for 2 decades, how does it still have customers?

Well, Facebook has still a billion users. Microsoft is now considered the father of unicorns and rainbows. Oracle is still making banks, one of my biggest client just migrated to it.

So the so-called cancel culture seems very superficial to me: lots of noise, but very actual consumer behavioral change. The brands can get away with anything and thrive. Maybe they'll get a little bit of heat for a few months on social media, so what?

But the bottom line is: if you are a big company, just do whatever makes you money. You don't need reputation.

comment 3y ago · link · parent

Fresh fruit, vegetables, dried whole grain and beans, fresh meat and fish, fresh seashells, whole nuts, water.

It's not that it's hard to understand, it's just hard to stick to it.

comment 3y ago · link · parent

+1. "Let me go back to you" and "i don't know" are sentences people should use more IMO.

comment 3y ago · link · parent

The documentation doesn't, and cannot, mention how to install said dependencies for each distro and version. It is non trivial, and hand waving that is like the "draw the rest of the owl" meme.

Even if the 10 most popular distros were documented, with all their supported versions, and if it covered windows and mac versions as well, and dealt with people in corporation not having admin rights on their machine, you'd still have so many steps a human error will be more likely to be inserted than just use what I suggested.

Again showing that you are so good at dealing with complexity you are not even seing it.

The only way I could convince you at this point would be to make you train 10 different teams, of 10 different people in 10 different contexts and give you one million of dollar if after one year you come back to see that their department has this stuff streamlined.

But I can't do that so that will have to be the end of this thread.

comment 3y ago · link · parent

Pylint value, unlike flake8, is not in checking formatting but rather naming conventions, code complexity, and basic code sanity.

Do you use pylint ? If yes what are the important pylint checks you missed in ruff?

comment 3y ago · link · parent

Is ruff a good replacement for pylint yet ? It replaces flake8 well but since I use black and pylint, I don't need flake8. However, pylint does a lot so if it does replace it, even without plugins, that would be amazing.

comment 3y ago · link · parent

Of they will learn.

But instead of having to learn about how to setup python, they will spend the same time learning on how to solve their problem with python.

Given that days have only 24 hours, the latter is more attractive to a lot of people.

1
737475
184