News for hackers. Stuff that matters.
Re:Python-patterns – A collection of design patterns/idioms ... by adammarples on Tuesday May 31, 2022 @07:54AM (#31568499)
please, don't do any of this in your python, thanks
Re:Python-patterns – A collection of design patterns/idioms ... by kortex on Tuesday May 31, 2022 @08:11PM (#31576469)
Dependency injection and lazy_property are excellent, I use those all the time. I've used visitor on occasion. The rest? Mostly meh, some are straight up bad.
Re:Python-patterns – A collection of design patterns/idioms ... by mariorojas on Tuesday May 31, 2022 @01:05PM (#31571991)
I really feel overwhelmed.

I like coding in Python because it makes me feel free from Java stuff, but those patterns have getting me worried.

Re:Python-patterns – A collection of design patterns/idioms ... by bussierem on Tuesday May 31, 2022 @01:19PM (#31572170)
A decade of python here.

I have found that Python really can show you what other language is someone's primary language. You can write Python to look VERY Java-like, or very Ruby-like, or many others.

Idiomatic Python does not look like this generally. Another commenter hit it well that this is just badly-hidden Java code written with Python.

Python is what you make it to be; don't let this kind of stuff from random people on the internet scare you into thinking you have to use GoF and Java-like patterns and classes everywhere. You CAN, but only if those are actually _useful_ to you.

Re:Python-patterns – A collection of design patterns/idioms ... by mariorojas on Tuesday May 31, 2022 @02:20PM (#31572964)
I agree!

You know? When I feel burned out of Java, I usually write a quite simple script in Python and then, normally I get energy to complete my tasks.

I don't imagine myself struggling against the same design patterns in Java when coding in Python.

Thanks for your advice.