[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Python is the best programming lenguage >prove me wrong protip:
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 61
Thread images: 5
File: python.png (72 KB, 1024x1024) Image search: [Google]
python.png
72 KB, 1024x1024
Python is the best programming lenguage
>prove me wrong
protip: you can't
>>
Python 2 or python 3?
>>
dynamic typing isn't cool
>>
>>54752923
3
>>
>Global Interpreter Lock

python is comfy... but "the test" is just too broad
>>
>>54752923
Python 2 is the legacy version Python 3 is just Python with no extra features I think
>>
If it wasn't for unicode shit it would be
>>
File: PERL.jpg (62 KB, 740x220) Image search: [Google]
PERL.jpg
62 KB, 740x220
>>54752911
>He doesn't know about Perl
>>
>>54752980
what is so good about perl?
>>
>>54752911
10 PRINT"OP is a faggot";
20 GOTO 10
>>
https://jakevdp.github.io/blog/2014/05/09/why-python-is-slow/
>>
>>54753035
tl;dr
>>
>>54752995
Better than Python pretty much all across the board.
Python recently unseated it by being more Pajeet friendly.
Perl was the de facto scripting language for a long time.
>>
>>54752911
bu-but i love semicolons
>>
>>54753052
read the first topic you faggot
>>
>prove me wrong
Go exists.

Now fuck off.
>>
File: are-you-stupid.gif (533 KB, 500x256) Image search: [Google]
are-you-stupid.gif
533 KB, 500x256
>>54753078
That's not an answer. You just rephrased your first statement and added python is more Pajeet friendly.
>>
I think you mean Python and C/C++ are the best programming languages. Can do just about anything with them.
>>
>>54752935
This. All these hipster languages don't seem to get that static typing exists for a reason.
>>
>>54752995
Perl is good but it's finicky as fuck
>>
>>54753180
There's every feature and the kitchen sink, so it's easier to tell the interpreter to do ... pretty much anything you could want to do.
But because of that there's more to learn, making it less Pajeet friendly. Also the code is uglier, making it less Pajeet friendly.

On the other hand, Perl is implemented better than Python.
Among other things, this means Perl code runs faster than Python code.
>>
>>54753280
This
>>
>>54753078
Make a list that has a list inside.
Go ahead, I'll wait.
>>
>>54752911

Python could run as an interface for almost any language.

It will win at the end for sure, beating matlab java C# and all that shit.
>>
>>54753028
PRINT"OP is not proper command. Fag.
>>
Enforced whitespace reeeeeee. Die Python die.
>>
>>54752911
Give me python with optional static typing and mandatory variable declarations and together with C-like languages it's unbeatable.
>>
>>54752911
indentation sucks.
OO features feel like an after-thought.
>>
>>54754036
I thought that a lot as well, but it's not like you wouldn't indent blocks in other languages with whitespace as well....
>>
>>54752911
Ignoring how fucking ugly it is, the devs are just morons and completely negligent. I have to manually link /usr/bin/python to python2 or python3 depending on whether or not some script I want to run expects a specific version because the fucking monkey python devs were too fucking stupid to avoid breakage AND provide explicit guidelines for dealing with breakage.

Instead, they decided to break everything and let the end user deal with it. Python is garbage and deserves to burn.
>>
>>54754106
But Python's indentation is very finicky for no gain, and it is enforced. A combination from hell. If you enforce indentation, at least make it flexible instead of being OCD-tier.
>>
>>54754117
>I have to manually link /usr/bin/python to python2 or python3 depending on whether or not some script I want to run expects a specific version
No you don't.
If the script has a #!/usr/bin/python, it's 2. If it's python3, then it runs 3.
If you're manually running 'python program.py' then you use python for python 2, python3 for 3.
>>
>>54754249
In what way is it OCD?
The gain of it is that you don't explicitly need brackets then. "Don't repeat yourself" is a cornerstone of python.
>>
There is no best and there probably is no worst (despite how hard malbolge tries).

Please stop the language wars.
>>
>>54754761
The symlink for /usr/bin/python is set by your OS. Its not mandated by the stupid Python devs. So one OS might have it point to Python3, another might have it point to Python2. Again, because of the stupid fucking python devs.
>>
>>54755205
>The symlink for /usr/bin/python is set by your OS
Yes, to whatever your latest version of python 2 is (or to the python2 symlink).
Name one major OS that links /usr/bin/python to python3. Oh wait, they don't because it would break the scripts that make those OSes work to begin with.
>>
Is there a reason why Python isn't backwards compatible?
>>
>>54753028
>ended with a semicolon in a Python discussion
>>
>>54754036
Kys
Whitespace isn't a meme, you'd do it in other languages too
>>
>>54753373
show the benchmarks fag
>>
url = '4chan.org/g/'

base_url = re.match(r'\bhttps?://[^/]+', url).group(0)
resp = urllib2.urlopen(url)
soup = BeautifulSoup(resp, "html.parser")
for link in soup.find_all('link', href=True):
cssPath = str(link['href'])
print base_url + cssPath
cssFilename = re.match(r'\w+', cssPath)
print cssFilename


This returns absolutely nothing and I have no idea why? I am only trying to scrape off the filename for the CSS file but for some reason it doesn't even want to match a word.

I've confirmed with pycharm that cssPath is a valid string which contains data but for some reason beknown to me it doesn't want to match anything. Can anyone tell me why?
>>
>>54755234
https://wiki.archlinux.org/index.php/python

>inb4 ARCH HURF DURF
Originally, 2015 was the date that /usr/bin/python would point to python3 for pretty much everyone (Debian, Ubuntu, etc). Because the situation was so fucked, this has been pushed forward to 2020. But the goal is still to eventually have it point to python3.

https://wiki.ubuntu.com/Python/3

>>54755324
Because the python devs are idiots. If you are going to destroy backwards compatibility in a language, CALL IT SOMETHING ELSE
>>
>>54754117
>not knowing the rules of semantic versioning
Chrome has really fucked you up son.
>>
File: retardedd.png (11 KB, 470x169) Image search: [Google]
retardedd.png
11 KB, 470x169
>>54755468
What a mindfuck?
>>
>>54755468
>'4chan.org/g/'
lold
>>
>>54755532
It's just an example, the webpage I'm actually trying to parse is over 240 characters long
>>
>>54755468
fix your regular expression.
Something like
cssMatch = re.search(r'/([\w-]+\.css)', cssPath)
if cssMatch:
print(cssMatch.group(1))


might have to edit the regular expression to include more things.
>>
Python's brilliant for scientific computing. We've started to replace our codebase with Python scripts and ditched our IDL shit. NASA and other large organisations are funding some of the development of numpy/matplotlib. Glorious future is ahead.
>>
>>54754106
>>54755395
It makes writing code into the repl unnecessarily painful
>>
>>54755744
Could you please tell me what was wrong with it currently? Because the method I used worked for pulling the title?

I was beginning to think it was related to unicode or ascii or whatever shite
>>
>>54755494
From your own link:
>What this does not mean:
>/usr/bin/python will point to Python 3
>No, this is not going to happen
>/usr/bin/python and /usr/bin/python2 will point to Python 2.7
Arch is a toy OS. Anything actually used in production like Debian/Ubuntu or RHEL/Centos doesn't do that.
>>
File: laughing-girls-9109825.jpg (34 KB, 400x268) Image search: [Google]
laughing-girls-9109825.jpg
34 KB, 400x268
>>54752911
>slow as fuck interpreted language is the best language
>"prove me wrong"
>>
>>54752911

First of all it's called "langauge", not "lenguage"

Also I whish I could smack every guy who uses this "langauge x is better than language y" baiting..

Langauges are always TOOL for aa specific PURPOSE.

Is a hammer is better then a saw?
Is a car is better than a boat?
Is hex better than binary?

Even if we look at so called "scripting languages" (where nobody can actually define what they are), python is good for specific tasks while at other tasks other languages have advantages.

>>54752980

Perl and Python are so very differnt, it's silly to even compare them.

In Perl there's like a million ways of doing things (and serisouly no Perl programmer knows all of that language), in Python there's exactly one way to do it.

So while Perl is one of the craziest and hackiest languages out there, many Perl guys switched to Python (or Ruby) because they are simpler to learn and about as powerfull.

It's pretty senseless to make this a "dick contest" because each of those langauges has stuff where it's absolutely fucking brilliant and other stuff where it's.. OK.

To put it like this:

>Python is like C: not much syntax, no dicking arround, just straight to the point
>Perl is like C++: incredibly powerfull but also a big, REALLY big language with amazing stuff and wierd stuff
>Ruby is like C#, a modern version of C++ with a lot of cool ideas and shiny bling-bling, although some people might not like it
>>
>>54752911
they're all pretty good dude
>>
>>54755839
re.match matches from the beginning of the string so "/ui/css/s1jobs-master.css" will not match \w+, which is why you use search to search the string for the match.
You want to match "s1jobs-master.css"
so \w means [a-zA-Z0-9_], but will not match - so you use [\w-], you can include more characters if you need to match additional characters. I also add \. to match the . for css, then to just match the literal css.
>>
>>54756505
Thank you so much, I can remember reading this in the docs a few months ago but I obviously skimmed this earlier
>>
>>54756790
no problem, probably better to learn regular expressions in general because it pretty much shared by all implementations.
>>
Hello fellow anons and OP, can you help with a python program, it's supposed to do some things like facebook :)
>>
>>54754768
Indentation alignment, tab vs space. Especially when you alter code, it's easy to mess up the correct (i.e. the only right way) indentation.

>>54755395
>Kys
Go tell that to your mother, kid.
>>
>>54756923
Post the issue or join us on /dpt/
>>
>>54756950
>Indentation alignment
How so?
>Especially when you alter code, it's easy to mess up the correct (i.e. the only right way) indentation
Still not sure what you mean by this, unless you have your editor misconfigured in which case it's a PEBKAC.
If you go strictly off pep8, you indent with 4 spaces only, and use whatever number of spaces necessary for alignment. Pretty hard to mess it up.
Thread replies: 61
Thread images: 5

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.