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
We are still paying this mistake as of today: most devs don't scope their async tasks lifecyle leading to a huge spaghetti code.
GOTOs are too easy to misuse.
We used to have only GOTOs, no loop, no if... But specialized keyword are better: they enforce a cleaner code, leverage conventions, play batter with tooling and make the whole experience easier to read and debug.
comment 5y ago · link · parent
Python has to cater to a vast crowd, and geographers don't have the same needs as data scientists, web devs, 3D artists or sysadmin.
So it's logical some tools will be useful in some cases, and not some others.
Amusingly yesterday I was doing something in JS, and though, "ah, I wish I has this new PM feature from python there".
The day before, I had to deal with pedantic exception, and wish I had a pattern matching to make a case depending of the number of errors and their message. I had to do a hacky loop for something that had to do with structure, not repetition.
Just like the walrus, I don't think it's something that will pop up everywhere, all the time. But when it is useful, it will make the code nicer.
comment 5y ago · link · parent
No. There is not a single field with " 97% of professional Python development". As a freelancer, I see python used for everything, everywhere. From education, to math, to biology, to geography, to web dev, to automation, to testing, to desktop app...
comment 5y ago · link · parent
Code examples in docs and tutorials are still easy, libs api still clean, code base still readable.
Optional things stayed indeed, optional.
My grip is actually the contrary, many python code bases are stuck in the past. But I'm ok with it, people are not all pro devs, they need a productive language subset.
And the new syntax is providing some fantastic new tools, such as pydantic/fastapi/typer (if you haven't try it, it's really paradigm shift, and I say that as a django fan). f-string are awesome. dataclasses are nothing but convenient and readable. Advanced unpacking as well. I seldom use the walrus, almost nobody does, but when one does, it's useful.
> decorators, comprehensions,
Those existed in python 2, 10 years ago. It's hardly new python. And web frameworks would be terrible without those.
comment 5y ago · link · parent
I gave it a look, and indeed it's not complete python, it will break if you start using the language/stdlib features.
Stdlib modules I couldn't import:
- sqlite3
- urllib
- pathlib
- hashlib
- json
Infra unavailable:
- Debug mode
- pip/venv
- shell
Syntax/built in that didn't work:
- byte and complex literals
- type()
- Some unpacking (E.g: [*[0]])
- raise from
- async/await
It also adds incompatible syntax that is not python, such as 's""' and '|>'.
So despite what that the README says "the vast majority of Python programs should work without any modifications", it's actually the opposite.
The project has real value though, you just need to understand that what you buy here.
comment 5y ago · link · parent
When we arrive at the CRUD widget,a simple <script> dep on petite-vue (6ko: https://github.com/vuejs/petite-vue) would half the implementation by half.
Of course it would still count as more lines of code in total, but not sure that matters.
Anyway, when I teach react/vue, I always start with the vanilla example because just like with ORM, people need to know the benefit and cost of the abstraction.
comment 5y ago · link · parent
At least if you have are on several platform, there are multiple entre points for your content. And your blog would allow you to offer things that the platform don't, like code snippets, easy media download, or something more innovative.
comment 5y ago · link · parent
Discussion should remain on social media. This avoids the problems of moderation and spam that plagued blogs.
> it is far too simple to just use social media directly
Yes to succeed the blog platform should be super easy to setup and to link.
There are benefits that can then attract people:
- if you have several social accounts, on the same or different platforms, then having a centralized way of publishing on all of them is a nice perk
- social media platform impose a lot of rules, but on your blog, you can do whatever you want. So for problematic content, you can tease on social networks, and bring people on your blog for the real uncensored thing.
- the source of truth that the blog would be is a fine touch in this era of fake news
- you can add paid sections to the blog and make money directly with your biggest fans
comment 5y ago · link · parent
1 - owning your blog is too big of a barrier of entry, there is a need for a platform: look at the success at medium for tech writers, despite that we hate it.
2 - we need the return of the domain name based blog. This helps with independence, censorship, and the like. You can always move from the platform, and the platform can claim they can't censor you since it's your domain, so DMCA should be sent to you directly.
3 - this platform should do blog + microblog. You don't always have something long to say, announcement, though and quick tips are very well suited to tweets. But only this format leads to quality deficiency. Being able to write a big article easily is equally important.
4 - forwarding all posts to your social networks is essential. Yes, your blog should be the original source (so you get ref, credit, independence and not the duplicate content ban from google). But the discovery problem cannot be solved easily, and those networks already exist.
EDIT: unrelated, but I love phone calls. I mean, I hate doing them, but I love having the ability to do them. It's a universal reliable tech, it works in the country side, it works when the wifi is down, it works well in the car, and I don't have to have the app du jour installed or insist that the other party does.
comment 5y ago · link · parent
Why not? Our behavior emerged from a primitive animal state. It's not crazy to think it can happen again.
The only mistake would be to pretend it's the definitive answer, but unless we got one, it can be one of the theories.
comment 5y ago · link · parent
That's what the --drop options is for. It's better than delay, since it drops any event while the command is running, no matter the time it took.
> First, I think for many users typing: ... is a lot simpler than typing:...
I think somebody using pytest is perfectly capable of doing:
alias ptw='watchmedo shell-command --patterns="*.py" --ignore-directories --recursive . -c "pytest" --drop'
Or putting that in a makefile, a dodo.py file or what have you.
comment 5y ago · link · parent
2 - it's the only things that also run on the web
3 - it's probably going to be ubiquitous because of that, meaning it will be a great platform to target by default
4 - it could potentially mean any platform run any code from any other one without having to deal with wrappers: you would write a lib in go or rust, and then run it as is in python
comment 5y ago · link · parent
watchmedo shell-command --patterns="*.py" --ignore-directories --recursive . -c "pytest"
As a bonus, watchmedo works for your server, your bundler, you task queue process, etc.It seems that there is no need to create one tool per command you wish to run. Or am I missing something? Do you only reload tests that are related to the code change?
comment 5y ago · link · parent
I assume the async story is going to be more fun.
By the way, if you are looking for a good key/value store with expiration without the need to setup redis, have a look at the excellent diskcache:
https://pypi.org/project/diskcache/
It is based on sharded sqlite files, and it's surprisingly capable, even in multiprocessing based env like a django site.
Sqlite is really showing up in all sort of use cases these days, like huey, a task queue that doesn't need any broker to be installed to be useful: https://pypi.org/project/diskcache/
Now things can get fun...
With supervisord (supervisord.org) you can manage multiple processes, and with fastapi + starlette, you can serve your WSGI site without a proxy pass, including static sites: https://fastapi.tiangolo.com/advanced/wsgi/
Then with shiv you can bunddle all that in a pyz file: shiv.readthedocs.io/
Meaning you can now just upload a pyz file to your server, run python on it, and that's it, you have a full stack deployed, with a web framework, db, caching, task queues, static file serving, which can handle around 100k visitor each day without a sweat.
No more infra needed. Just Python code, all bundle in one file.
That's really neat.
comment 5y ago · link · parent
But you can cache other things that are not the entire page itself:
- database queries
- user sessions
- api calls
- page fragment
- function memoization
What's more, cache backends have the ability to expire things, which can be helpful for all sort of stuff.