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

I hear that quite often, but up to now, I haven't seen it translate in the field.

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.


I have seen someone who could program, but was a non-programmer, try to learn Python for testing purposes, using a testing framework that did all sorts of magic with decorators, magically deciding what to call your function with based on what parameter names you gave your callbacks, etc. It was awful.

That was when I officially stopped recommending Python as a new language. It's just got too many things to explain now. And too many of those things to explain are like decorators, which requires two explanations, one to explain what it looks like they are doing when you use a decorator prepared by someone else, and a second explanation about what they are actually doing if someone ever wants to write one of their own.

It looks like "x.y" resolves the "y" value out of the instance, but actually, it's this complicated thing so that properties and other things work. It looks like the for loop simply ranges over the list, but it's actually this thing with iterators. It looks like calling this function "yields" a list but it's actually this magical thing where using a "yield" in the function body completely and non-locally changes the entire function. It looks like....

When Python was new and the list of this "it looks like..." was short, it was kinda need to be able to override __getitem__ for certain useful effects and such, but stacking on more and more of these with every release has created a real monster of comprehension.

Now it feels like Python has raised "it looks like... but actually..." to a design principle.

It looks like the match operator simply takes the argument you give it and sees if it is the same "shape" as the case statements, but it actually consults a new magic class variable and has this logic and that logic and....


> using a testing framework that did all sorts of magic with decorators

This seems a little unfair. Testing frameworks are notorious for pushing the envelope of language constructs and weird introspection tricks. And if in this case you picked an exceptionally ripe example I'm not sure that should reflect on the entire language.

Back in the day people used to use the baroque nature of some frameworks such as Zope to bash Python but Zope was an outlier. There will always be some gorgonzola in any ecosystem.


> And if in this case you picked an exceptionally ripe example I'm not sure that should reflect on the entire language.

I'm not sure i agree entirely: regardless of whether we're talking about decorators/annotations in Python/Java/.NET/... in the context of testing/web/... frameworks, any and every of those combinations have only caused me pain and headaches.

While i do agree in principle that it's nice to abstract away code with something that annotates a method and gives it additional meaning, in practice this sort of indirection usually has something to do with dynamic code calls, reflection or whatever the idiom is called in any particular language. All of those feel harder to debug and more brittle than just writing 3 lines of code instead of 1 annotation/decorator.

The problem with that, is that it's usually:

  - hard to make your own decorators/annotations (especially if you want to extend their functionality)
  - hard to introduce state, dependencies and just get them working nicely with the rest of your codebase and IoC/testing frameworks, or pass data between the logic behind them (from one decorator/annotation to another)
  - hard to use them, as opposed to your "regular mode" of writing code, IDEs won't offer many refactoring options
  - hard to debug them, especially in the case of wanting to examine their internals and use breakpoints
To me, it just generally seems like someone is trying to tack on functionality in ways that are hard to utilize, as opposed to just writing code in the first place, the very same thing that you see happen with generics, deeply nested inheritance and other "tricks" which are supposed to make one's life easier but do the opposite in practice in many cases.

