Hacker Newsnew | past | comments | ask | show | jobs | submit | more BiteCode_dev's commentslogin

Interestingly, the author classifies python as a brown language, yet it's on the top 15 of most loved programming languages.

Now, maybe it's because for a lot of people, it's a green language since it only became that popular in the last 10 years despite being an old one (1991).

But for me it's definitely a brown language, as I've been using it since 2.4 (we are at 3.9). And I must say, reading a decade old Python code bases, even with the 2=>3 transition in the middle, is still very easy.

I went back to a project I wrote 10 years ago (first commit 2011), and the code is clear. I can make changes to it with no problem at all. And it's not even a small project, it's a streaming website that still serves half a million users a day using an old Django.

Today I'm working for a client on a FastApi project. It uses all the current modern Python gimmicks, async, typing and f-string and so on. I could get into the code base in less than a day, and make my first commit.

I know Python has the reputation to not scale, not be good for big projects or big teams, but It's certainly not have been my experience.

The upcoming Python 3.10 has been controversial because it introduce some weird choices for pattern matching. But it's the tree hiding the forest:

- it's a sign the language is still actively evolving and will not become obsolete. Legacy design decision will always make adding new features an exercise in compromises.

- 3.10 also have been focusing on not-s-sexy but oh-so-important things like improving the error messages (I'm actually very excited about this, I've followed it and it's very well done)

So I'm pretty confident it's going to stay a brown, but nice language to work with.

Not that's it perfect, the more I use other languages, the more I can see the limits of Python. But I expect it to still be a solid choice for new projects for a long time.


I'm sure somebody said something like that when all those kids started to the clever abstractions that were functions instead of doing things manually in assembly.

Simplicity!


This is just vapid snark. Of course some abstraction is helpful, but there's also a point at which abstraction impedes understanding. Ergo, we're debating where the "sweet spot" is. Note also that we can say "Go is the sweet spot for most applications" while also acknowledging that it makes certain kinds of programming difficult (e.g., writing a compiler). It's okay to recognize tradeoffs; there's no need to oversimplify or otherwise engage dogmatically.


Some developers don't want to use the ternary operator because it's "too complex".

I believe there's a middle ground to be found where further abstractions add complexity rather than reduce it. Where that middle ground is, I don't know.


That’s a strange definition of complexity. I can see people avoiding the ternary operator because the syntax is hard to read, but it’s no more complex than `if`.


> It is often best to avoid non-ASCII characters in source code. Indeed, in some cases, there is no standard way to tell the compiler about your character encoding, so non-ASCII might trigger problems. To check all non-ASCII characters, you may do [^\x00-\x7F].

Depends of the language. In Python 3, files are expected to be utf8 by default, and you can change that by adding a "# coding: <charset>" header.

In fact, it's one of the reasons it was a breaking release in the first place, and being able to put non-ASCII characters in strings and comments in my source code are a huge plus.

I mentioning this because in another article, the author said being used to code in "C++, C, Go, Java, JavaScript, Python, R, Swift, Rust, C#" so I find it kinda weird.


> It is often best to avoid non-ASCII characters in source code.

Scientists writing Julia are laughing on the floor.


Sometimes I wish COBOL style hadn't won over mathematical style as the convention for every general purpose language except possibly Go.


There are many languages pushing for mathematical style formulas, but until they get easy to type, I don't think any of them will succeed.

It's not COBOL that won. It's qwerty.


Julia makes typing unicode characters very easy; so easy that I keep a Julia repl open a lot of the time just for typing various mathematical symbols easily.

For example, to type α², you just type \alpha, hit the tab button to turn it into α, and then type \^2 and hit tab again to turn that into ².

If someone gives you a unicode character that you don't know how to type, you just hit the ? button to enter the repl-help mode and then paste the character in.

    help?> α²
    "α²" can be typed by \alpha<tab>\^2<tab>

    search:

    Couldn't find α²

      No documentation found.

      Binding α² does not exist.


The amazing thing about this UI is that it just works across many of different editors and REPLs (VSCode, Emacs, Pluto, &etc).

It reminds me of GNU TeXMacs, which has a similar interface for equations. That is, typing "\int" followed by tab will render an integral sign.


> It is often best to avoid non-ASCII characters in source code. ... >> Depends of the language. In Python 3, files are expected to be utf8 by default, and you can change that by adding a "# coding: <charset>" header.

It's interesting that many languages avoid unicode and non-ASCII text, yet they make assumptions about file and directory structures about the underlying system. It's as if interpreting directory and file system structures is "okay", but interpreting file formats is not.

> In fact, it's one of the reasons it was a breaking release in the first place, and being able to put non-ASCII characters in strings and comments in my source code are a huge plus.

Sorry, but as a Python dev that went from 2 to 3, yes native unicode features are nice, but no, it was not worth breaking two decades of existing code.


As somebody living in Europe, I think it's a perspective you can have only if you live mostly in an English speaking world.

Up to 2015, my laptop was plagued with Python software (and others) crashing because they didn't handle unicode properly. Reading from my "Vidéos" directory, entering my first name, dealing with the "février" month in date parsing...

For the USA, things just work most of the time. For us, it's a nightmare. It's even worse because most software is produced by English speaking people that have your attitude, and are completely oblivious about the crashing bugs they introduce on a daily basis.

In Asia it's even more terrible.

And I've heard the people saying you can perfectly code unicode aware software in Python 2. Yes, you can, just like you can code memory safe code in C.

In fact, just teaching Python 2 is painful in Europe. The student write their name in a comment ? Crashes if you forget the encoding header. Using raw_input() with unicode to ask a question? Crashes. Reading bytes from an image file ? Get back a string object. Got garbage bytes in string object ? Silently concatenate with a valid string and produce garbage.


> As somebody living in Europe, I think it's a perspective you can have only if you live mostly in an English speaking world.

I live in Europe and I (mostly) agree that (most) code shouldn't (usually) contain any codepoint greater than 127. It's a simple matter of reducing the surface area of possible problems. Code needs to work across machines and platforms, and it's basically guaranteed that someone, somewhere is going to screw up the encoding. I know it shouldn't happen, but it will happen, and ASCII mostly works around that problem. Another issue is readability. I know ASCII by heart, but I can't memorize Unicode. If identifiers were allowed to contain random characters, it would make my job harder for basically no reason. Furthermore, the entire ASCII charset (or at least the subset of ASCII that's relevant for source code) can easily be typed from a keyboard. Almost everyone I know uses the US layout for programming because European ones frankly just suck, and that means typing accents, diacritics, emoji or what have you is harder, for no real discernible reason.

String handling is a different issue, and I agree that native functions for a modern language should be able to handle utf8 without crashing. The above only applies to the literal content of source file.


I understand to not want utf8 for the identifiers, as you type them often and want the lowest common keyboard layout demonitor, but comments and hardcoded strings, certainly not.

Otherwise, chinese coders can't put their name in comments? Or do they need to invent an ascii names for themself, like we forced them to do in the past for immigration ?

And no hard coded value for any string in scripts then? I mean, names, cities, user messages and label, all in in config files even for the smallest quick and dirty script because you can't type "Joyeux Noël" in a string in your file? Can't hardcode my "Téléchargements" folder when in doing some batch work in my shell?

Do I have write all my monetary symbols with escape sequences? Having a table of constant filled with EURO_SIGN=b'\xe2\x82\xac' instead of using "€"? Same for emoji?

I disagree, and I'm certainly glad that not only Python3 allows this, but do it in a way that is actually stable and safe to do. I rarely have encoding issues nowadays, and when I do, it's always because something outside is doing something fishy.

Utf8 in my code file, yes please.


Lol, just realized my table should be "EURO_SIGN=b'\xe2\x82\xac'.decode('utf8')".

Damn, a perfect example of why it's nice to be able to just do "€" in my file. It's also less bugs.


If we're still talking about Python 3, you can also write,

  EURO_SIGN = '\N{EURO SIGN}'
Which is ASCII, and very clear about which character the escape is. I wish more languages had \N. That said, I'm also fine with a coder choosing to write a literal "€" — that's just as clear, to me.

While I don't believe the \N is backwards compatible to Python 2, explicitly declaring the file encoding is, and you can have a UTF-8 encoded source file w/ Python 2 in that way.

I'd also note the box drawing characters are extremely useful for diagrams in comments.

(And… it's 2021. If someone's tooling can't handle UTF-8, it's time for them to get with the program, not for us to waste time catering to them. There's enough real work to be done as it is…)


You can do Unicode in Python 2. You can do Unicode faster and easier in Python 3. But by gaining that ability, they set the existing community back by 10 years.


I wouldn't say that everything in \x00 to \x1f is OK in source code.


Eh, I reckon they’re fine.

In shell scripts especially (and sometimes elsewhere), if I want an ANSI escape code, I’ll type the actual bytes I want, because it’s more reliable and easier to type <C-V><Esc> and see ^[ in Vim than it is to worry about whether I’m using \u001b, \u{1b}, \x1b, \033 or something else, and whether I have '', "", $'', $"", printf, echo -e, &c. &c. Speaking generally, if you use the actual control characters, the code will either fail to run (parse or compile error) or work, whereas encoding your control codes with escape sequences is more hit and miss. I’ve seen quite a few others using control characters in this way too.

Truth to tell, I’m quite liberal in using all of Unicode in my source code. About the only places I wouldn’t use the actual characters are when (a) the environment requires me to escape the thing; (b) the numeric values of the characters are more meaningful than the characaters themselves; and (c) when dealing with combining characters and modifiers, because otherwise they’ll do things like combine with the opening ' from the string/character literal.


I mean, in non-strawman examples of programming languages.

The code will work, but how will it edit outside of your personal environment? Or print?

If you quote it in a PDF paper, will it be copy-pastable?

Basically I would worry about all that sort of stuff.

If I have echo '^L' to clear the screen, and that program is sent to a line printer, will I get:

  echo '
  [ paper ejected ]
  '
If you so much as "cat" your code to a terminal, all the codes get interpreted.


In Emacs Lisp it's common to to include real ^L specifically to trigger page breaks from when printing code was more common (and it has page-aware navigation commands accordingly).


Use Vite to dev, then setup a separate webpack + babel for testing and build for prod.


I've been repeating it in several threads already, and this post confirms it: if you haven't tried Vite yet, you really should. It will take 15 minutes, and if you do any Vue and/or React dev at all, it will be the best 15 minutes you ever invested in a tool.

It's fast, it works out of the box with sane default, it's fast, doc is stellar, it's fast, it support ts, jsx and sass. Also, it's really fast.

Between Vue and Vite, in 10 years Evan You is going to be known as the person who made frontend dev simple again.

(And thank you Esbuild)


This is how I feel about Svelte! If you haven’t tried Svelte with Vite yet, treat yourself to their interactive tutorial[1] and bask in its glory!

[1] https://svelte.dev/tutorial


The problem with such experiment is that it can be a front. If you are a big entity, gov, or whatever, and you need to insert a vulnerability in the kernel, you can start a "research project". Then you try to inject it with this pretense, and if it fails, you can always say "my bad, it was for science".


If you haven't already, give a try to ViteJS.

It's from the author of Vue, and support both Vue and React, including JSX and TS.

It has the qualities of Vue:

- it works out of the box

- setup and usage are super easy

- it's wicked fast

- documentation rocks

I talked about it to one of my client 3 days ago. They tried it 5 minutes and decided to spend a day migrated their project immediately.

It's that good.

And the migration took only 2 hours.


Seconding this! Went from npm/vue2/ts to npx/vite/vue3/ts and it's so much better.


It uses BT right ? So how can it be useful on luggages, like in their ad ? If someone steals it or the airport lose it, BT is of not use here, isnt it ?

Someone help me undertand, it's a genuine question.


Did you read the linked page?

"If AirTag is separated from its owner and out of Bluetooth range, the Find My network can help track it down. The Find My network is approaching a billion Apple devices and can detect Bluetooth signals from a lost AirTag and relay the location back to its owner, all in the background, anonymously and privately."

And before you fly off the handle about privacy: yes it is secure, yes it is encrypted, no Apple doesn't know where your shit is either.


Thanks for the explanation, although I could have done without the condescending tone.


My pet peeve is people asking questions on internet forums and not spending even 60 seconds trying to find out the answer for themselves.


It creates confusion since both share the word wormhole and the goal the share files.

If you still can, changing the name of your product would help a lot, and also show respect to the older FOSS project.


> agnostic

> Don't use. Instead, use a precise term like platform-independent.

Oh, FFS. I've been agnostic for half of my life and I don't know a single one agnostic that would want that.

In fact, I feel more offended that it's on this novlang manual.


I think this is about clarity rather than political correctness. Used in this context, "agnostic" is basically just a bit of jargon that's used where what we really mean is "independent". The latter is a drop-in replacement, and I'd argue that it conveys the meaning more clearly.


I can rewrite your entire documentation using clearer words than the ones you are using.

Are they going to go through the whole dictionary to eliminate all those non-double-plus-good words that are not efficient enough?

Don't you feel that it's just getting ridiculous at this point?


I'm not sure what you're getting at - if you agree with me that "independent" is clearer than "agnostic" then what's the problem? I could understand your objection if you felt that the replacement word was somehow less clear, but if it's at least as good or better then why _not_ mandate its use in a style guide?

I get the impression that most of the people who are complaining in the comments here are really getting worked up about some inferred political bias, rather than because they actually disagree with the substance of the style guide.


What I love most are the efforts spent protecting hypothetical people who may take offense and who aren’t actually there.

“Oh, you’re actually agnostic? Well, you still can’t say that word because another agnostic person may find it offensive.”


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: