r/Python • • Jan 05 '18

Really??

Post image
2.0k Upvotes

317 comments sorted by

104

u/eattherichnow Jan 05 '18

Well, they got to 2nd level guru (i.e. jaded to death, checking out the grass colour on the other side) fast.

5

u/lelease Jan 05 '18

I know what you mean (been there), but is this a reference to xkcd or something?

3

u/eattherichnow Jan 05 '18

Not consciously. "Grass greener on the other side" and "jaded expert" are archetypes so classic that I'd be surprised there weren't an XKCD, PhD Comic and a (terrible, it's all terrible) South Park episode about it.

100

u/Thecrawsome Jan 05 '18

Protip: Never announce goals you haven't put any effort into.

199

u/mistaekNot Jan 05 '18

Isn’t java “harder” than python

271

u/Aruscher Jan 05 '18

Nope just more syntax clutter

496

u/WStHappenings Jan 05 '18

You call it syntax clutter, maybe I’ll call it “a greater feeling of achievement gained from writing 20x as many lines of code”

119

u/faates Jan 05 '18

Ok EA....

28

u/[deleted] Jan 05 '18

Yes! You got the joke!

35

u/[deleted] Jan 05 '18

...that runs 40 times faster - fair deal. Heh.

25

u/Timmitei Jan 05 '18

Check out Cython and Numba.

10

u/firest Jan 05 '18

Strange. I feel accomplished if I can accomplish what I want with as little lines of code as possible.

3

u/Printern Jan 06 '18

Yeah but Python forces you to write lines. In java you can code in one line One line<more than one line Dummy

4

u/Raijinili Jan 06 '18

What's stopping you from doing exec("import sys\nimport re\n\ndef someFunc(x,y):\n\t ...?

19

u/nilsph Jan 06 '18

Self respect.

2

u/KingoPants Jan 06 '18

Sanity seems important. At that point you might as well code in mspaint for the kicks.

→ More replies (1)
→ More replies (1)

2

u/firest Jan 06 '18

I stand corrected.

→ More replies (1)

1

u/[deleted] Jan 06 '18

I'll agree up to a point, but I draw the line (groan :-) when I can write a crystal clear for loop or two rather than a nested list comprehension that stresses out my poor old MKI eyeballs.

1

u/firest Jan 06 '18

I'm with you actually. Except, I will sacrifice readability for performance every time. I'm the kinda guy who uses numpy and what-not (data analysis, not to the point where I need to really on C or Fortran), so when my fans start to spin, I want to know it's for high performing code, rather than inefficient code.

38

u/Iggyhopper Jan 05 '18

Syntax is the first hurdle to learning a language, so I'd say that makes java harder.

Also, the standard library is messy.

23

u/continue_stocking Jan 05 '18

Syntax is probably the easiest part of learning how to program.

2

u/redldr1 Jan 06 '18

But shortcuts are a lifetime in the making.

0

u/[deleted] Jan 21 '18

[deleted]

3

u/continue_stocking Jan 21 '18

I can't speak to R's syntax, maybe it's particularly convoluted, but it usually doesn't take that long to pick up the important points of a language. It's a fairly straightforward thing to make a program do what you want it to. What is harder is writing simple yet expressive code that tells you what it is doing, that is reusable, changeable, and testable. Code that other people could pick up years from now, quickly wrap their heads around, and change to meet their new requirements without fear that they've broken something. I've written lots of code that did what I wanted it to, not realizing the nightmare I was in for should I ever decide to change something.

5

u/Kah-Neth I use numpy, scipy, and matplotlib for nuclear physics Jan 05 '18

It has been a while since I used Java but I seem to recall nearly every different root module adopting slightly different idioms because why not! Messy did not even begin to describe it.

3

u/2402a7b7f239666e4079 Jan 06 '18

I would argue that being verbose doesn't make the syntax cluttered. I find Java easier to read in most cases than equivalent python code.

-4

u/[deleted] Jan 05 '18

Guru status is exponentially harder to achieve without a centralized ecosystem.

→ More replies (6)

0

u/[deleted] Jan 05 '18

[deleted]

10

u/[deleted] Jan 05 '18

Why hasn't anyone mentioned object oriented yet.

→ More replies (9)

8

u/AngriestSCV Jan 05 '18

Well Java turns some errors that would be at runtime in python into compile time. It's not all bad.

7

u/[deleted] Jan 06 '18

Honestly, this is why I wouldn't want to use Python at work. We used Smalltalk for a while, and the number of times people would completely not understand what they they were supposed to be using was astounding.

I had to fix a ton of error checking in an ex-colleagues work because he never tested any of it, and we had an error class we were supposed to return when an error was identified, basically a custom exception class, but he just returned strings describing the error instead.

So, whenever anything he wrote ran into any kind of a problem, the system would throw a NotDefined error when the system tried to log his 'error'.

So, having been burned by typeless in the past, it's a bit of sticking point for me. I know it shouldn't be a problem, and of course you want to light the torches and grab the pitchforks and complain those people should be fired, but in reality it's just not that easy, and type-safety is one of those little things that just makes it easier to deal with copy-pasta programmers.

4

u/[deleted] Jan 06 '18

I completely agree. I enjoy Python and use it for the majority of my hobby projects... but if I was going to build and maintain a large and complex codebase, I would want static typing, which is why I stick to Java and other JVM-languages like Kotlin.

There's also something to be said for easy parallellism, out-of-the-box support for Unicode, simple packaging and community that agrees on standards rather than reimplementing the wheel every <arbitrary unit of time>. But I won't say that here, lest I get burned at the stake by the Python community's anti-Java zealots.

3

u/[deleted] Jan 06 '18

having been burned by typeless in the past

Please be careful with your terminology as Python is strongly but dynamically typed. I find it frightening that some folk think that static type checking is the solution to everything, when they should in the same breath state whether the type checking is weak or strong.

→ More replies (2)

1

u/Raijinili Jan 06 '18

It sounds like what you really want is static analysis, not static typing. Static analysis is more powerful with language restrictions, but there's still a lot you can get out of it for a dynamic language.

Check out https://github.com/mre/awesome-static-analysis

28

u/[deleted] Jan 05 '18

I think that's all based on your background.

9

u/TarAldarion Jan 06 '18 edited Jan 06 '18

I'm not sure what background would make Java seem easier? A Java background?

I started my Python job never having written a word of the stuff, it was like writing English to me and quite intuitive. Hell I feel if I make something up it might work in Python. I can write away in a text editor for python and that works fine, with the verbosity of Java I can't, things like that make it harder for me.

6

u/[deleted] Jan 06 '18 edited Sep 01 '24

rhythm wrong expansion wipe slimy like head versed sharp murky

This post was mass deleted and anonymized with Redact

→ More replies (3)

3

u/[deleted] Jan 05 '18

Really? I started with cpp and I still found python easier.

7

u/Jmc_da_boss Jan 05 '18

Ya writing pseudo code, i mean python is way easier than cpp or java

→ More replies (1)

3

u/kezzosc Jan 05 '18

Python is scripting so way easier

→ More replies (1)

11

u/drones4thepoor Jan 05 '18 edited Jan 05 '18

Java is strictly OO and it's also strongly statically typed, which is where Python bytes me in the ass a lot.

Edit: u/cholz corrected me. Python IS strongly typed.

17

u/SemiNormal Jan 05 '18
TypeError: Can't convert 'bytes' object to 'bites' implicitly

2

u/systemnate Jan 05 '18

That's at runtime though.

14

u/SemiNormal Jan 05 '18

What's a compiler?

  • Python

6

u/[deleted] Jan 05 '18

[removed] — view removed comment

7

u/drones4thepoor Jan 05 '18

You're right. I should have said statically typed.

38

u/weasdasfa Jan 05 '18

Java is more explicit or verbose. For experienced people, that looks like clutter (and it is, I am an Android dev), but that verbosity might be useful for people just starting out.

23

u/Deto Jan 05 '18

Yeah - I kind of appreciate that I spent a decent amount of time in a statically typed language before moving to Python. I find that way too many Python newbies don't understand what 'types' are and this leads them down the path of just trying random things until code works.

5

u/midbody Jan 05 '18

The next step is to realise that just knowing about types isn't enough when your program gets big enough. When your program is too big for your head, you need tools which robustly and unambiguously understand your types... like a compiler does.

Python is a fun toy, and good for small projects where rigor isn't important. Its leakage into large scale software engineering has been a huge retrograde step, though, caused by a lack of innovation in the field around the time it emerged as a contender around 10 years ago. Fortunately we've moved on, and I look forward to Python's death for large projects as others take over, probably Go.

5

u/TravisJungroth Jan 06 '18

I'm a huge Python nut and I basically agree. The biggest problem for me is the loss of meaning. Trying to read through a code flow in a sufficiently large code base with a dynamically typed language is a nightmare.

I do believe type hinting will help a ton, though I'm not sure it will be enough. I now write type hints into everything. I don't care if it's a single function. Having my IDE hint properly is worth it.

4

u/scootstah Jan 06 '18

Trying to read through a code flow in a sufficiently large code base with a dynamically typed language is a nightmare

Honestly, that just sounds like a badly designed application. I doubt adding strict type will make any difference to its legibility.

7

u/TravisJungroth Jan 06 '18
def func(obj):
    obj.method()

What does method() do? What other methods are available on obj? Without some sort of type enforcement, you don't have a clue without looking at the usage of func. This is fine when it's only used three times, but terrible when it's used a hundred times.

5

u/scootstah Jan 06 '18

Use good naming conventions and docblocks.

→ More replies (2)

5

u/constantly-sick Jan 06 '18

Name method() better. Try x_to_y_process().

5

u/[deleted] Jan 05 '18

like a compiler does.

Like MyPy does. You want strict typing, you can do it fine. It's done better than it is for most languages (Looking at you C#. Still waiting for nullability for everything) It's not enforced at runtime (even though runtime type checking exists, it shouldn't be needed if it passes a static type checker), it just shows errors when you fuck up.

1

u/traway5678 Jan 06 '18

What can't you null in C#?

→ More replies (2)
→ More replies (2)

1

u/scootstah Jan 06 '18

Be careful where you're spewing your bullshit, you're going to make a mess.

Python is perfectly capable of running large projects.

→ More replies (27)

24

u/Astrokiwi Jan 05 '18

It's just useful for different things. Java is definitely more verbose and has more boilerplate to write, but it's also stricter than Python and is a semi-compiled language, which means that it sometimes catches errors more quickly. It also forces you into an object oriented structure, which tends to encourage you to design your programs better rather than jamming a big list of functions into a single file.

I also find they have strengths in different kinds of applications. I tend to prefer Java for writing games (pygame isn't great), python for doing numerical analysis work (numpy and matplotlib are pretty great), and Fortran, C, or C++ for the big parallel numerical simulations.

38

u/Keith Jan 05 '18

It also forces you into an object oriented structure, which tends to encourage you to design your programs better...

Debatable.

9

u/Astrokiwi Jan 05 '18

I'm only saying that it forces a bare minimum amount of structure that Python does not.

6

u/Keith Jan 05 '18

To be fair, you wrote "design your programs better". Forcing all code, object-oriented or not, into classes, one (public) class per file, is not strictly better. It's not even a structure I want. I'd argue that "bare minimum of structure" is harmful vs no structure at all.

6

u/Astrokiwi Jan 05 '18

Maybe... I find that (for instance) the lack of required structure is what helps Javascript code to sometimes become a mess of copypasta.

And Python does force stuff on another level, by being strict with indenting. I think that's a good feature too - it's better to force one particular style than to have people use their own styles, but also permit them to make it as ugly and inconsistent as they want.

4

u/fiddle_n Jan 05 '18

Python is strict with indenting because it has to be. Indentation isn't merely "style" in Python, it's functional in that it denotes a new code block. This is why Python has to be strict with it, i.e. preventing mixtures of tabs and spaces for indentation.

5

u/Astrokiwi Jan 05 '18

Right, but that's an intentional design choice for the language - forcing good style by making it an integral part of the language.

25

u/KronenR Jan 05 '18

If not plainly wrong

2

u/hanpari Jan 06 '18

In my eyes it is rather bad design than advantage. No modern language use this anymore.

1

u/Keith Jan 06 '18

Agree. But did any other language ever force this convention?

→ More replies (5)

14

u/[deleted] Jan 05 '18

Different tools, different jobs, different uses.

Replace your computer languages with tools you'd find in a shop and see how silly the argument looks to non coders.

"Hammer is so much better than the screwdriver. And who even understands those socket wrench guys? Bunch of idiots. I'll have you know I have used my hammer as both a socket wrench AND a screwrdriver and it was just fine"

Signed: A mechanical engineer that has and continually gets to deal with: C, C++, Fortran, ADA, VB, Python 2.3-2.7, Python 3+, Matlab (R13-R2017b), Simulink, PowerShell, Batch, Perl, Bash, Sh, tcsh, PHP.

If you understand If, For, While. You'll go far in any language.

Or argue the merits of a claw hammer over a ball peen hammer.

→ More replies (2)

1

u/algag Jan 05 '18

Isn't python semi-compiled?

6

u/TheNamelessKing Jan 05 '18

Both languages are interpreted.

With Python, the source code is interpreted line-by-line into the "Python VM" bytecode and then executed.

Comparatively, Java source code is translated into JVM bytecode, and then when it's actually run on the JVM (which is a JIT compiler/interpreter) that bytecode is optimised into native instructions on the fly.

0

u/theWyzzerd Jan 05 '18

It also forces you into an object oriented structure

It doesn't force you to do OO. Yes, it is an OOP language but you can most definitely write procedural code in Java and I'd be willing to bet a novice programmer with no knowledge of OO would end up with a far more procedural application than an OO one. It doesn't force anything. Case in point, the application I support is written in Java and has very little OO structure. It's mostly a tangled mess of procedural code.

0

u/[deleted] Jan 05 '18

[deleted]

4

u/Goluxas Jan 05 '18

Last I checked it hadn't been updated in quite a while, either. Is there another Python game module that people have migrated to, or is the language just dead to game dev now?

2

u/Dogeek Expert - 3.9.1 Jan 06 '18

Python is not good for game developpment anyways. It's too slow for modern-day gaming. You can do game dev, especially small games or turned-based games, but for adventure/platformer/FPS/anything else basically, forget about it.

You cannot emulate physics/render images/and also render light on sprites and expect the game to run at 60 FPS or more, even with a beast for a computer. You'll need a lot of optimization to even get to playable framerates and that's just bad, cause a messy code is harder to maintain (which is often the case when you optimize).

I tried pygame and pyglet, none of those really do much for game developpement anyways, besides rendering images. You still have to write an engine (pymunk is great for physics though) and that's just too much work for the benefit.

You can use unity though, or unreal and have a full game engine to use however you want to do whatever you want. It's not that hard to go from python to C# if you're really proficient in python. The syntax isn't all that different (you lose list comprehensions though, and dictionnaries if I'm not mistaken) but C# looks a lot like if C++ had a baby with python. And with a game engine you just have to write the logic of your game and not bother with writing a lot of code without seeing any progress.

0

u/[deleted] Jan 05 '18

[deleted]

1

u/AngriestSCV Jan 05 '18

Raylib is another good one. I've been messing around with it using custom rust bindings and it's been plesent.

1

u/grimtooth Jan 05 '18

I've only ever used it as a basic graphics interface (SDL wrapper) rather than for actual games. It's been satisfactory for that -- what about it sucks ass?

0

u/[deleted] Jan 05 '18

[deleted]

1

u/grimtooth Jan 05 '18

I can see the un-Pythonic thing -- as I say I just treat it as a Python skin over SDL, and SDL isn't really Python-oriented. It works, though.

5

u/Oni_Kami Jan 05 '18

Depends on who you ask.

3

u/[deleted] Jan 05 '18

Java makes me harder than Python.

1

u/I_WRITE_APPS Jan 05 '18

The infrastructure around Java (Java EE, JNI, CORBA etc.) is "harder"/more complex than the Python equivalents.

Java the language is actually easier to grasp in its entirety than Python: it doesn't have metaclasses or descriptors, for example.

1

u/Ethantebest Jan 06 '18

It's just different, not necessarily harder.

-2

u/Thecrawsome Jan 05 '18 edited Jan 05 '18

Java is slower to write* harder to write, such as any less-abstracted language, compared to Python.

Python is great for prototyping and small projects, and learning, but it's not great for scaleable, fast, and low-level processing. It's gotten better at low level processing by turning some of the code into c bytecode, but Python still consumes far more power to do similar operations as Java.

That being said, I hate Java syntax, and it's too wordy for regular boilerplate, and simply having to install Java JRE is considered a security risk.

edit: formatting

3

u/ArmoredPancake Jan 05 '18

and simply having to install Java JRE is considered a security risk

lol

0

u/[deleted] Jan 05 '18

[deleted]

24

u/wrosecrans Jan 05 '18

Massively depends which industry.

44

u/Iggyhopper Jan 05 '18

Java Industry

8

u/[deleted] Jan 05 '18

Java has a sales and marketing budget that is effectively infinitely bigger than the PSF's.

→ More replies (37)

21

u/mrwilliams117 Jan 06 '18

Lol all you turds who vow to a certain programming language like it's your favorite sports team.

7

u/Unoriginal-Pseudonym Jan 19 '18

Yeah, favorite languages should be regarded more like favorite fountain pens. There's no objectively correct answer.

Except Haskell.
Fight me.

83

u/Pancakepalpatine Jan 05 '18

I actually did this exact same thing.

I started with Python, but couldn't wrap my head around what it was actually doing for many of the code snippets and examples I was looking through while I was learning. On top of that, there were 23 ways to write the same expression with 16 standard library choices you could use. After a month or so of frustration, I quit programming for about a year.

Then, I tried to learn Java. The amazing thing was, there was little magical syntactical sugar (compared to Python), and so I could actually read and comprehend code. The JVM was confusing, but as an introductory language, having conventional long variable names and descriptive methods was really helpful.

I know this isn't everyone's experience, and in fact it's the opposite of many people's, but Python was way too "wishy-washy" when I was starting. Now, though, I love it.

(P.S. this was my experience based on the way I learn things, and your results may [have] differ[ed].)

(P.P.S. I learned to code back in the day with codingbat.com. If you're just getting started, it has the most basic of the basic, no-frills tutorials. Even CodeCademy or similar has a bunch of extra stuff, that may be helpful, or may not.)

60

u/ZeeBeeblebrox Jan 05 '18

having conventional long variable names and descriptive methods was really helpful.

Good Python code should also have descriptive variable names and methods.

12

u/Pancakepalpatine Jan 05 '18

Sure, good code should read descriptively in general anyway. I'm just speaking for my experience as a beginner.

29

u/gthank Jan 05 '18

Sounds like you got ahold of some really bad code when you were first trying to learn Python. The entire community really embraces the mantra of There should be one-- and preferably only one --obvious way to do it.

9

u/daniel_h_r Jan 05 '18

I think the problem is exactly that. A newbie don't have the means to choose the only one obvious way.

3

u/gthank Jan 05 '18

I'm saying they shouldn't have had to find it; the tutorial should have been using it, not showing them 13 different ways.

2

u/[deleted] Jan 05 '18

flask.g

7

u/[deleted] Jan 05 '18

I did find some things hard about Python starting off - for whatever reason "range" didn't make a lot of sense to me, but seeing C style loops made more intuitive sense to me as a beginner.

4

u/[deleted] Jan 05 '18

Same, it's easier to work with others outside of Python as well. Teams fight over styles and other petty bullshit instead of getting work done. Dogmatic programmers LOVE Python because there are 20 opinions on everything and "my opinion IS right."

I really like coding by myself in Python though, I can get a lot of work done fast.

6

u/anvils-reloaded Jan 05 '18

Every time I've asked about how to pre-allocate some space in a dictionary where I know the exact keys I want to have, I've always gotten the answer of "don't worry about it" or "stop trying to prematurely optimize your code". In any other programming language, this would just be a part of the process of writing the code. I really do want to learn Python better (I've done some work on Python projects without really knowing what I'm doing, just winging it), but it's not something that I can just stop caring about.

14

u/Pancakepalpatine Jan 05 '18

Yeah, I've been advised both directions.

  1. Learn a "bare-metal" language like C or Rust, and work up from there. Since you understand the basics and necessarily understand some computer science concepts now, you'll have a breeze with interpreted or scripted languages.

  2. Start with a high-level interpreted or scripted language. It's more important to get the basics (loops, types, etc.). Then, it'll be a breeze to work your way down and add conceptually to the concepts you already understand.

So my takeaway was basically it all depends, and it's better just to dive in.

7

u/anvils-reloaded Jan 05 '18

I learned the first way you mentioned, and it wasn't a breeze. I had no idea what Python was doing with its data structures when you added to them, or if you used something like a list comprehension, and I wanted to allocate just the space I need in a list. I have to dissociate from the traditional memory model in order to decide what I really want to do.

15

u/[deleted] Jan 05 '18

In any other programming language, this would just be a part of the process of writing the code.

Not really. In low level-languages you can do that, and often mus do it. But it's not neccessary for getting things rolling. Usually it's just pointless overhead. It becomes important later if you wanna optimize your code, after you have a working solution.

Python in the first place is a goal-orientated language. Optimization comes later. And in best case it's done automatically from the machine. Though, that best case it still in progress for python.

2

u/Cosmologicon Jan 05 '18

And I would add, when you do get down to optimization, forget (or at least attenuate) everything you know about performance from other languages. Especially when it comes to dicts.

Like, you used to hear that one should avoid hash maps if at all possible for performance reasons. This is terrible advice in Python.

2

u/GummyKibble Jan 06 '18

The reason for that, specifically, is that Python’s dicts are very advanced data structures under the hood. In 3.6 they’re both compact and ordered; see https://mail.python.org/pipermail/python-dev/2016-September/146327.html for details. What you’re asking to do doesn’t really make sense in this context.

3

u/Smallpaul Jan 05 '18

If you want to preallocate with known keys then a dictionary is probably not the right data structure. You could use a class with _ _ slots _ _ or a struct.

But usually the people telling you not to prematurely optimize are right. You didn’t really explain why you feel this is bad advice.

1

u/anvils-reloaded Jan 05 '18

If I know what the keys are, I don't really want to load them one at a time, right? This is for situations where I have a specific sized table that I want to use for counting. (I was originally going to use a list but decided that they're not really designed for lookup like dictionaries are). I don't consider it premature optimization because I'm not really optimizing anything, just applying what I know about the problem.

3

u/z0mbietime Jan 06 '18

example = {x: None for x in y}

But based on what you’re describing a collection makes more sense. That being said they’re all right that this is sweating the small stuff. For one, using Python and getting the count when querying the database is going to be faster than anything Java can do.

1

u/anvils-reloaded Jan 06 '18

What do you mean by that, if you're accessing a database I'm assuming that any API has the same functions for it in any language. Both are using some sort of data structure, why would one be faster than the other?

2

u/z0mbietime Jan 06 '18

Sorry I was sleep deprived and misread part of what you wrote. But almost every language is going to have a way to interact with a database. However, there are best practices on querying the data which is why one of the best things you can do regardless of your preferred language is learn how to effectively use SQL.

→ More replies (1)

1

u/Smallpaul Jan 06 '18

I think it's confusing to bring a database into the conversation. Did he say that the data comes from a database?

→ More replies (1)

2

u/Smallpaul Jan 06 '18

... just applying what I know about the problem.

But to what advantage? How would your way result in easier to read or more maintainable code?

Could you show what you want to do in Pseudocode or Java so I know what you're trying?

-2

u/[deleted] Jan 05 '18

I can see few issues in the way you learned Python.

a) Relying on standard libraries rather than implementing your own logic. That's a problem I see in many programmers. They don't program, they bundle together code written by other people with a low amount of their own logic. They end up learning very little.

b) What you call syntactical sugar is the object oriented design of the entire language. JavaScript has the same problem, arguably squared because it's a prototype-based language.

4

u/mistaekNot Jan 05 '18

a) not using libraries, especially the standard library = reinventing the wheel.

Also your own implementation is unlikely to outperform the library implementation...

4

u/[deleted] Jan 05 '18

But that's not the point for a learner.

A learner should focus on solving problems.

Not writing months and months of applications by connecting to X and Y api with some loop in the middle.

That's why most self-made programmers feel they're not learning imho: they are not solving problems.

One of the best things I made when learning was writing a node.js docx to html converter. There were libraries for it, sure, but I learned more by doing that without using any library than I would've learned by months of "building applications".

Libraries solve business problems, not programming problems.

New programmers should stop learning programming by using libraries, as there's very little to learn from it.

2

u/Pancakepalpatine Jan 05 '18

Sure! The way I learned definitely wasn't perfect.

However, it's hard to recognize what you're learning imperfectly/incorrectly as you're learning it.

I personally think with a good enough guide/tutor you can start with any language (maybe even assembly :)). Five years ago, though, with the tutorial I was using and the starting place I found myself at, Python was not a good fit. That's not everyone's experience, but it was mine.

1

u/[deleted] Jan 05 '18

However, it's hard to recognize what you're learning imperfectly/incorrectly as you're learning it.

The point is that, imho, there's very little you can learn by following tutorials and using libraries.

You learn to program by solving problems through code. You need to write that code and to solve those problems.

If solving the problem is understanding some documentation of an API that solves the problem for you, you're barely solving any problem.

That's why I advocated that noobies should not use libraries.

I mean, I can see why you don't want to write a request library on your own, but that's pretty much all I'd allow to a starter.

3

u/theWyzzerd Jan 05 '18

That's why I advocated that noobies should not use libraries.

To what end, though? Should they write their own ODBC connectors? Should they write their own OS libs? Time libraries? Their own JSON parser (actually this would probably be a really good project for a beginner to learn...)?

Standard libraries are most of what makes up any given programming language and is much of what makes up the "knowledge" of a language.

2

u/Pancakepalpatine Jan 05 '18

Haha I wrote a JSON parser early on. It was very hacky but it taught me a lot! Sentences moved from being HTML in my mind's eye to strings after that project.

And I feel bad - Java has an arguably more redundant/messy standard library. I didn't mean to incur the wrath of /r/python - I just felt like the Python standard library wasn't easy for me to sift through while beginning.

2

u/[deleted] Jan 05 '18

actually this would probably be a really good project for a beginner to learn...

Yeah, you could definitely do worse for inspiration than what comes bundled with the language.

The batteries included side of Python is what kept me programming, though. If you have to invent the universe before you can make a toy script then not a lot of people are going to be there at the end.

2

u/Smallpaul Jan 05 '18

Your rule is much to broad. What about turtle graphics? What about vpython? What about Pygame.

Without libraries, all you can do is text manipulation or math. Many consider that boring.

→ More replies (1)

0

u/[deleted] Jan 05 '18

[deleted]

6

u/Pancakepalpatine Jan 05 '18

If you're trying to decide what language to begin with, know that there are much better tutorials online than when I began!

Python is an incredibly powerful language, and (for better or worse) does a lot behind the scenes. It's definitely worth learning, and up to you when/if you want to! Don't let my experiences change your mind in any way.

35

u/[deleted] Jan 05 '18

Saw logo, expected rust.

17

u/[deleted] Jan 05 '18

Switching to Rust two years ago would be rough for a newbie.

5

u/freshcannoli Jan 05 '18

I'm currently using Rust to write a Lexer/Parser/Compiler for Python. It's definitely an interesting language. I do think the Rust community has done a great job at reducing the learning curve a little bit. That being said, it can still be conceptually overwhelming.

5

u/[deleted] Jan 05 '18

Yeah, I especially if your only background is in shallow-ish Python. Rust forces you to think of memory usage and other lower level concerns, which Python can paper over for you.

1

u/campbellm Jan 05 '18

Still is.

1

u/Pas__ Jan 07 '18

Old comment, new logo, so probably already jumped from Java to Rust!

23

u/[deleted] Jan 05 '18 edited Jan 05 '18

Let's be honest, how many programmers use Python as their primary language at work?

Also, I love Python, but as soon as we move into GUIs it just can't compete with C#, Java, Javascript.

edit fuck me asking such a question on /r/python :D Yes I know Django is popular.

14

u/[deleted] Jan 05 '18

A lot actually... Both my current and previous companies primarily use Python on the backend and it's never caused an issue.

14

u/[deleted] Jan 05 '18

Let's be honest, how many programmers use Python as their primary language at work?

Wrong language to be asking "do people actually use this?"

Go ask that in /r/Haskell.

→ More replies (1)

15

u/gthank Jan 05 '18

I do. Python 3, as a matter of fact. I used to write Java, and I taught myself Python precisely so I could either rewrite my stuff at work, or get a different job. It worked. Added bonus: I get paid more now.

3

u/[deleted] Jan 05 '18

I remember seeing research showing that it was the second most used language behind JavaScript in 2017.

3

u/greshick Jan 05 '18

Python3 dev here. We use it extensively for backend work.

2

u/RangerPretzel Python 3.9+ Jan 05 '18 edited Jan 05 '18

I use Python as my primary language at work. I think C# is still my personal language of choice, but Python3 coupled with PyCharm is a close 2nd.

2

u/bsinky Jan 05 '18

C# at work for me.

I'm pretty rusty at Python to be honest, I try to use it for one off scripts to keep it fresh, but I'm not sure that's benefiting my Python knowledge much. I do enjoy it though.

2

u/Kyle772 Jan 05 '18

I do. I love python

3

u/Mtc529 Jan 05 '18

I do. I work with a Django backend and I love it so much.

1

u/[deleted] Jan 05 '18

Animation and VFX pipelines are almost unanimously built using Python. You'd be surprised!

1

u/autarchex Jan 06 '18

I'd estimate I use 55% python, 44% C, and 1% bash scripting for work, so I guess that makes Python my primary language at work.

→ More replies (4)

14

u/pat_trick Jan 05 '18

And? Maybe they decided to get into Android dev, or any other number of places that Java is used. This is a non-post. Who cares?

3

u/BebopAddict2009 Jan 06 '18

Hey, as a newish Java developer, I can respect going Lower level. That takes some dedication with the expanded syntax. It would be like me going C.... shutters

2

u/djihe Jan 06 '18

Maybe they needed a job?

2

u/acoalt Jan 06 '18

Press F to pay respects

1

u/Unoriginal-Pseudonym Jan 19 '18

U F

Edit: sorry wrong layout.

1

u/rspeed Jan 06 '18

I hope they were able to safely recover the beloved family member(s) who were kidnapped and held for ransom.

1

u/suclearnub Jan 06 '18

You were the chosen one!

1

u/bangemange Jan 06 '18

What a weird switch. I went from Java to Perl to Python

1

u/DrjReddy Jan 05 '18

By Today he might have given up programming😜

1

u/[deleted] Jan 05 '18

Lol.. Gave up too early!😂

-2

u/[deleted] Jan 05 '18 edited Jan 05 '18

... but why?

I mean, Python is awesome in every1 single aspect (I'm a huge fan). For instance, have you ever tried to override the "import" instruction in Java with your own implementation? Although maybe not always recommended, it's a piece of cake in Python. Delegates... piece of cake in Python (callables) because literally everything is kind of an object. Damn, even types are. How awesome's that?

/e: (1 - relevant for my requirements)

17

u/fizzy_tom Jan 05 '18

I'm curious as to what you were doing which required you to override 'import'?

3

u/[deleted] Jan 05 '18

We have a configuration in which it is desired to have some module dependencies 'optional'. That is, it is not considered necessary to have them installed and the program would also work as intended without them. Example is matplotlib. If you don't need visualization you can use the program without matplotlib and it would work in pretty much exactly the same way (aside from visualisation).

So for this purpose I overrode import with an implementation that checked whether some modules were marked as optional (from a configuration file) and in case that they were not installed (usually import would fail with an ImportError) would return a MagicMock object instead of the actual module. That way any use of the module would just kind of "work" (while not doing anything at all) and leave the rest of the program's functionality unimpeded. For modules not marked as optional or optional modules that are installed the overridden import works as the original import.

It's a pretty unique scenario and maybe a pretty nasty solution, but I'm still happy that it's been possible at all. I don't know of any other language that is capable of doing something like this.

16

u/danielbibit Jan 05 '18

How about a conditional import ?

→ More replies (10)

4

u/[deleted] Jan 05 '18

Because his employer is making him use Java.

9

u/ascii Jan 05 '18

In any sufficiently large and complex project, I've found that skill is far more important than language choice.

14

u/[deleted] Jan 05 '18

In any sufficiently large and complex project I find that structure is important, and Python allows bad structure very quickly.

6

u/[deleted] Jan 05 '18

I worked on a fairly large python backend for a couple of years. As it grew, maintainability was difficult. Unless it had near 100% unit and integration test coverage, it was something difficult to tell what was going on. Not to mention the interpreter just sort of rolls with the punches.

I like python for alot of things. It can get hairy as it grows however. YMMV.

-2

u/unruly_mattress Jan 05 '18

My experience is this: For a project of any size, Python allows bad structure. For any sufficiently large project, Java mandates bad structure.

5

u/lookatmetype Jan 05 '18

What language allows or mandates only good structure? I have yet to work with one.

9

u/110101002 Jan 05 '18

I prefer python, but python is generally worse than java it terms of type safety and execution speed.

4

u/[deleted] Jan 05 '18

Just because you can do something, does not mean you should it. Java is better used with big projects beacuse of those limitations it has. In Python you can screw up projects to easy after certain levels of complexity.

2

u/[deleted] Jan 05 '18

Yes, and how's the GIL treating you lately? And let's not even talk about performance.

→ More replies (2)

1

u/bsinky Jan 05 '18

Yeah I wish we got more of this twitter (edit: or Youtube? I don't know where this came from) conversation, to see if there were any specific reasons for the switch. Maybe it's just a meme.

Could be that there was a specific Java library they wanted/needed to work with I guess. Or something of that nature...?

0

u/[deleted] Jan 05 '18

[deleted]

0

u/[deleted] Jan 05 '18

[deleted]

2

u/ForgottenWatchtower Jan 05 '18

I actually agree with Guido on that one. Undue complexity for such a rare problem.

https://mail.python.org/pipermail/python-3000/2007-July/008663.html

→ More replies (5)

0

u/[deleted] Jan 05 '18

[deleted]

3

u/mistaekNot Jan 05 '18

swift with xcode 9 is a joy to write code with :)

3

u/lobax Jan 05 '18

Swift is nice. But xcode? Really?

→ More replies (1)

4

u/Wodanaz_Odinn Jan 05 '18

xcode

&&

:)

I'm very envious if this is true for you.

1

u/weasdasfa Jan 05 '18

That's not how you spell AppCode (or whatever the IntelliJ iOS IDE is called).

1

u/mistaekNot Jan 05 '18

I thought about using appcode, but it doesn't support storyboards :/

→ More replies (1)

5

u/[deleted] Jan 05 '18

scientific motivated projects (research)

That's the primary reason why I'm a fan of Python. Of course, there's no one fits all programming language. Python is still junk when it comes to applications that need a sophisticated GUI.

10

u/icp1994 Jan 05 '18

or multi-core support

5

u/lookatmetype Jan 05 '18

PyQT

3

u/[deleted] Jan 05 '18

Is from my point of view still junk because I don't know of any matured UI editor and using PyQT has very often led to severe compatibility issues in the past. It's far from sophisticated.

2

u/lookatmetype Jan 05 '18

What's language and library do you prefer for cross platform desktop GUI apps?

3

u/[deleted] Jan 05 '18

Cross platform is difficult. If standalone is a requirement I'll say Java. If I accept being limited to Windows and standalone is a requirement, it's WPF. Otherwise I'll say browser based, like, JavaScript + HTML + CSS + some fancy frontend library. Backend can still be Python (Django) or also JavaScript (Node.JS + ExpessJS or something like that). Except for maybe WPF they all suffer from the same issue: no good WYSIWYG editors.

/e: maybe I should add that at least for my job (AI research) there has been no need for sophisticated UIs yet. For visualization there's matplotlib and some other libraries that inherit from that. For larger business applications though I still think Python is unfit.

→ More replies (1)
→ More replies (2)

1

u/angryrancor Jan 05 '18

Qt Designer is pretty dang mature...

→ More replies (3)

1

u/gthank Jan 05 '18

If you need a sophisticated UI, you should just write the app in platform-specific code and be done with it.

1

u/[deleted] Jan 05 '18

Yeah, probably. What I'm saying. Cross platform is difficult. One of the reasons why Python UI is still problematic in my opinion.

2

u/am0x Jan 05 '18

I mean I use Swift for iOS, Java for android, C# for work web development and game development, Meteor (JS) for prototyping MVPs, PHP for some freelance, and Python for automation and algotrading.

I enjoy pretty much all languages...it's certain frameworks I find myself disliking more than anything.

2

u/lobax Jan 05 '18

JS is still a must-have in web-development

If anything, JS has grown to cover the entire web-stack thanks to Node. Heck it's even gaining ground elsewhere with Electron and React Native.

Sometimes I get the feeling that in the future we will only code in JS!

2

u/[deleted] Jan 06 '18

Don't put that voodoo on us!

1

u/Ars-Nocendi Jan 05 '18

Don't let it rub you in the wrong way. The person probably found out six months in that his/her employer measures performance by LOC.

3

u/[deleted] Jan 05 '18

Including lines with a single curly brace.

1

u/[deleted] Jan 06 '18

Hey, that's me!

1

u/ddollarsign Jan 05 '18

Different people like different things. Some of those people are wrong. /s

0

u/[deleted] Jan 05 '18

I give him a month.

0

u/BrokenAdmin Jan 06 '18

Python is fine, as long as you use parenthesis on if statements. Otherwise I have a seizuee reading the code.

0

u/TylerSix Jan 06 '18

I did the same.. as a complete computer science /programming noob with no formal education in the subject it was extremely difficult for me to grasp OOP..

By chapter 3 of my Java book my eyes opened and I could start putting the big picture together. Classes, encapsulation, public vs private / protected ect, getters/setters, object state, project structure and separate easy to read class files instead of a single file slammed with difficult to read L33T one liners calling 38 functions packed with for loops passing collections around.

TLDR;

I suppose python is too simple and too easy to use poorly for me to have learned me anything meaningful at the very beginning which frustrated me to the point of giving up multiple times

3

u/dbraaa Jan 06 '18

Yes, Python gives you a lot of freedom, so it requires some self discipline, and is concise and expressive, so it requires some art and reasoning.

Simply put, Python empower and trusts the developer, where Java treats him as a monkey. If you hire monkeys, or you like coding without thinking too much, Java is the choice.

But looks like the Java community discovered it , because latter versions added a lot of feature to enhance freedom and expressiveness.

-3

u/monsto Jan 05 '18

He meant javaSCRIPT, but it's the same thing really.