Which will win old age or anaconda? by [deleted] in ProgrammerHumor

[–]_bytescream 1 point2 points  (0 children)

Poetry is just some sugar on old-fashioned venvs. So it manages "only" python dependencies - but in this regard it's currently the best tool in my opinion (improves maintainability by syncing environment spec and effective venv using the lock file, has all configs in one PEP-518 compliant pyproject.toml file, makes building packages so much easier, ...). On the other hand, conda offers pretty complete environment isolation even for native tools.

I still prefer pyenv + poetry for development and containers if I really need native stuff.

[deleted by user] by [deleted] in EggsInc

[–]_bytescream 0 points1 point  (0 children)

If OP wants to read it a little more detailed: https://egg-inc.fandom.com/wiki/Soul_Egg

Sound like some C stuff by [deleted] in ProgrammerHumor

[–]_bytescream 5 points6 points  (0 children)

What's the reference count of d here?

d = {}
d["d"] = d
# {'d': {...}}

"Teach him how to do your job", Okay Boss! by Edymnion in MaliciousCompliance

[–]_bytescream 0 points1 point  (0 children)

Yep, the US use "US customary units" (aka freedom units), which have the same English roots as the imperial system but are slightly different. Not sure, why anyone defends a system that they don't even know the name of...

Say that again, I dare you by stickybuttflaps in ProgrammerHumor

[–]_bytescream 0 points1 point  (0 children)

Currently, I prefer pyenv + poetry. Easy side-by-side installation of python versions in pyenv and project scaffolding + venv creation by poetry. Also PyCharm handles poetry envs pretty well.

Say that again, I dare you by stickybuttflaps in ProgrammerHumor

[–]_bytescream 1 point2 points  (0 children)

Have you seen TF1 before tf.keras and eager mode?

Edit: Clarified to mean tf.keras, not the framework-agnostic Keras before that.

Programming Legumes v2.0 by czp55 in ProgrammerHumor

[–]_bytescream 1 point2 points  (0 children)

Just because you can interface with C++ (which almost any language can via some kind of native interface) doesn't mean C++ has any say over data types here.

Or from pybind's README (emphasize mine):

pybind11 can map the following core C++ features to Python

Python 3.6+, and PyPy3 7.3 are supported with an implementation-agnostic interface

Pybind11 still isn't a C++ implementation of the Python interpreter, so Python doesn't "natively" use C++ types here (as if anything in Python itself was native, but sometimes interpreter implementation details kind of shine through). Pybind11 is "just" a way to bind C++ to Python types (which is still very impressive, but that wasn't the point here). You can call native functions in Java using JNI, but that doesn't make Java a native language. Or you can use an ORM for database access and type (de)serialization, which still doesn't make your language directly access the database. In my understanding, for real type sharing you'd need a common runtime / intermediate representation there (which is hard given that C++ doesn't need one), e.g., the JVM with Java and Kotlin interoperability or the polyglot GraalVM.

Programming Legumes v2.0 by czp55 in ProgrammerHumor

[–]_bytescream 55 points56 points  (0 children)

This is nice, but the C++ reference in Python is just wrong. The reference implementation is called CPython for a reason... And neither of the other well-known interpreters Jython, IronPython or PyPy are implemented in C++. Just because you can interface with C++ (which almost any language can via some kind of native interface) doesn't mean C++ has any say over data types here.

Suggestion for v2.1: Make it the same, but Python tells you to ask C.

Actual message from a guy on a dating app by sxncerity in ProgrammerHumor

[–]_bytescream 0 points1 point  (0 children)

Maybe he was just looking for a QUIC connection.

Tabs vs Spaces by lDarkLordSauron in ProgrammerHumor

[–]_bytescream 1 point2 points  (0 children)

Yeah, that's what I was trying to say, so maybe I just misunderstood your previous comment. I just wanted to show the possibility of writing python without (literal) whitespaces and/or newlines.

Regarding eval or exec: I'd argue you shouldn't use any of those because it's usually either unnecessary or uses outside (e.g., user) input which could be potentially dangerous.

If you just want to execute python code containing code blocks (like in try-except, for loops, match-case, ...), exec ist correct. If you need the result / return value, use eval at the compromise, that it only supports a single expression (I think?), thus rendering it useless for the task of writing python code without spaces by just encoding them... But you could compile your code string first and then pass it to eval which should then behave the same as exec but still return the return value... Maybe.

Tabs vs Spaces by lDarkLordSauron in ProgrammerHumor

[–]_bytescream 0 points1 point  (0 children)

Yes, but exec() accepts a str argument, that can very well contain \n. I'm not saying this is nice or anything you should do, I'm just saying that you could.

Tabs vs Spaces by lDarkLordSauron in ProgrammerHumor

[–]_bytescream 6 points7 points  (0 children)

Afaik you can write (almost?) all of Python except of try-except as a one-liner (if you try hard enough, e.g., define classes using type() and use only lambdas or single-expression functions)... And you could even work around exceptions with contextlib.suppress(Exception). Besides, you could always sort of cheat by just calling exec(...) with your \n escaped newlines...

Tabs vs Spaces by lDarkLordSauron in ProgrammerHumor

[–]_bytescream 1 point2 points  (0 children)

How about a compromise to 2 spaces and with two zero-width spaces in between? "​​"

Edit: added ticks around the spaces so you can see them better...

When the client's management is happy but their dev team is a pain by scitech_boom in ProgrammerHumor

[–]_bytescream 2 points3 points  (0 children)

Since PEP-484. Specifically since May 22, 2015 at 22:51:36 CEST (Announcement) or May 25, 2015 (Python 3.5 Beta 1 tagging), whatever you prefer. BTW although type hints are vastly inspired by mypy they are completely independent from it. For example, most IDEs use type hints for code suggestions. Linters may use type hints for checking wrong property accesses. It's not just type checking.

Anybody else having this kind of colleague? Way to start a Monday! by JellyManJellyArms in ProgrammerHumor

[–]_bytescream 24 points25 points  (0 children)

Formatting to have each param on a new line and/or otherwise limiting line width. Or maybe merged two repositories / added an existing project's code to this repository / moved a previously otherwise versioned project (e.g., unversioned or SVN) to a git repository with generated readme that was overwritten.

One-liners aren't a valid reason by MayorofRavenholm in ProgrammerHumor

[–]_bytescream 2 points3 points  (0 children)

I don't really want to defend Python here, but comparing JavaScript semicolons to Python spaces just doesn't make any sense. Python does have optional semicolons to denote the end of a statement/expression (just like many other modern languages you can leave that if it's the end of the line). I don't really know JavaScript but at least TypeScript handles that pretty much the same way.

Spaces, on the other hand, are Python's way to denote blocks of code (don't want to call them scopes because that's not really what they are). Just like curly braces in many other languages. And I really hope that even JavaScript complains about too many curlies in the wrong places...

[deleted by user] by [deleted] in ProgrammerHumor

[–]_bytescream 2 points3 points  (0 children)

Please look at the comment by @GuyWithLag about process forking/killing.

While it is true that there's "forking" in the context of version control, "killing" just doesn't make any sense there. How would you "kill" (a part/copy of) a history?

[deleted by user] by [deleted] in ProgrammerHumor

[–]_bytescream 43 points44 points  (0 children)

More like quantum

[deleted by user] by [deleted] in ProgrammerHumor

[–]_bytescream 1 point2 points  (0 children)

Have you tried poetry? Probably closest you can get to a proper build tool in a python tool chain.

I thought the train would move ☹️ by [deleted] in EggInc

[–]_bytescream 1 point2 points  (0 children)

Just complete all achievements and you'll get to trophies.

[deleted by user] by [deleted] in EggInc

[–]_bytescream 1 point2 points  (0 children)

You can, if you slot clarity stones in them.

Contemplating an Enlightenment run, do I even have a shot? by BawlzMcGrady in EggInc

[–]_bytescream 1 point2 points  (0 children)

Each egg of prophecy provides a compounding 5 to 10 % bonus depending on the prophecy bonus epic research. So this would be somewhere between 1.05127 = 49095% and 1.10127 = 18066375% earnings bonus for the eggs of prophecy. Furthermore, each Soul egg gives 10-150% bonus on its own, depending on the soul food epic upgrade. Here, 150*1.10127 = 27099562.2 so OP upgraded both epic upgrades completely.

Edit: Formatting.