24,628 karma · joined Oct 21, 2019 (7y ago) · 5,512 submissions
https://www.bitecode.dev/
Email: contact at bitecode.dev
comment 5y ago · link · parent
Experience helps with this.
It's a middle path as usual: naive approaches waste as much time as overenginering.
comment 5y ago · link · parent
Expr = Callable[[str]], Callable[..., Iterable[str]]]
AstNode = Expr | Callable[... ], Callable[..., Iterable[str]]]
You then don't event need to call representation() , as each node is callable. No classes needed.But my instinct tells me a node will eventually have more attributes and methods. Stuff to get parents, children, siblings, filtering and so on.
So it's probably a good call to use a class for later. Also you want to keep AstNode as a node could be an expression, a statement or a comment.
comment 5y ago · link · parent
The main concern is about intercepting messages between 2 parties or mass exploiting the history stored by the provider.
Sure, for some case, it can be important, but that's a much more difficult and rare threat model to address.
comment 5y ago · link · parent
I like the current trend of going back to renderless components as well. This way you separate the state changes from the way it looks like. Feels like each component is a miniature MVC framework with front and a back.
comment 5y ago · link · parent
Then suddenly this.
Now I'm wondering if MS hiring Guido triggered some reaction to not loose control of what is currently one of the most popular language in the world. Or something else I don't know about.
I really want to rejoice. My favorite language gets $ 350k.
Yet I can't help but be suspicious of philanthropy coming from big players. I'm getting cynical and always look for a PR, strategic investments or counter attacks.
comment 5y ago · link · parent
Use --offline to see the request but not perform it:
http --offline get google.com
GET / HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 5
Content-Type: application/json
Host: google.com
User-Agent: HTTPie/2.4.0
Pipe stuff to httpie to put it in the payload: echo "Hello HN" | http --offline get google.com
GET / HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 13
Content-Type: application/json
Host: google.com
User-Agent: HTTPie/2.4.0
Hello HN
And use http-prompt, because it's awesome: https://github.com/httpie/http-promptcomment 5y ago · link · parent
Not that it makes fast minification (which I don't care that much about, I minify only on deploy, and it's a small % of the time it takes), but it does allow for a very fast workflow in dev mode: auto reload seems almost instant even with heavy transpiling.
I only mention it because I assume people look at this articles and think about their dev process speed as well.
If you haven't, give it a try: it's from the Vue author, so it's really clean, but works with react as well.
comment 5y ago · link · parent
Things like httpie, jupyter, etc should be provided as pyz and binaries as well, not just pip installable, but python devs don't do that really often.
It's a shame, because cli tools should be black boxes, people should not have to think about the implementation. I regularly see cli python tools that output stack traces on errors, and it should not happen.
Anyway, if you want those tools to be always around, I really encourage you to grap a usb stick, and put them on there as pyz and binaries. It's always nice to have them at hand.
Here is an example procedure for both (run them in a venv).
For pyz files:
python -m pip install shiv --user # (Yes, I realize how ironic this is).
Then: python -m shiv httpie -o http.pyz -c http
(download httpie, and creates a http.pyz file that will contains httpie and all it's dependancies, plus code to trigger the http command when called)This will let you do "python http.pyz" anywhere you have a modern python and enjoy httpie without the need to pip install it.
For an exe (this is an example on linux, the commands are a bit different for windows and mac):
python -m pip install nuitka httpie --user
You need to have a C compiler and python headers around as well (gcc on linux will do, E.G: sudo apt install build-essential python3-dev on ubuntu).Then:
python -m nuitka $(which http) --onefile --linux-onefile-icon /usr/share/pixmaps/python3.xpm --follow-imports --assume-yes-for-downloads
Wait quite a bit.Now you have a nice stand alone AppImage you can call with ./http.bin to be used on any linux system, and not care if Python is installed to play with httpie.
Here are the resulting files (available for 5 days) so you can see what it looks like:
https://drop.chapril.org/download/a335a8e92f98ee02/#fHC1SvOw...
comment 5y ago · link · parent
Thank you for working on such a useful project, and so seriously.
I immediately encountered a second different error, and I'll also take the time to craft a good bug report for it.
comment 5y ago · link · parent
So careful, far from stable.
I reported it (https://github.com/frostming/pdm/issues/247) because the project is great and I want it to succeed, but I won't put it in prod any time soon. I prefer my package manager to be stable than fancy.
It's also why I don't use poetry and so on in training. There is always some bug that students will encounter later because there are so many config combinations they can encounter, but recent tools have not been as battle tested as we think: the enterprise world is a wild beast.
comment 5y ago · link · parent
The current situation is actually not that bad. With my students, the topic is quickly explained and mastered. But it's not a common occurrence.
However, it is true that it's still not as easy as it could be. Some reasons.
- Python is older than java.
- Python is shipped as part of MacOS and Linux, but using the system Python can cause issues, so it's a trap.
- Python deals with a lot of compiled extensions. Scipy embeds C, fortran and assembly. It's a hard problem.
- The Python project has *tremendously* less resources than java.
- Politics. Lots of it.
- Debian et Red Had packagers made a mess by splitting the python setup in many small packages.
- Python 2/3 transition took attention span from the problem during a decade.
- You often install many python versions on the same machine, which makes things harder.
- Python is used by a huge number of non programmers. Much more than java. This shows in the reported difficulties.
- There are way too many ways to install python. So many combinations of failure modes.
- Microsoft screw up with their store not packaging "py" or the core dev by not packaging it on Unix.
- Anaconda brings as many problems as it solves, and is popular because of enterprise limitations.
comment 5y ago · link · parent
- poetry shell didn't start the same shell that you were in: https://github.com/sarugaku/shellingham/issues/42. Looks like they fixed it 3 days ago though.
- It doesn't set the name of the project in the prompt, so you actually don't know you are in the shell. Very annoying if you have many windows.
comment 5y ago · link · parent
It's a great tool but there are reasons you might want something else.
Alternative like raw pip, pip tools, or dephell all have various pros and cons.
comment 5y ago · link · parent
It will let you bind custom Python scripts to any mouse/keyboard sequence, including words on the fly. It can trigger word replacements just like Espanso (I use it to fill in emails, dates, addresses, timestamps et phone numbers), and of course, Python being Python, it lets you do a lot more.
The UI is probably not as good as Espanso's, and it may be harder to use (you need to script). On the other hand, it provides an API for prompting you with UI to select dates, files, input, etc., has timers and the whole Python 3 stdlib.
Some nice stuff I do with it:
- typing $email/$ phone present me with a list of email addresses/phone num (I have a lot of them) to insert one. Prevents typo. By pass web form limitations.
- $now and $date does something similar with dates (listing of various formats for the current date and a calendar). Very handy for documents and file name. Most of them don't have automated fields set up.
- $paste paste the clip board content, by passing any UI preventing me to do so, and screen/tmux limitations.
- I'm a heavy dynalist users (dynalist.io/) I love this software, but it lacks a lot of features, which are easy to add with AutoKey: just make a macro that inputs a serie of actions.
comment 5y ago · link · parent
By design it's anonymous, so no account, and no tracking, hence not an obvious money maker.
But I like using it, and I feel no pressure to make it better or fix it, so I can work on it once a year and just be happy.
comment 5y ago · link · parent
Ctrl + L will focus the url bar, and then you can use several modifiers to search different things. E.G: ? will run a search engine query, even if you type something that looks like a domain name after it, such as a file anme.
comment 5y ago · link · parent
As a trainer, experience teaches me that it's also much easier for beginners.
Now, types are nice to have for bigger code bases, but that doesn't mean there is no place for a language with optional typing.
comment 5y ago · link · parent
I'd rather read a real regex using the verbose flag to comment groups:
- it shows the real regex for quick scanning and for those familiar with the syntax
- it explains things to the people that are not familiar with it or if the regex is complicated
- it forces the writer to divide the regex into logical groups
- such a system would have comment anyway, to indicate what you are matching such as "product code, date, color" for each part of the matching code.
- if you can't write or read regex and your job is programming, spending an afternoon learning them should be your next step. They are everywhere, no matter the tech stack: unix tools, IDE, 3rd party libs...
- there are plenty of regex tester UI, which let me copy the regex and test various case to see what it does, and tweak it
But I can see the value of such a lib for learning regexes.
comment 5y ago · link · parent
comment 5y ago · link · parent
I don't use whatsapp, and don't have an iPhone, so no imessage. Most people don't use Telegram or Signal which I do. Not to mention a lot of geeks have their favorite way of being contacted (slack, wire, etc).
And of course all that will have change in a few years. Before you had to have facebook. When in Asia, it was lime or something else.
As soon as you have a lot diversity in your life, text messages are the only thing that works all the time, plus they are free in my country.
In fact, iMessage is basically sending text messages without the user knowing they do if the other hand is not an Apple device.
In the end, I suspect text messages will still be here in 10 years, and all people around me asking to subscribe to yet another chat service will have change 3 times (and lose their contact list in the process).