[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Does /gee/ like python?

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 124
Thread images: 9

File: aZm6GW3_700b.jpg (31KB, 700x698px) Image search: [Google]
aZm6GW3_700b.jpg
31KB, 700x698px
>>
'hello world'
>>
>>60705575
I have no formal training with python, so I don't know that much about python.
It is relatively fast for a scripting language and scripting languages allow for fast development, so I can see the need.

I often see python being recommended as a beginners language and I couldn't disagree more with this statement.
Beginners is better off using a compiled language where they would be beaten into submission by compiler warnings.
>>
>>60705575
The only reason i believe in backend development.
>>
>>60705575
>good career prospect
>easy
>can do almost anything, albeit not the best for anything
>i can do hobby game development in Godot engine because their language is so close to python
>goes well with linux jobs, which I have

I might never learn anything else, to be honest. I'm the kind of guy who wants to get the job done so he can be outside with his well earned loads-of-money and enjoy first world country lifestyle. Anyone arguing about language choice can do me a favour and take the discussion to someone who cares. I do IT for a living and happen to like it, not because I feel that it is the most crucial aspect of my life.
>>
>>60705575
Python wasn't my first language, but it took no time at all learning it. It's a great starting language for beginners since it's so simplistic.

Personally, I found it a bit too simplistic to use myself. I would sometimes runs minor errors all over since I'm so used to programming with Java and C++.
>>
>>60705575
I started with Python 2.3 or 2.4. Use it for stuff like crawlers, data cleaning, automation, etc. Works pretty well, is simple and fast. I like it
>>
File: 1369224058853.png (135KB, 1350x597px) Image search: [Google]
1369224058853.png
135KB, 1350x597px
>>
>>60706393
It literally says "than" right there in the highlighted section but the fucktard who made this still couldn't spell it.
>>
>>60705575
""""""""""pythonic""""""""""
>>
>>60705575
no
>>
It's a great scripting language, with the ability to insert pieces of C if you need something a bit more raw.
>>
>>60706639
How does that work exactly? Does python natively support importing C libraries?
>>
>>60706064
Everything wrong with the IT industry,people.
I've never met you but damn, I already dislike you
>>
Python is a great scripting language but should not be used for "real" programming. When I need a small script or tool to do something I'm happy if it's written in Python however as a Gentoo user it makes me reeeeeeeeee that my package manager is written in Python.
>>
>>60706736
You need to specifically write the C so that python can understand it, so no.
>>
>>60706750
This.
>>
>>60705575
No
>>
>>60706736
>>60706776

And once more:
Ruby is Python done right..

>https://www.amberbit.com/blog/2014/6/12/calling-c-cpp-from-ruby/

When will Pythonistard ever learn..
>>
>>60706773
What makes you say that? What's the difference between a "scripting" and a "programming" language?
>>
>>60706064
>I might never learn anything else, to be honest.
You see, you were making good points and then you fucked it up. Why would anyone ever even admit to this?
>>
>>60707712
Traditionally, interpreter vs compiler, although that line tends to get blurry nowadays with languages like JS.
>>
>P-Python's stupid and slow. I-it's not like I like it, or anything.
/g/'s so tsundere for Python it's embarrasing.
>>
>>60705575
I like to spend time with your mom.
>>
>>60706736
You can use the ctypes module to call a c library from python.

>>60707634
>end
>end
>end
>end
>>
It's good until you need to make something larger than a script
>>
>>60707712
He's an autistic moron if he's complaining about a package manager not being written in assembly.
>>
Love it desu.
>>
Slow as fuck and inconsistent API.

ofcourse /g/ likes it
>>
>>60708836
>whitespace
>whitespace
>whitespace
>whitespace
>>
>>60705575
I like Python a lot. At work we don't use it much outside of small scripts, because its dynamic typing makes it a massive pain to manage in a large project with lots of people. That said, in personal projects it's great, and a lot of my personal things are in Python.
>>
>>60707634
>C code
>takes advantage of garbage collection
stopped reading there
>>
It's ok but nowhere near as useful and beautiful as Bash..
>>
>>60706064
>My thoughts are reasonable
>I am both plastic and totally fairweather. You'd be right in thinking me Summer and I have not the slightest problem with being the cancer that kills /g/

Actually quite good b8
>>
Perfect for small scripts.
Perfect as C/C++ wrapper for high level stuff.

What's not to love.
>>
>>60709209

The sentence was "It takes advantage of pre compilation, better garbage collection or static typing."

If you read further, you will notice that they are discussing serveral methods, it's a difference to access C classes via an interface or embed C code.

Also I didn't want to advertise the writing skills of the website creator, I just wanted to show you how great Ruby is.


>>60709232

Funfact:
Python was written as replacement for bash.
>>
>>60706750
not an argument
>>
There are a lot of problems with Python, but overall it's a solid language that can get simple tasks done. What a lot of people use as an argument for Python is "X library is available for Python and not [other language]", which is a completely invalid argument which says nothing about the language itself.

So, ignoring the libraries, how is Python? Not great.
The OO system really just shouldn't have been added. It's a complete mess. Double underscore names like __init__ are just cancerous. Passing self into functions is utterly stupid and needless. Member declarations happening on the fly is just asking for hard-to-track errors. Double underscore prefixes for private members is laughable.
Variable declarations need to be distinguishable from assignments.
Forced indentation only works for teaching beginners to make their code not look like ass, but it becomes an aggravation when you want to make something look nicer using multiple lines.
Regular expressions could be much more well-integrated, considering it's a scripting language. Look at Perl. As it stands, there's a lot of unnecessary code just to do simple regex tasks.
It's fast enough for many applications but you will see performance degrade as you try to scale it up too much.

Basically, if you want to learn it to use the libraries, go ahead. If you want to learn it as your first language, go ahead (but don't let too much stick). Otherwise, move on to another language more suitable for your own specialization.
>>
>>60709754
Python would be incredibly shitty replacement for a Bash shell..
>>
>>60710858
Agree, it was the first language I learnt and although I enjoy using it on the whole, little things like you mentioned start to stack up after continued use. After my current project is done I'll be looking for something else to learn most likely.
>>
>>60706420
what's the matter anon don't you love this smug fuck

https://www.youtube.com/watch?v=OSGv2VnC0go
>>
>>60710858
Xx__init__xX
>>
>>60710858
Hey bro I heard you like self don't worry I got you

self.response.update(self.query_database(self.message))
>>
>>60710858
I actually like the simplified but yet powerful OO side of Python.
Of course, not fully and strongly OO, but it's nice to have that "infrastructure" to play with.

But yeah, fuck 'self'
>>
>>60706419
Python fans.
>>
>>60706315
>>60706773
>>60708866


I totally disagree with python being simplistic or lacking power. It's syntax superficially reads like natural in some respects, but in this respect python is a wolf in sheep's clothing.

In reality, the language has an extremely sophisticated object model and is highly customizable and powerful. However, accessing these features requires a fairly good understanding of the language, and many python users only ever learn the basics, since those are good enough to get you up and running.

The only real problem with python is that it's too easy to learn a small part of it and live on completely ignorant of the underlying power.

Also, I guess some people don't like the available complexity, like this guy: >>60710858
>>
>>60712834
My point was I don't want any "real" programs written in an interpreted language. If a language is interpreted then it's only good for scripting in my view.
>>
>>60712886
That's fair if you really need the performance of a compiled language. Keep in mind though, that many server applications have no problems running via a python interpreter, and python is often incorporated into high-performance programs as a scripting language (the civilization games use it, for example).

I'm not really sure I know what you mean by "real" programs but I hope this clears up my opinion
>>
>>60712886
you can compile python
>>
>>60709072
1. Forced whitespace is good for readability
2. If you're not already tabbing out your code properly, you should probably kill yourself.
>>
>>60711015
In practice, it isn't really a replacement for it, but it's something you can use over the top of it to do more things more easily.
>>
can I make bideo games with python?
>>
>>60716079
yes
>>
>>60710858
>The OO system really just shouldn't have been added.
The ignorance and stupidity of this statement is incredible. Everything is an object in python. Saying that the language shouldn't be object oriented would literally remove the whole language.

Then you read beyond it and it's mostly just intellectually bereft shit like "I don't like double underscores", "let me write shitty looking code without indentation" etc
>>
>>60706064
>good career prospect
kek'd
>>
It's the retarded child of Visual BASIC, a dumb language for noobs.
>>
File: pugforthought.jpg (18KB, 451x451px) Image search: [Google]
pugforthought.jpg
18KB, 451x451px
I love the simplicity of python. Its easy for my dumb monkey brain to understand.
>>
>>60717735
this

python works for 95% of my web projects and the libs mate, the libs

I do Java on the side to make myself employable but damn I don't see the point
>>
>>60713565
I absolutely despise this argument. A programming language should never incorporate indentation as part of syntax. ridiculous insanity.

>2. If you're not already tabbing out your code properly, you should probably kill yourself.
> properly

so python gets to decide "properly"? My code is clean, neat, and indented the way i like it. Fuck python for no other reason than the forced indentation.
>>
>>60716895
The language could easily work without objects. Plenty of other languages have gotten by just fine without objects. Maybe it would make more sense if user-defined classes were not so cancerous. Hell, it'd be better if user-defined objects just didn't exist and the OO was "use but not write"
>>
>>60718442
No it couldn't because everything is an object. Are you too fucking dumb to understand that simple concept. It's fundamental to the language's design.

>Maybe it would make more sense if user-defined classes were not so cancerous
How exactly are they "cancerous"? And don't say "I don't like having to type self or init with some underscores". Those aren't valid criticisms.
>>
>>60717886
>A programming language should never incorporate indentation as part of syntax.
Explain why, beyond arguing that you just don't like it.
>>
>>60707634
No one used Ruby in a production setting.
>>
File: Lua-logo-nolabel.svg.png (72KB, 1200x1200px) Image search: [Google]
Lua-logo-nolabel.svg.png
72KB, 1200x1200px
>>60705575
Ahem.
>>
>>60716079
theoretically you can do anything written in anything
>>
>>60707634
Ruby is dying and disappear once rails is finally dead. Python is only growing in popularity.
>>
What do you is the most suitable editor for python?
>>
>>60717886
>ridiculous insanity.
why?
>>
File: 1462752599827.png (1MB, 1094x720px) Image search: [Google]
1462752599827.png
1MB, 1094x720px
>can't override methods
>can't overload methods
>EVERYTHING about objects is implicit EXCEPT for constructors/inheritance for some fucking reason

Yeah that's a pretty shoddy implementation of OOP. It's basically my only complaint about python. Other than that it is god-tier.
>>
>>60718637
I use eclipse but it doesn't work as smooth as it does for Java. Often can't even find methods of imports for whatever reason
>>
>>60718637
PyCharm or bust
>>
>>60718681
how would you override a method without differentiating the types of arguments supplied?
>>
>>60718518
You're not exactly thinking there, are ya, bud?
What he's saying is the language could have been done without making everything an object. Of course it wouldn't make sense to just remove everything object-oriented, but it can all be replaced.
>>
>>60718802
*overload
>>
I work in datashit and Python is okay. It's a just werks language for me.
I actually prefer R for pure data analysis and I really like Ruby's syntax, but I at work we usually end up using Python because it's kind of a middle road. Ruby has literallywho data libraries and R sometimes doesn't have as well-supported APIs (e.g. elasticsearch).
>>
It's usable (for an interpreted language), but there are so many annoying things about it.
>self everywhere
>__fucking_why__
>no way to define class instance fields except in __init__
>meaningful whitespace sometimes forces you to write things that look bad
>the colon is required everywhere, even though it's meaningless
>no multiline lambdas as a "design choice", because a dynamic language apparently should have shittier lambdas than fucking C++
>no way of distinguishing declaration from assignment, so typos may produce really hard to find errors
>apparently nobody who makes python libraries heard of enums, so pretty much all of them, even the most prominent ones, use strings instead (which forces you to look at the documentation every time you forget the exact spelling and is prone to typos) - this one is not really the language's fault, but it attracts morons
>the whole python 2 vs python 3, and also nothing in the scripts clearly indicates python version
>pip is a fucking piece of shit and like half of the time I try to install a library with it, it throws billion errors and I have to install some older version with conda
>no way to easily just include all dependencies, so everyone who wants to run your program has to install all those libraries in the exact version that you used, or pray that the script won't shit itself because of version incompatibility
>>
>>60718637
PTVS
>>
File: 2352313.jpg (100KB, 658x439px) Image search: [Google]
2352313.jpg
100KB, 658x439px
>>60705575
It's not the most powerful language tho.
>>
Python is worth learning for scikit learn alone
>>
>>60718821
It would involve ripping out the innards of how it's designed and replacing everything from the ground up. It would have little benefit, and cripple what the language is capable of.
>>
>>60719184
>no way to define class instance fields except the way you're supposed to define class instance fields
ok, junior.
>>
Most of what I do at work, either day-to-day or operation kind of stuff is in python, so, yes.
>>
>>60719184
>no way to define class instance fields except in __init__
What? You can do that from any method within your instantiated object.
>>
There are some valid criticisms of Python, but the ones in this thread are downright retarded.
>>
>>60721523
Care to elaborate?
>>
>>60705575
>programming language is literally pseudocode
What's not to like ?
>>
>>60717886
>putting spaces between the words you type

Ishouldbeable to ty pehoweveri likefuckeng lish and forced spaces
>>
>>60719184
Self as a reference to the class communicates to the reader what's being used by each method and staticmethods can be defined if there are no references. Double underscores aren't bad, but the lack of proper private methods is frustrating personally.

Lambdas, map and filter are rarely encouraged in python.

Declaration/assignment can be an issue although a good linter will pick up on it.

Could you explain how libraries using your args (I assume) in an enum would make things easier? I agree python doesn't teach enums particularly well though.

Agree with 2v3 and pip can be frustrating at times. It can install from file so if you have a virtual environment you can
pip freeze > requirements.txt
, else manually populate the file.
>>
File: 18700350.jpg (94KB, 573x730px) Image search: [Google]
18700350.jpg
94KB, 573x730px
>>60705575
Aside from the fact that it lacks switch/case it's not that bad.
>>
>>60721533
Okay
>>60710858
>The OO system really just shouldn't have been added.
OO is fundamental to Python and has been since the very beginning.
>Double underscore names like __init__ are just cancerous... Double underscore prefixes for private members is laughable.
They're _very_ useful as a form of namespacing. They may seem ugly, but in the absence of true private methods they actually help code readability by providing a visual marker for object 'internals'.
As for why Python doesn't support true privacy, it's a matter of principle ("we're all consenting adults").
>Passing self into functions is utterly stupid and needless.
The explicitness is good for readability, it makes decorators possible and allows you to assign functions to an instance and have them instantly work as a method.
>Member declarations happening on the fly is just asking for hard-to-track errors.
Nature of a dynamic language, and very useful.
>Variable declarations need to be distinguishable from assignments.
Again, nature of dynamic language. There's little point declaring a variable without a type.
>Forced indentation only works for teaching beginners to make their code not look like ass, but it becomes an aggravation when you want to make something look nicer using multiple lines.
The former vastly outweighs the latter, and it applies to people of all skills. Uniform indentation across the whole language base makes it all much more readable. Also, you can indent more freely than you think, you're probably not aware of how often there is implicit line continuation.
>It's fast enough for many applications but you will see performance degrade as you try to scale it up too much.
This is probably the most valid complaint for pure Python applications, but it's generally easy to drop to C for bottlenecks, or use a faster language (e.g. Go) for specific tasks.
>>60717886
>My code is clean, neat, and indented the way i like it.
You're not the only one who has to read your code.
>>
>>60718681
>can't override methods
Yes you can...
>>can't overload methods
How do you overload functions in a dynamic language anyway?
>>EVERYTHING about objects is implicit EXCEPT for constructors/inheritance for some fucking reason
What?
>>60719184
>>no way to define class instance fields except in __init__
Plain wrong.
>the colon is required everywhere, even though it's meaningless
It's meaningful to the interpreter.
>no multiline lambdas as a "design choice", because a dynamic language apparently should have shittier lambdas than fucking C++
Fair, I disagree with Guido on this one.
>the whole python 2 vs python 3, and also nothing in the scripts clearly indicates python version
It's the fault of the Python 2 community, Python 3 is far better.
>pip is a fucking piece of shit and like half of the time I try to install a library with it, it throws billion errors and I have to install some older version with conda
I've never had issue with it.
>no way to easily just include all dependencies, so everyone who wants to run your program has to install all those libraries in the exact version that you used, or pray that the script won't shit itself because of version incompatibility
Wheels.
>>
>>60721707
>the lack of proper private methods is frustrating personally.
How come?
>>60722714
Most (but certainly not all) use cases can be achieved more nicely with a dict
>>
File: reality_check.png (78KB, 935x954px) Image search: [Google]
reality_check.png
78KB, 935x954px
>>60718606
>>
>>60705575

"There is preferably one (and only one) way to do it."

poop = "pythonic"

print(f"Is my code {poop}, senpai?")
print("Is my code {poop}, senpai?".format(**locals()))
print("Is my code {}, senpai?".format(poop))
print("Is my code {poop}, senpai?".format(poop=poop))
print("Is my code %s, senpai?" % (poop, ))
print("Is my code %(poop)s, senpai?" % {"poop": poop})
>>
>>60723159
>How come?
Mostly if it's a public API and I want to communicate what methods can and can't be called. I know you can make it more difficult by using double underscores but it would be nice if you could wrap it in a proper private decorator or something.

I also love using dicts as switches although it's not quite the same.
>>
File: compilerBDSM.gif (2MB, 320x180px) Image search: [Google]
compilerBDSM.gif
2MB, 320x180px
>>60705713
mfw
>>
>>60723299
But the whole point of _attr/__attr is that, since the original code writer can't guarantee that the attribute/method isn't of some use to somebody in the future, why not allow them access if they _really_ want it?
>>
>>60706064
what a douchebag normie
>>
>>60723233
While it's true, that all of the lines are giving the same result, it's like saying that if 2+2=4 and 2*2=4, then one of them is obsolete.
Each of the methods has its own use cases and pros and cons.
>>
>>60718582
this
too bad you can't actually get employed in Lua
>>
>>60718582
>>60723753
>array indices starting from 1
>>
>>60723299
Python assumes that you are a reasonable person.
If you want to say that consumers of your api shouldn't call a particular method you prefix the name with a single underscore (not two, those are reserved for internals)

Every language with access level modifiers has a way of circumventing them. C# and Java have reflection. In C++ you can cast class pointers to structs.
By adding those modifiers to the language you're just making it harder to access private attributes when you do actually need them.
>>
>>60705713
This
Also the whole invisible syntax thing is really difficult for a beginner to grasp. Braces and semi-colons make it so much easier to learn how to properely indent code as a beginner and also make it easier to read and comprehend code. python is definitely an intermediate language.
>>
>>60723299

>I also love using dicts as switches although it's not quite the same.
How? I can't think how to make it work nicely with lambdas as crippled as they are.
>>
>>60724084
Give me a psuedocode switch/case example and I'll translate it to Python.
>>
Python is incredibly powerful, my favorite part of the language is its metaprogramming layer that can be picked up very easily. It has dynamic but strong typing (you can change the types of your first-order entities, the function are generic by default, but not shoot yourself in the foot javascript-style by adding a number and an array). Being a fan of functionnal languages with static typing, I was skeptical at first but it allow all kind of magic, especially coupled with metaprogramming. At work, taking advantage of this features, I wrote a full database access layer to our application in 2 days and in less than 300 lines of code (the old one was 10 times as much code in php).

The more I spend time with it the closer it feels to a LISP speaked by the whole world and that I get paid to write in. It's amazing.
>>
It's slow as FUCK, and I don't particularly like the syntax, specifically significant whitespace. But for very high level scripting it's fine I guess.
>>
>>60707712
Programming languages are used for whole complex projects.
Scripting languages are usually used to make simple logic or glue stuff together.
>>
>feel so proud you've written a fizzbuzz in a real language (assembly code, ofcourse) in your basement dungon
>chuckle derisively at the "script kids" who wrote youtube in python, because it's not a "real" language.
>>
>>60706393
WAIT, there's no bitwise xor in python??????
>>
>>60724348
>It's slow as FUCK
What do you write that Python is too slow for?
>>
Best way to learn Python?
>>
I recommend python to my..ehm..less bright students,and c,c++ to my regular students.
Win-win, the python kids think they're makijng something, and the other kids actually make something.
>>
>>60724634
There is, it's `^`, but there's no normal xor.
>>
>>60723955
>Also the whole invisible syntax thing is really difficult for a beginner to grasp
this is not true at all
>>
>>60724662
Neural networks, real-time applications, etc.
>>
>>60724674
At first, read/youtube and follow along.

Now I'm doing codingbat challeges,gives you something to play around with and problems to solve.
>>
>>60723955
I learned Python before C# (forced to at school) and I stuck with Python.
>>
>>60723460
True. They can be helpful when debugging.

>>60724295
Got any resources on python metaprogramming? It's one of the areas I've never really dabbled in.
>>
So if I already know C for usual stuff, C++ for OOP, Bash and Perl for scripting, and R for math, is there any point in learning Python now?
>>
>>60718572
>No one used Ruby in a production setting.
I set up a gitlab server several years ago in a very small production setting. It's slow enough for my tiny team, I have no idea how much of a pain it would be with more than 3 people.
>>
>>60725294
Deep Learning. All major libraries are in Python.
>>
>>60725123

The expert python programming book is a good start for grasping the basics (decorators, metaclasses). You can work your way from there.
>>
>>60724992
>Neural networks
You don't write neural networks in python. You manipulate data (actual manipulation function are written in c/fortran) and do the configuration in python.
Thread posts: 124
Thread images: 9


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.