Personally, i enjoy libraries like Typer (https://typer.tiangolo.com/) for Python and think that it has plenty of use cases, but i've been hurt far too many times by similar functionality in non-trivial cases in every single language that i've used that supports something like that, so at best i'm guarded about utilizing them.

Java rant: But perhaps that's just because Java is a major source of pain for me in that regard. To give you a concrete example: i'm migrating Spring to Spring boot and someone used Jersey instead of RESTEasy as their JAX-RS implementation and now i need to transpose hundreds of API endpoint definitions (for example @GET to @GetMapping with bunches of parameters). If it were just Java code, i could probably use some clever refactoring in it with the help of my IDE, but now i'd have to figure out where the annotations come from, create a stub to replace them, call the proper stuff from within them and hope it works, unless the reflection that's used by them breaks. Not only that, but debugging is kind of hard when the source code and the actual logic behind said annotation is hidden below dozens of layers of Eldritch indirection and you have no chances of feasibly finding all of that stuff out.


What was the name of the framework?


> My grip is actually the contrary, many python code bases are stuck in the past.

From the outside looking in the Python community seems aggressively anti reworking their code to adapt to new language features. The 2 to 3 debacle comes to mind when compared to other languages, like JS, which made a much bigger change and everyone jumped in it and rewrote their code to adapt, or Ruby which went through some backwards incompatible changes at the same time as Python.


I don't think there has been a non-backwards compatible JS change in a very long time. They even named the array flatten method as 'flat', just to avoid having a conflict with MooTools!


My point with JS is more that the JS community sees no problem and will actively rewrite vast swaths of code to use features that are not yet supported in browsers. Hence the extensive use of polyfills and transpilers. Major language changes are generally seen as a good thing (which they mostly are in JS' case).

With Python I don't get the same feeling, they seem more resistant to change in general. I don't think it's just that Python has more so-called "non-programmers" (meaning, data science and math people). Most of the libraries for these things are made by full-time programmers anyway. Perhaps the idea that "there's only one way to do it" brought about a "the current way is good enough, why rewrite in a new one?" attitude.

But anyway, I'm not familiar enough, just an outside perspective.


That would be at odd with the language style which separate statements from expressions.

You can dislike this language characteristic, but it's the right call to stay congruent.


I agree it's the right call, but boy would it be nice.


> "Seq enables users to write high-level, Pythonic code without having to worry about low-level or domain-specific optimizations, and allows for the seamless expression of the algorithms, idioms and patterns found in many genomics or bioinformatics applications. "

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.


I like it, and it's also a good example of why a framework will start to be useful if you get more complex code.

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.


I think this is a good teaching example of doing GUIs with the DOM and the MVC approach. It builds up step by step to introduce all the concepts.

https://github.com/madhadron/mvc_for_the_web


If anybody have used it, what's the benefit of it being a DSL, over, say, a regular library?


The only thing I can see in the demo code that you can't do in regular Python is the sequence literal. So `s"ACGT"` vs `Seq("ACGT")` or something. Oh, and having the Python 2 `print` instead of Python 3 `print()`.

Is there something else?


The marketing page claims to offer "up to a 160x" perf improvement to Python. No idea how though.


Numpy does that too, but it's a domain specific lib. I doubt they are speeding up real python itself.


Yes, I think is a need for some platform that provides blog+microblog on your domain, and that automatically forwards the content to social platforms so that you get the best of both worlds:

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.


> forwarding all posts to your social networks is essential.

I've been talking to businesses for years about this same thing. Using a blog as a way to broadcast to social media but keep the blog/site as the main source of information for your audience.

And it never works because it is far too simple to just use social media directly and even if you don't, your audience still comments on social media and so your discussion remains there.


> your audience still comments on social media and so your discussion remains there.

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


I got distracted by all of the other great comments on this thread and made a mess of my point.

What I was trying to say is that I think that ultimately social media will eat your traffic and blog. I think that the peril of using social media to promote your own content is that you will ultimately depend on social media.

I think that the best route to take is to find a way to promote your content without it.


It's possible, but the alternative is to depend on google for traffic, which is an abusive relationship at this point.

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.


> but on your blog, you can do whatever you want

Not if it's on a platform - see part 2 of GP's ramblings.


With your own domain name and branding, maybe we can play a different game provided the platform is willing to forward complaints to the user and step back.

After all, I'm responsible for my vps content, not my hosting. What's the difference ?


> look at the success at medium for tech writers

I feel like medium doesn't even care about tech writers -- don't people still have to host github gists for code snippets? The biggest middle finger to tech bloggers, and yet they keep flocking to the platform.


I do think the ability to do phone calls is waning, though.

I've made 4 phone calls this year: to a buddy, to my wife, to an old friend, and to my fax/voicemail provider (JConnect) which decided to terminate voicemail service on the phone number I've used since the 1990s. (So I may be part of the problem I am describing — that number didn't ring any device, it only accepted voice messages and faxes, which it forwarded to me via email.)

Of those 4 phone 2021 phone calls:

1.) My buddy no longer has voicemail on his phone, and a recording just told me he was not available and to try again later. (Head kinda exploded.)

2.) My wife also no longer has voicemail! How tf did that happen? No idea but it was 2 months after the above call so I was less surprised.

3.) My old friend is old-school (hence the phone call), and still does have voicemail — but it was full. I assume because he never checks it.

