Preferences

flare_blitz
Joined 68 karma

  1. That comment sounds pretty benign to me. I also don't know why you're assuming the original commenter is male. The only person in the wrong here is you, and you're wrong twice over.
  2. And where, exactly, did this commenter say that vibe coders are "stupid and one dimensional"? Stop putting words in people's mouths.
  3. I would suggest reading this blog post from Meta, which should resolve your concerns: https://engineering.fb.com/2024/01/18/developer-tools/lazy-i...

    Regarding risks in practice:

    > Libraries such as PyTorch, Numba, NumPy, and SciPy, among others, did not seamlessly align with the deferred module loading approach. These libraries often rely on import side effects and other patterns that do not play well with Lazy Imports. The order in which Python imports could change or be postponed, often led to side effects failing to register classes, functions, and operations correctly. This required painstaking troubleshooting to identify and address import cycles and discrepancies.

    This isn't precisely the scenario I described above, but it is a concrete example of how deferred imports can cause issues that are difficult to debug.

    Regarding performance benefits:

    > At Meta, the quest for faster model training has yielded an exciting milestone: the adoption of Lazy Imports and the Python Cinder runtime. ... we’ve been able to significantly improve our model training times, as well as our overall developer experience (DevX) by adopting Lazy Imports and the Python Cinder runtime.

  4. This is already addressed in my comment above.
  5. That’s not what I said. Nobody is “entitled” or “not entitled” to hold certain opinions. Please reread my original comment carefully.
  6. The issue is that some imports can be made lazy and some cannot. A binaristic all-or-nothing approach does not address the issue. (I also think that there is zero basis to claim that adding such a flag is trivial, since there’s no reference implementation of this flavor of lazy imports.)

    What if we have a program where one feature works only when lazy imports are enabled and one feature only when lazy imports are disabled?

    This is not a contrived concern. Let’s say I’m a maintainer of an open-source library and I choose to use lazy imports in my library. Because I’m volunteering my time, I don’t test whether my code works with eager imports.

    Now, let’s say someone comes and builds an application on top of this library. It doesn’t work with lazy imports for some unknown reason. If they reach for a “force all imports” flag, their application might break in another mysterious way because the code they depend on is not built to work with eager imports. And even if my dependency doesn’t break, what about all the other packages the application may depend on?

    The only solution here would be for the maintainer to ensure that their code works with both lazy and eager imports. However, this imposes a high maintenance cost and is part of the reason why PEP 690 was rejected. (And if your proposed solution was “don’t use libraries made by random strangers on the Internet”, boy do I have news for you...)

    My point is that many things _will_ break if migrated to lazy imports. Whether they should have been written in Python in the first place is a separate question that isn’t relevant to this discussion.

  7. No, the point is that most people in this thread do not appreciate the complexity of implementing lazy imports. If you disagree, your energy is better spent talking to a CPython core developer about implementation details of making baseless assertions from an ivory tower.

    There are many people here who think enabling lazy imports is as simple as flipping a light switch. They have no idea what they're talking about.

  8. "Talk is cheap. Show me the code."
  9. I also hope this proposal succeeds, but I'm not optimistic. This will break tons of code and introduce a slew of footguns. Import statements fundamentally have side effects, and when and how these side effects are applied will cause mysterious breakages that will keep people up for many nights.

    This is not fearmongering. There is a reason why the only flavor of Python with lazy imports comes from Meta, which is one of the most well-resourced companies in the world.

    Too many people in this thread hold the view of "importing {pandas, numpy, my weird module that is more tangled than an eight-player game of Twister} takes too long and I will gladly support anything that makes them faster". I would be willing to bet a large sum of money that most people who hold this opinion are unable to describe how Python's import system works, let alone describe how to implement lazy imports.

    PEP 690 describes a number of drawbacks. For example, lazy imports break code that uses decorators to add functions to a central registry. This behavior is crucial for Dash, a popular library for building frontends that has been around for more than a decade. At import-time, Dash uses decorators to bind a JavaScript-based interface to callbacks written in Python. If these imports were made lazy, Dash would break. Frontends used by thousands, if not millions of people, would immediately become unresponsive.

    You may cry, "But lazy imports are opt-in! Developers can choose to opt-out of lazy imports if it doesn't work for them." What if these imports were transitive? What if our frontend needed to be completely initialized before starting a critical process, else it would cause a production outage? What if you were a maintainer of a library that was used by millions of people? How could you be sure that adding lazy imports wouldn't break any code downstream? Many people made this argument for type hints, which is sensible because type hints have no effect on runtime behavior*. This is not true for lazy imports; import statements exist in essentially every nontrivial Python program, and changing them to be lazy will fundamentally alter runtime behavior.

    This is before we even get to the rest of the issues the PEP describes, which are even weirder and crazier than this. This is a far more difficult undertaking than many people realize.

    ---

    * You can make a program change its behavior based on type annotations, but you'd need to explicitly call into typing APIs to do this. Discussion about this is beyond the scope of this post.

  10. > Using `importlib` is a horrible hack that breaks basically all tooling. You very very obviously are not supposed to do that.

    This is an assertion that has absolutely no reasoning behind it. I'm not saying I disagree; I'm just saying there is a time and a place for importlib.

  11. Perhaps I'm not aware of the intricacies of Zig or AWS Lambda, but what is this library supposed to provide? It is well known that services written in two different languages can communicate with one another over HTTP (or TCP, or UDP, or whatever protocol we need to use to call into an AWS Lambda function).
  12. And your basis for saying this is...?
  13. The fact of the matter is that Slack knew they were a nonprofit and made the deliberate decision to engage in the SaaS equivalent of rent-seeking. This is honest engagement, and given the circumstances I think people in this thread have been incredibly charitable.
  14. I can think of at least a dozen explanations less charitable than this one. Taking their word exactly at face value is not “something in the middle”.
  15. No, I’m pretty sure Slack was never a “not for profit” company. Most not-for-profits do not ambush their customers with $250k bills on a week’s notice. I’ve seen debt collectors less predatory than this.
  16. There is about as much ownership here as a squatter in a two-bedroom apartment. They are apologizing because they got caught, not because they genuinely believe they messed up.
  17. > This was a mistake.

    This looks extremely deliberate to me. Are you seriously suggesting that one of your sales reps accidentally demanded $250k from a bunch of teenagers?

  18. That's a lot of buzzwords to say that you enjoy shoving everything in one function. :)
  19. Thanks for posting. I like the concept but ran into several showstopping bugs. I clicked on the "Start Interview" button and received a "No response from Gemini" error. When I exited the interview, it said that I had used all free interviews and suggested that I upgrade to Premium for $5 a month.

    With all due respect, why would I pay $5 a month for something that self-implodes as soon as I hit one button?

This user hasn’t submitted anything.

Keyboard Shortcuts

Story Lists

j
Next story
k
Previous story
Shift+j
Last story
Shift+k
First story
o Enter
Go to story URL
c
Go to comments
u
Go to author

Navigation

Shift+t
Go to top stories
Shift+n
Go to new stories
Shift+b
Go to best stories
Shift+a
Go to Ask HN
Shift+s
Go to Show HN

Miscellaneous

?
Show this modal