/python/ - everything about the python language and ecosystem

...

>indentation actually means something
Shit language, GL solving indentation errors.

>Hey guys look what I made with python
>300 posts about how it's unpythonic and walls of text on what you should do instead
Fuck everything about python programmers.

This is my first python script, yes it's retarded and unfinished.
Is it a good base or it will fail sometime because something?

>install.py
def bundle_pavilion():
firefox()
firefox_ublock_origins()


def bundle_thinkpad():
firefox()
firefox_open_with():
firefox_ublock_origins()
firefox_umatrix()


def firefox():
pass


def firefox_open_with():
pass


def firefox_ublock_origins():
pass


def firefox_umatrix():
pass

>cli.py
import argparse
import install


def main():
parser = argparse.ArgumentParser(description="easy and simple software installer")
parser.add_argument("--p", "--packages", choices=dir(install), help="list of packages to install")

args = parser.parse_args()

for p in args.packages:
ast.literal_eval("install." + p)

print(args.accumulate(args.packages))


if __name__ == '__main__':
main()

The good:
>easy to use
The bad:
>terrible language overall
>terrible performance when compared to any serious language (C++, for example)
>it's users are idiots who can't optimise code
>only useful if you need to make something fast without worrying about performance, and hopefully someone will re-make your program using a better language because otherwise we'd have computers running shitware which requires abnormally powerful hardware
>majority of users are stuck in previous versions of python and refuse to update
It's literally the windows 8 of programming languages

We /gg/ now

Lol, just like English.
It's easy but a fucking pain to express something, especially to pajeets.

>terrible performance when compared to any serious language
WHO WOULD KNOW SCRIPTING LANGUAGES ARE SLOW?

>C++
Who is still using this except artificial intelligences?
Almost any paid/human developers use PHP.

Pajeets are not humans

Ctrl + A, convert tab to space
Solved...

i hate it with every cell of my body. that being said, its ecosystem for ML is huuuge and rather easy to use. however, documentation for any python library or similar is usually horribly structured.

Python is GOAT, it just needs better performance and it will be the only programming language worth learning.

>google doesn't worry about performance and writes shit code

>not writing the majority of your code in python, then writing the computationally expensive portion as a c-extension

>whitespaces instead of braces

>never really learned coding
>just writing scientific software for own research purposes so it is basically pure math
>know that I can probably do a lot of other shit with it but don't know what or where to start

>writing a multi-threaded application
>only one thread executes at a time

It's slow af compared to other scripting languages too

Lua and Perl are way faster

I get the impression that Python is considered the reddit of languages - why is this?

PHP is shite

It's the best language to use if you're bound by I/O.

Because autists who don't know when to use which tool.

Python is good to write lots of code fast. It's pretty bad when it comes to speed though.
If you have a program that will spend 99% of its running time in the same routine you can just write the framework with Python and replace that function with C++ or Fortran.

>Who is still using this except artificial intelligences?
Everyone that needs speed, most commonly in embedded development.

Fun fact: I used to do back-end web development in C++ because the web application did some simple image processing and heavy file operations

>Almost any paid/human developers use PHP.
They don't, PHP jobs are scarce

>C++ in embedded dev
it's more often pure C to be honest

I think python is more of a language to learn to help you learn other languages if you don't know anything about programming

Short answer: No, it's not

Source: I work as an embedded developer

Longer answer: It depends on what level you are doing embedded. If you're making low-powered ICs with a tiny microprocessor with less than 64k of memory, then yes, you are likely to be programming in C (or even assembly). However, there are microprocessors at different complexities from tiny ZISCs to complex CISCs.

Even Nvidia and AMD writes their GPU firmware in C++.

Python is a language used to learn the basics of programming. Usually when someone starts to understand concepts like variables, loops ect. they will switch to something normal (ex. Java, C, C++).

>I switched to java, and now I get to write 5x as much shit to do the same thing

Not really, Python is used in production, especially in webdev.

FLASK
L
A
S
K

[spoiler]or django[/spoiler]

what are good books for learning python?

>I switched to java, and now I got a job and i'm no longer a NEET

...

what do you suggest moving on to next ? And especially when ? Because i read a lot of books , codecademy and stuff but i'm struggling with making something myself , really hard to start

how do i get my ipython to return the helptext if there is no argument given for a function e.g.
i dont want:
>>>np.sin()
----> 1 np.sin()

ValueError: invalid number of arguments

i want:
>>>np.sin()
Parameters
| ----------
| X : array_like
| Input array.
| out : array_like
| An array to store the output. Must be the same shape as `X`.

i hope it clear what i mean

In [1]: help(np.sin)

should be help(np.sin)

i want it to be the *default* if i dont give a argument for a function, that it returns me the helptext(the first 5 lines or so)
like
In [1] np.sin()
Out[1]
Help on ufunc object:

sin = class ufunc(builtins.object)
| Functions that operate element by element on whole arrays.
|
| To see the documentation for a specific ufunc, use np.info(). For
| example, np.info(np.sin). Because ufuncs are written in C ...

>i want it to be the *default*
Yeah, I want to fuck your mother, but we can't always get what we want, can we?

If iPython behaved that way, how would it handle functions that have no arguments and/or default arguments?

You can do np.sin? or np.sin??

No, that's not good enough. I need to be able to call it without any arguments.

you clearly dont get me. like in my example the function need an vector.
why it just returns me an error and not what the input *should* be.

Too bad

that is not going to work because like the other user mentioned, how would it handle functions with no argument then?

what do you need it for anyway? there's probably a more sensible way to do that

>why it just returns me an error
Because it expects an argument you dumb nigger.

i understand, thank you for helping

Fuck this stupid language, can't even handle this basic shit. I will go back to Haskell, Python obviously SUCKS

why ...

Why are all Haskellfags this hostile and obnoxious?

see

>shitposting
It's not shitposting. Just look at /dpt/, Haskellfags are this obnoxious all the time,.

dir and ast.literal_eval are probably unsafe here. Also the import of ast should be explicit

I make tkinter interfaces for clients that cannot into webapps
> you know I just want a window with an [x] in the corner and a shortcut and okay button right here that prints the file

Get out, the academic/industry standard ML libs are documented fine

bottle

Joke is on you, both are right.
>Python - a language where everything but the ecosystem failed
>Haskell - a language where everything but some basic ideas failed