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
The vast majority of JS coders are interested in the web. A few for apps and UI in other area thanks to react native and electron. The rest is anecdotal.
There is not an entire banking industry analyzing data with JS. Biologists and chemists do not rely on JS to make their models. JS is not the de facto solution for machine learning. GIS systems are not massively scripted in JS. The cinema industry do not include JS as a core element in their rendering pipeline. No sysadmin every said "well, I know how to provision those 300 servers, I'll make a JS script". Security experts don't reach first to JS for pentesting. apt is not coded in JS. JS is not the stuff that all students will be taught in math classes. If you have a dumped csv to download from an ftp to insert in your database every night, JS is certainly not the first tool that comes to mind.
I could go on and on.
Not saying you can't do this is JS. Not saying it never happens. It's just not popular to do it.
All those tasks match some kind of user base, with different profiles, needs, skills and constraints.
comment 6y ago · link · parent
In the same way that boiling pasta is cooking.
> I strongly disagree that these different use cases imply different requirements,
But a art major student and a haute cuisine chef have vastly different needs in the way their kitchen is setup.
It just happens that Python serve the whole spectrum of user base.
You are seeing this from the point of view of a programmer. There is a enormous quantify of Python coders that are not. They don't have an IDE. Don't know what an env var is. Are not able to install dependencies. And they chose Python because it doesn't force them to.
> e.g. for separately versioned instances of the same standard library module.
How to address it properly is a different issue, and requires indeed a debate.
> Python is not unique in this at all.
Oh, but it is. See my other comment on the matter: https://news.ycombinator.com/item?id=21898070 It's very long, don't want to write that again.
> The exact same phenomenon has happened since virtually the dawn of C programming.
No. Geographers don't casually code in C. Math teachers don't have to teach it everywhere. You cannot be productive in C after 7 days of dabbling with it. And hence there is a huge number of people that will never, ever use C, or any other language, but use Python.
I wish people saying that would accompany me on my job, going from company to company all day long to witness what is really happening outside of the HN bubble. Remember, if you are on this site, you are very far from 80% of the Python coders. In fact, if you even spell "Haskell" correctly, you are in another dimension.
No one would ever mention C after that. For many, Python is way closer to Excel.
> The same thing is true for C++, Haskell, Java, Scala and many more language ecosystems.
> It’s all just application development.
Some people produce fast food. Some prepare a pick nick. Some make a banquets for a family of 30.
It's all just cooking.
I'm sorry, no, this is a misguided conclusion.
Python is the only knife I know that is popular for almost all of this different use cases of cooking, but all this different types of cookers. It makes it a special case. A very special one.
comment 6y ago · link · parent
> Same with Python. Virtually all data cleaning scripts I write rely on special scientific computing and structured data libraries.
This is the point of view of a programmer.
You would be baffle by the number of people that code daily in Python without ever having used the terminal even once. They don't install 3rd party libs. They don't know how. Sometime they use some, using the ones provided by a distro like Anaconda installed from their sysadmin 5 years ago. Sometimes they are using Python emmbeded in a another system and just script that. Sometimes they teach and there is no reason to even use anything else. There are so many use cases that are just not yours.
Not to mention a lot of people don't even have the right to install anything. They are in corporate env with firewall and security policies that give them an immutable setup for years.
> Yep, sounds pretty standard and sounds exactly like every other mainstream programming language I’ve ever used.
Definitely not.
There is no other language that have all the following characteristics combined:
- extreme popularity (exclude haskell, lisp, Ocaml, etc)
- very easy to learn and fast to be productive with (exclude c, c++, java, etc)
- ridiculous number of different ways it used IRL (exclude ruby, php, bash, etc)
- very heterogeneous user base (exclude JS, perl, c#, etc)
Python is used in banking, by geographers, in embedded systems, in movie pipeline. Several OS rely on it, the education system is using it everywhere, it is included as a scripting engine in strange systems...
Yes, you can find that some languages have similarities for some situations. But not all of them. The closest one in JS, and yet, it doesn't come close because most people use JS in one plateform: the browser. The other use cases are dwarfed by it.
You could argue with each point individually, but combined, it would be moot. Scripting in C/C++ is not popular. People don't regularly analyze their biological data in Javascript. It is not a common thing to make operating system core services in Java. C# is not even a blimp in Unix, or bash on Windows. Perl user base is dying. Lisp/Haskell/Ocaml are still niche languages after decades. Ruby and PHP never got out of the Web.
And yes, this put the language in a very odd position.
It definitely doesn't "sounds pretty standard and sounds exactly like every other mainstream programming language".
There is literally zero example of a similar occurrence in the history of programming.
comment 6y ago · link · parent
In fact, the best you are at programming, the more you are likely to ignore the diversity that exist behind other entities firewalls.
comment 6y ago · link · parent
Even in the p3 transition, the community screamed to not remove them. Did you know we removed % for a few versiond ? We had to put it back because of all the complaints.
comment 6y ago · link · parent
Granted, I apologize. It was childish.
> but creates an expression rather than a statement.
Expressions are limited in Python for the same reasons. It's the same rational that got us tone done lambdas. People code with a certain style using it, which is not the style we want to promote for Python.
> A linter rule could then be added prohibits the assignment operator, and converts all instances of it to the walrus operator.
Every time you delegate something to a linter, you fail. A good language must be a good language without 3rd party tooling. Tooling should only be a bonus. This is why we have forced indentation in Python. This is why we have namespaces and don't rely on a bundler.
> What the language creators have done instead is add a whole new operator with all new semantics, leading to all new sources of confusion. (See TFA). This is not easy to learn.
You don't learn this operator when you learn Python. Just like people don't learn about list comprehensions at first, don't use yield and code without creating a decorators for years.
Python scales down: you are productive with it without all its features. It is designed to be partially learned and still be useful. Thousands of Python devs are not coders, but scientists, geographers, finance people, etc. They know very little Python and yet, can work all day with it.
Walrus is made so that it doesn't interfere with the original design. It's something separate that you get to later.
> yet ignore the fact that the actual creator of the language was so against the addition of this operator that he saw the community’s insistence on it as reason to step down as BDFL.
That's not what happened. The bad quality of the debate is what made Guido step down. We had a huge number of new comers in the later years because of Python popularity. These people didn't learn internet from the age of mailing list, IRC, etc. They addressed the topic like others talk on Twitter: lot of noise, little content. I understand that after 30 years of doing what is basically free awesome work for thousands of people, he didn't feel like being disrespected by a horde of juniors that though they knew better.
comment 6y ago · link · parent
This is why we had Python 3 in the first place. Because text handling was such a cause of pain.
This is why we have type hints in the first place. Because big projects using Python felt let down.
And Python 3 and type hints are also a huge source of criticism (I was the first one to do so).
It's never ending. People will complain. People will be unhappy. Things, also, will be imperfect, as we are limited in resources and are submitted to many constraints. Not to mention taste and opinion, that are used to request changes.
But I'm not answering to dismiss valid concerns. I'm answering because as a very experienced Python dev, I now have a good grasp of what is due to culture, lack of experience, or a real deal.
E.G:
- := forcing parenthesis. Has not been a real problem in my experience, at least as of today.
- Packaging still more complicated that necessary. A real problem in the field (although 50% of it is a teaching problem: https://twitter.com/bitecode_dev/status/1188130895653416966).
comment 6y ago · link · parent
Because we have experience with things such as easy of learning, cognitive load, writing simple to read code, making it hard to introduce bugs...
This comment show how little experience one can have with it, and yet make a quick judgment to offer to "fix" things. E.G:
> eel free to use it in all places you’d previously use the assignment operator.”. Simple, easy to understand, easy to learn, and most importantly (though python folks might disagree, given 2 => 3), easy to adopt.
Well because in many languages, people do this:
while (foo = bar):
While they mean this: while (foo == bar):
Even experienced devs do this by mistake from time to time. It's hard for tooling to find out if you are doing something stupid or smart. Beside, you don't use tooling when you learn the language or do a quick script.Designing a language is not a 15 days job in a rush. Usually.
comment 6y ago · link · parent
E.G, calculating primes:
>>> print(list(filter(None,map(lambda y:y*__import__('functools').reduce(lambda x,y:x*y!=0, map(lambda x,y=y:y%x,range(2,int(pow(y,0.5)+1))),1),range(2,1000)))))
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]
As for the unicode caracters as variables... Remember you could do that in Python 2 ? # -*- coding: rot13 -*-
cevag "Relax"
But people don't do it. Just like they don't use "import *" everywhere, or monkey patch methods like it's going out of style the way Ruby loved it 15 years ago.Because such capabilities are restricted (one line lambda, parenthesis for walrus, not all unicode is allowed as var names or everywhere...), introduced slowly, and the community culture is to value readability, Python stays Python.
I was against the walrus personally, for the reasons you mention. But while I do see Raymond Hettinger trolling twitter regularly with his latest crazy walrus magic, in production we see no such thing.
Not to say it never happens. It does, I've seen monstrosities in the field. Like with every tech. I mean, you can start a fire with a water hose if you try hard enough.
But it's rare.
comment 6y ago · link · parent
>>> (1, 2) == (1, 2)
True
>>> (2, 1) == (1, 2)
False
If you need identity for perf: >>> (1, 2) is (1, 2)
False
If you just need the type check: >>> isinstance((1, 2), type((1, 2)))
True
It's very explicit, practical, and you can set the scale of practicality vs performances where you want. Plus: no implicit weird type conversion, only one equality comparison operator, and no hidden rules.I think it's sane.
comment 6y ago · link · parent
But even without that, I'm not saying they are comparable. I'm saying the same API will use explicit anonymous callbacks in JS and something else in Python (decorators, subclassing, protocols, generators...). I'm saying that the same API will use __iter__ in Python and something else in JS (type conversion, proxy object, explicit method call...).
E.G, this is a Python pattern you'll find in contextlib or in pytest fixtures:
@somekindofregistration
def foo():
print('code that runs before')
try:
yield
except Stuff:
print('Error handling')
print('code that runs after')
This uses Python iteration mechanism to run code at 3 different times in a life cycle.While in JS, you would pass 3 callbacks.
comment 6y ago · link · parent
Yes, this has been one of the hardest balance to find. And believe me when I tell you the community tries very, very hard. But it's a difficult problem: making the language evolves fast enough, but keeping it solid and stable. Very difficult indeed.
> Python became a language that can be really hard to read now.
Not in my experience.
My job involve going a lot from company to company. I see a lot of code, from a lot of different people.
The way people write Python hasn't change much during the last 15 years.
In fact, I'd say because of Python 3, there is less cruft all in all.
You do have a few heavy stuff. E.G: asyncio or the type hints. But how many code out there uses that ? Very little. Mostly, the code that needs it.
Which is good. This is what we want.
comment 6y ago · link · parent
I started to have fun coding in JS the day I accepted it was not Python and that I had to structure and style my code differently.
E.G: in Python you will use iteration a lot. A lot of a lot. But not so many callbacks. The reverse is true in JS.
comment 6y ago · link · parent
Of course it does.
$ echo "
> powers_of_x = [lambda x: x^i for i in range(10)]
> [f(2) for f in powers_of_x]
> " > test.py
$ pylint test.py
...
test.py:2:27: W0640: Cell variable i defined in loop (cell-var-from-loop)
...
Pylint is the most powerful linter for Python is well integrated in VSCode or PyCharm.When concerns are raised about JS, people are quick to answer you are not supposed to use it without modern tooling (Webpack + babel + typescript + eslint + lowdash...), although many devs still do.
Now, I use and teach a lot of JS, and I enjoy many of its modern features. I especially like the object destructuring, it's even better than Python's unpacking.
But objectively, you can get a very decent experience in Python without any kind of tooling. And yet, there is a lot of it if you want to up your game: pylint, black, mypy, jedi, pytest, poetry, etc.
comment 6y ago · link · parent
The first snippet is a very good example:
a := "wtf_walrus"
doesn't work while: (a := "wtf_walrus")
works.It's a fantastic design decision.
Python took a long time before getting this operator, because it's a language that favors being readable, easy to use, and above all, to learn.
But in many other languages, the very same operator is often misused as, or confused for, the operator for equality or assignation.
We, as a community, didn't want people to wonder why there are several ways to do assignation (we have this problem with string templating already). Instead, we wanted to be sure that people could ignore the existence of ":=" for some times during their learning process.
And so the decision has been taken to make is very easy to distinguish it from "=" and "==", forcing parenthesis when necessary to make it clear this is a completely different use case. Also to hint people at using it only when necessary.
If you like scripting in Python because it's so easy to go from an idea to code, it's not random luck. It's because the language is a collections of thousands of such decisions.
comment 6y ago · link · parent
But more absurd than creating a global variable if you forget "var/let/const" ? More absurd than "this" being schizophrenic ? More absurd than having no namespace for 20 years ?
That's pushing it.
comment 6y ago · link · parent
I always include an escape clause in the contract in case they forgot to mention something very important that change drastically the price.
I also never quote the entire project, only the first deliverables. Then roll incrementally from that.
Most contractors around me are well paid, it's not a big deal to not be accurate at the begining. We adjust on the way.
comment 6y ago · link · parent
Yes, I'm actually saying exactly that in:
> [a good contractor will] not give you answers right away, especially deadline and price. I can take several (sometimes billable) hours up to several days with a customer to understand the project and assess this.
comment 6y ago · link · parent
If you have $10k dollar, you may have to choose between the one click build process and some features or documentation.
Regular audits and updating list of risks have a cost and affect the deadline.
Change the team regularly ? Do you know the cost of introducing anyone new even to the best made project ?
What if you are an individual ? What if you are a start up ? What if you are a small company or an NGO ?
I'm not saying those are not good to have.
But I would put much more simple and basic things prior that. Nobody has unlimited time and resources.
comment 6y ago · link · parent
Do not pay by day/hour if you can avoid it.
Define small deliverables then objective tests to validate them and attach fixed price to each piece.
You don't have to come up with it out of thin air, the contractor is supposed to do that with you.
You don't have to define all of them up front neither. In fact, they will probably change during the project and the contractor will adjust the price knowing better about the project after the first few deliveries.
Do not let the definition of success be blurry. But don't set everything in stone.
Do include a clause about the code license.
If you have zero IT skill, get the help of somebody who does to do so, as well as set your expectations and filter the contractors. Sometimes it's best to hire a contractor... to hire a contractor. I know, I know.
In my book, a good contractor will:
- not sell you the moon, but will tell you what's possible, what's not given your constraints, and the relative cost of it. I regularly tell my customers to chose a better, cheaper solution than hiring me.
- help you set a priority list rather than a schedule. I'm not an oracle, I can't give you an exact delivery date for each component. But I will make sure we get them in the most valuable order.
- not give you answers right away, especially deadline and price. I can take several (sometimes billable) hours up to several days with a customer to understand the project and assess this.
- will tell you honestly "I don't know", "I will have to look it up", "It's not in my skill set, I'll need the help of X". I may tell a customer I'll need a designer, and a week to research a topic before starting to code.
- communicate clearly. Bad communication is a red flag. There are very good coders that are bad at communicating. As a contractor I don't just code, I extract your needs, wants and constraints to adjust the work regularly. This is what "agile" mean. Not tooling, scrum, or other gimmick. Regular proper communication, and adjustments.
- will not talk about good and bad, but cost/benefit ratio. You can request everything you want, the question is can I build it under your conditions.
- will talk about his preferences and specializations and advocate them when relevant. But will understand if a different technology is needed for the job. I love Python, and will advise you to use it. I don't like JS. I will code in clean proper JS for a Web UI.
- will be honest about their needs: schedules, payment, communication, ethics, channels or technology use. E.G: I don't do military/banking related contracts and refuse missions that use some languages such as Lisp, Haskell or PHP. You have the right to want them, there are other contractors that will do it for you just fine.
- not be cheap. Well, just like with lottery, you may be incredibly lucky. But I would not base my life choices on such hopes. I'm often booked for months in advance and know the market prices I can expect. I won't bother negotiating.
- will be interested in your project itself. Even when I don't work on something, I'm always happy to hear about what the project became 6 months later. I like my job.
You are not committed to anything until you sign something. So go shopping. Change your mind. We are used to talk to many customers, and only land a few jobs. That's also why we are expensive: we include that in the price tag.
comment 6y ago · link · parent
I kept at it because, although he kept being very rude (he was so with everybody), he made sure I was part of the team from day one. When we had lunch and I had no money, he always paid for me so I could eat with everybody at the restaurant. When we had extra pay for being on call during nights and week end, he included me in the rotation, despite perfectly knowing I would just wake him up to solve the problem as soon as the phone rang.
We are still friends to this day, and I came back working with him several times after my internship.
He is still an annoying SOB though.