24,628 karma · joined Oct 21, 2019 (7y ago) · 5,512 submissions
https://www.bitecode.dev/
Email: contact at bitecode.dev
comment 6y ago · link · parent
There is a huge number of combinations possible, especially once keywords come into play. I don't think that's the limitation.
On big limitation is that people that are good at creating dynamic languages are bad at creating strict ones, and vice versa.
You can see in a comment bellow than some people talk about swift, Raiky, kotlin like solutions to this problem (as I mentioned in my post it would happen). But of course, they don't have the I/O solution Haskell has, the borrow checker rust has, nor the agility or signal/noise ratio of Python. They have a compromise. A compromise that can be good. Those languages are well designed. But it's not "the ultimate solution", because the don't navigate any end of the spectrum.
comment 6y ago · link · parent
This is the sane way of looking at it.
We noticed that a lot of tasks were not worth the trouble of ensuring correctness, and so dynamic languages too over.
But then a lot of system scaled to a point complexity was hard to manage. And those system had huge economic impact. Which made perf and correctness valuable again, especially since they had a lower price of entry.
I do a lot of Python, usually with dynamic types and mixing IO everywhere. It works surprising well for a ton of cases, and can scale quite far. But I recently wanted to make a system that would provide a plugin system that included a scriptable scenario of input collection that would be chained up to a rendering of some sort. This required to disconnect completely the logic of the scenario - controlled by the 3rd party dev writing it - from the source of the input, and to make the API contract very strict.
It was quite a pleasant experience, seing that Python was capable of all that. Type hints work well now, and coroutines are exactly made for that use case. You can make your entire lib Sans I/O using coroutines as contracts. The automatic state saving and step by step execution is not inelegant.
But you can feel that it's been added on top of the original language design. It's not seamless. It's not shepherding you at all, you need to have discipline, and a deep understanding of the concepts. Which is the opposite of how it feels for other more core features of Python: well integrated, inviting you to do the right thing.
I'm hoping the technology will advance enough so that we eventually get one language that can navigate both side of the spectrum. Giving you the ease of Python/Ruby scripting, data analysis, and agility for medium projects, but letting you transition to Haskell/Rust safety nets and perfs with strict typing + memory safety without GC + good I/O hygiene in a progressive way. Something that can scale up, and scale down.
Right now we always have to choose. I've looked at swift, go, v, zig, nim, various lisps and jvm/.net based products. They always have those sweet spots, but also those blind spots. Which of course people loving the language often don't see (I know some people reading this comment will want to shim in their favorite as candidate, don't bother).
Now you could argue that we can't have it all: choose the right tool for the right job. But I disagree. I think we will eventually have it all. IT is a young field, and we are just at the beginning of what we can do.
Maybe as a transition, we will have a low level runtime language that also include a high level language runtime. Like a rust platform with a python implementation, or what v-lang does with v-script. It won't be the perfect solution, but I'd certainly use something like that.
comment 6y ago · link · parent
It's just putting the original area() function in a module, not making it a method of a class. It's the simplest solution you can have, ever.
Adding an object is already more complex, and complexity needs to be justified. Just KISS if you can.
comment 6y ago · link · parent
If you really want types, use classes. It removes the need for single dispatch, creates a self documenting namespace and saves you an import when you want to do the calculation.
import math
from dataclasses import dataclass
@dataclass
class Rectangle:
length: int
breadth: int
def area(self) -> int:
return self.length * self.breadth
@dataclass
class Circle:
radius: int
def area(self) -> float:
return math.pi * self.radius ** 2
@dataclass is of course not mandatory, and just make the code shorter.We are talking about very simple things here. No need to add complexity to them.
comment 6y ago · link · parent
Don't try to code in python like you code in another language.
Also, think about what your API is conveying. Overloading may make it less clear.
The snippet from this article is a good example of when not to do it:
def area (l, b):
return length * breadth;
def area(r):
return 3.14 * radius * radius
Here, you have 2 functions that do 2 fundamentally different things. One is calculating an area for a circle. The other one is for a rectangle. When you have 2 different signatures, it's often a sign the process is very different, and you should signal that in your API.If you scan code using those, your brain cannot quickly parse it. It needs to process "area(), ok but of what, well, it has only x param, so I guess this is for z". The overloading gimmick has little value for the reader, but a real cost (not to mention in python it actually slows the run time)
The better solution is simply to make it explicitly 2 functions with good names:
def rectangle_area (l, b):
return length * breadth;
Or, most likely, put them in separated namespaces (using a module or a class), which does the same. import circle
circle.area(r)
It's very easy to abuse overloading because it tickles our need for refactoring. But it's a tool to solve a problem, not an end by itself.comment 6y ago · link · parent
You have millions of journals, books, music tracks, tv shows, films and video games. You have tutorials on youtube to learn new skill, such as cooking, yoga, DIY, coding, etc. You can chat, phone or email to all your relatives and friends.
You can take the opportunity to produce something, write, build, create, imagine. Even without a computer you can write or draw.
You can take time for yourself, sleep more, meditate, rest, do things slowly.
Please explain it to me, I genuinely don't understand.
comment 6y ago · link · parent
- That's assuming enough people know and care about it. You are tracked by the sensors carried by others too. And even if you are not, you live in the society built around the collected data anyway. It affects you.
- it's a twisted point of view. I should be able to enjoy the benefit of technology without having the threat of my own fellow human using it against me. This is bullying.
comment 6y ago · link · parent
comment 6y ago · link · parent
So my guess is you are fine most of the time, except if you allow other sites to embed your content in their page. In that case, you should:
- provide the embed on a separate subdomain
- remove features requiring identification if the content is view embedded: attempting to use them redirect to the real site.
Otherwise ITP will mark your domain as tracking and wipe you after 7 days if your user don't interact directly with the site.
I have a hard time deciding if it's a good thing or not.
I guess it has the potential to be mostly a good thing, provided that:
- I understood it correctly, which I'm not sure, as their wording is not clear
- It's implemented correctly. Once the deal is done, it's in the wild years, fix or not.
- It's implemented in good faith. Apple wants to promote the app store and has shown to neuter web apps in the past.
I still have a strange bad feeling about this.
comment 6y ago · link · parent
Take any century in the last 2000 years of human history, and there are files about people. For long it was sculpted or hand written. Then it was printed. Now it's digital. But it's the same thing, only the scale and speed change.
And at any point during those centuries, somewhere in the world, some entity (it doesn't have to be the gov) does bad things with those files. It's different every time. Excluding, killing, tracking, stealing, controlling... The form changes every time, but it's the same thing: abuse of those files.
It would, of course, be less of a problem if the information access was perfectly symmetrical. If anybody could access anybody's data, society would probably have a hard time for a few years, then adjust. And maybe become more fair.
But that's not what's happening. Here it just reinforces power asymmetry. And it creates incentives with huge bias that affect everybody's life.
There are three reasons why people give your answer.
1 - We had a nice run for a few decades in North America and West Europe. It's been a sweet life. And the human mind sets it as a new baseline. Now people see this as normal, and something else as the exception.
However, those decades ARE the exception. An exception that needs maintenance to preserve as best as we can.
2 - We are already pretty bad at making the connection between our misery today and the consequences of our past lifestyle, but today's information system is making it extra hard.
There are several factors for this: those in power getting really good at PR, information overload, more levels of indirection between causes and consequences, and the whole system complexity that never ceases to increase.
3 - The convenience is huge, and the price delayed
We don't get tracked for free, we get huge convenience in exchange. Plus we don't pay the price immediately, nor individually. We pay it as a society, and since it's cumulative, it's not obvious how much it costs us. It will only be painful in ... Well nobody knows when.
In fact, not only doing things right would rip us from convenience, but we would individually pay a strong price on top, right now. While seeing everybody around not doing it.
It's the exact same problem than for global warming.
Not accepting tracking is a deep and important political decision that shapes the future of our entire society. It is as important as avoiding mixing the church and the state or defending freedom of speech.
And it's also why it's not a popular view: it requires to think about what society we want to build, and not just what life we hope to have individually.
comment 6y ago · link · parent
Anybody provisioning a machine knows a little bit of bash, and most probably python. Python is way more "used all over the place" than yaml.
Worst of all, when you are a beginner, ansible yaml errors are an utter mystery.
comment 6y ago · link · parent
See, if hello world is:
- name: Hello Ansible
hosts: ansibleclient01.local
tasks:
- name: Copy '/tmp/testfile.txt' into 'hello world'.
copy:
content: hello worldn
dest: /tmp/testfile.txt
Then it would become: from icandream import playbook
pb = playbook("Hello Ansible", hosts=["ansibleclient01.local"])
with db.define_task(Copy '/tmp/testfile.txt' into 'hello world') as task:
task.copy(content="hello worldn", dest="/tmp/testfile.txt)
Instant benefits:- Python interpretter is very good at telling you error messages.
- You get an exception system, stack trace and a debugger for free
- The entire python tooling ecosystem, including full monthy IDE support, linters and formaters, is at your disposal
- Any more complex example is going to be much cleaner than the yaml version, exponentially. And no need to live in the "yaml/python module" dichotomy to keep PB clean.
- No need to reinvent the wheel. Python has elegant import, namespaces, ways to pass data around, conditionals, etc.,
- You can import Python libs. Event if it's just for declarative stuff like pendulum, appdirs..
The only cons are:
- idempotence needs to be enforced culturally. It's already the case for people writing the module behind the scene, and a good API + some warning tricks would be enough IMO.
- can't read the files outside of Python. But nobody does it anyway, and we can always let the Python files output the yaml representation if needed.
Now I don't hold my breath because it's a lot of work and the ansible community usually don't like the idea at all, and I'm not willing to do it. Fair is fair.
comment 6y ago · link · parent
It's going to help me with any of that. Can't access backup code if email is closed. Won't prevent bot from stealing the account. Won't help me with sharing the account, I'm not going to give the backup code to the person every time they need to login.
> Do you need to login to things repeatedly? I mean, sure your bank... but what else do you log out of?
Banks. Stuff for which you have several accounts on the same service (I have 11 email accounts, 4 github accounts, 3 HN accounts, 3 reddit accounts). A lot of people have at least 2 fb accounts, one official and one personal, and most of them don't know about browser containers.
> You and I use a password manager... but are they mainstream? My parents sure dont
No, and I expect they will never be. Auth is not a solve problem.
But email links are not the solution. At best, one login option, and a good way to start off.
Password auth should always be offered. It's the most neutral, balanced, resilient, privacy friendly, interoperable stuff we have for now.
comment 6y ago · link · parent
The "it must be idempotent" argument lead to putting conditional into a a language that was never meant to be, doing the whole "store" danse that could be done with simple function calls and whole lot of conventions instead of a proof tested import system.
It's calling python code behind the scene anyway, and nothing reads the playbook apart from ansible itself.
Ansible is a great tool, but I strongly believe the experience would be 100% better without learning, crafting and debugging those twisted .yml.
comment 6y ago · link · parent
- if you change your email address, or have any problem with it (oups, google has blocked you again!), you can't log in. Have been bitten by this when myopera.com closed and I couldn't access my old email. I lost some accounts.
- emails are clear text, so bots can intercept a login link and use it
- if you want to share the account with somebody, you gotta give them access to your email
- I don't want my inbox to be polluted by 15 login email every day
- using my password manager is much faster than doing this
comment 6y ago · link · parent
- jedi: https://github.com/davidhalter/jedi
- nuitka: nuitka.net/
- python language server: https://github.com/palantir/python-language-server
- pyright: https://github.com/microsoft/pyright
- pyre: https://pyre-check.org/
- and of course mypy: http://mypy-lang.org/
I don't think any of them qualify, but they may all have little pieces.
Also, if you need to analyze Python syntax, baron will help: https://pypi.org/project/baron/
Good luck.
comment 6y ago · link · parent
This assumes:
- the dev is thinking about the API
- the dev has the knowledge and experience to do it
- the dev has the resource/constraints that allow to do so
- dev has an interest in doing so
- this is a good investment for that particular project
Thinking in black and white does not make for good language design.
I'm glad Guido designed Python and said no to so many requests to make it no Python. Because he sure been pressured to.
> When you’ve worked on a sufficiently large and complex code base maybe you’ll understand.
I do.
I also understand Python projects that have a favorable cost/benefit ratio for type hints are not that many.
When you're used to hammer you see everything as a nail, and people loving a specific language feature tend to want it everywhere.
A huge number of dev in the Python community are not professional nor even experienced programmers. And a equally big number of projects have a size or a nature that makes type hint a bad value.
When you’ve worked on a sufficiently diverse project base maybe you’ll understand.