4.) JConnect support's touch-tone B.S. support system did disconnect me a couple of times, requiring that I call them back... but it did eventually connect me to a support rep who helped me cancel my account. But: only because they are the kind of asshole company that engages in the common-but-should-be-illegal practice of letting you sign up on the web but only cancel by phone, as a method of retaining "customers" who no longer want their product.

So n=1 sample, might not be typical, etc. but I suspect the phone is getting less universal and less reliable over time.


Spam's ruined phone calls, like it ruined email. No coincidence those are the two worst ways to reach me. Email's almost exclusively for receiving messages that I'm expecting from machines, now (password reset, order confirmation, whatever). It's not even any good for unexpected notices from machines, let alone communication with humans. Sure, I could migrate to another address and it'd be more usable for a while, or I could spend a Saturday crafting rules to fix my inbox, but why bother? 99% of what I care about comes in via WhatsApp or (less often) text.

[EDIT] Except for work. My work email is still sorta useful. But in part that's because it's much newer. It's also getting more and more junked up with garbage, without active management and rule-setting.


Is there anything that is getting more universal/reliable? (God it isn't Twitter, is it? I hope not.)


Those people are probably all accessible through some messaging app. But "universal" and "reliable" aren't the correct names for that.

Twitter is getting more and more universal, but reliable does not apply.

I guess no, we are living through a breaking of communications.


You should tell your old school friend that their voicemail is full. At least with my carrier, I can only have like ~20 voicemails sitting around. I listen to every voicemail I get but my voicemail inbox filled up and I didn't realize it was full for years (there was no notification or anything). To make space I had to actively go delete voicemails. Of course, deleting them just sent them to a "deleted" folder, which I had to go clear as well.


You should realize that some people intentionally allow or cause their voicemail to fill so that callers can't leave additional messages.

I certainly do. I have no intention of EVER checking my voicemail, so why would I want to leave callers with a false impression that their message will be heard?


I do this myself, but I have one person who insists on leaving messages if she can't talk to me right that second.


I agree that phone calls are waning, but I don't personally see the connection to voice mails. I never liked the concept so I've never left a voice mail, nor have I ever enabled it for myself. In my opinion voice calls can only get better if answering machines and voice mails die out.


Hmm, how do you deal with unknown numbers ?

I never answer those on the first go - only if they left a voicemail or a text message...


I live in Germany and for whatever reason I have literally never received a spam call here. I can go months without receiving a single call these days. I'm not exactly sure if spam calls are not a thing here or if I've just been lucky. But yeah I see how that can lead to different preferences when it comes to voice mail.


blog+microblog on your domain, and that automatically forwards the content to social platforms

Micro.blog does this!


Not really, it does not provide a blog feature, only a bridge.


It absolutely does provide a personal blog, you just have to pay $5/month.


I missed that, their offer tamk about wordpress.


> Of course we shouldn't attempt to anthropomorphise animal behaviour

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.


Agreed, and I really with partial() was a builtin in Python, instead of having to fetch it from functools. partial() is useful regularly, and much more explicit/flexible than a lambda for this specific use case.


Excuses accepted. Imperative Python would really look like:

    try:
        return sendEmail(user.email for user in users)
    except IsError:
        Error("Error sending emails") # if it does something
I agree FP pipelines are nice, but not everything needs it.


1 - it's sandboxed by default

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


Someone just rediscovered IBM TIMI,Amsterdam Compiler Kit EM, CLR MSIL, among plenty of others.

Sandboxing is of little help when external events can cause internal memory corruption that change module's expected outcomes.

It is as good as typical OS process.


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

Search: