[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]

100% of my programming is now in python. The language is fucking

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: 174
Thread images: 3

File: py3.png (90KB, 512x512px) Image search: [Google]
py3.png
90KB, 512x512px
100% of my programming is now in python.

The language is fucking beautiful. Surely you guys can agree ?
>>
>>57523215

Python is OK, but I have a hard time to grasp the Python logic:
Somtimes the methods are called with the object as parameter, sometimes you call an object-method. And it seems totally arbitrary which one it is:

"method([a,b,c])" vs. "[a,b,c].method"

Also why do you have to pass "self"? Would it hurt so much to provide "self" as (implicit) default object?

Last issue I have is this bad way they handle strings, constantly decoding/encoding bytes from/to unicode and you never really know which method to use, so it's mostly trial and error. This is unnecessary.
>>
>>57523291
>"method([a,b,c])" vs. "[a,b,c].method"
This is a fucking good point. ";".join and len("str") is actually really dumb, never noticed.

>Also why do you have to pass "self"? Would it hurt so much to provide "self" as (implicit) default object?
I can see the logic in this. Its so class a can pass its own instance to another class.

>Last issue I have is this bad way they handle strings, constantly decoding/encoding bytes from/to unicode and you never really know which method to use, so it's mostly trial and error. This is unnecessary.

The "pythonic" way is to decode ASAP. You should always be working with unicode strings. 95% of the time you can just do
x = x.decode('utf-8') if type(x) == bytes else x


If you're working with web facing code you're best to do
try:
x = x.decode('utf-8') if type(x) == bytes else x
except:
return
>>
>>57523215
fioc
>>
>>57523215
Yes, python is beautiful.
>>
I have never programmed with python.

I don't understand the shit people give Javascript, I think it is a beautiful language too. If you can point out the main differences, I'd be happy to get to know python a bit better.
>>
I use it for everything except web (Django and flask are cancer compared to node or naked php) and mobile (can't really do it on mobile anyway).

The one problem I have with the language itself is that it's oop features are just garbage. Yes it has everything that a "java" or mature oop language has, but it's just off somehow.
>>
>>57523291

It's not as arbritrary.

Most classes have these behaviours that are actually called when you, say, do a len of a list.

When you do the len(a_list) it's actually calling this value

a_list.__len__ == len(a_list)

It's an extra thing for operators and classmethods and is made to be overriden
>>
Python is great except for "muh white space".
>>
>>57523325

Thank you, I will try to do this "decode if bytes ASAP".
>>
>>57523215
Python is pretty fantastic.
I use it to try some algorithm ideas or if I need to prototype something quickly.
>>
>>57523370

Well, I don't want to turn this into a "dick length contest", but I found the object model of Ruby way more logical. In Ruby you ALWAYS ask the object to do something:
[1, 2, 3].length
[1, 2, 3].sort

..and so on. And yet you can override whatever you want.

So in my humble opinion Python claims to be beginner friendly but has a lot of pitfalls that make it overly complicated. As I said, Python is not a bad language and I like many of it's features. To me it's a close second to Ruby.
>>
>>57523372
>Python is great except for "muh white space".
What exactly is your problem with it?
>>
>>57523215
Nah, it's mediocre at best.
>>
>>57523372
Not diverse enough
>>
>>57523491

kek

How about "muh colorspace"?
>>
>>57523368
>Django and flask are cancer compared to node and naked php
>>
>>57523215
I like Lua because of the way you implement classes using metatables. It's pretty elegant, keeps the language lighter, and no OOP specific keywords.

But C++ needs to stop being shilled so hard. It's not that much harder, but especially for games which so many people wanna use it for, you can get your ideas down more quickly with a scripting language.
>>
>>57524079
>get your ideas down
Confirmed for not being part of the cool kids club.
The cool kids of /g/ use Haskell or Assembly to not achieve anything of significance instead.
>>
>>57523215
The IPython repl is pretty nice.
>>
i've used python (2) a bit recently because of libraries.
It's an ok language. bytes/string encoding is annoying. Runtime exceptions on type errors are annoying. Passing self is annoying. Documentation could be better.

I'm not a fan of trying to make one language the language.
For me it's basically use the language in which a library i want to use is written in.
This way you actually learn a bunch of stuff.
>>
>>57524414
I'd love to think that way, but it is hard to be proficient in so many languages and this makes me very uncomfortable.
>>
>>57523291
None of that is arbitrary, you just haven't bothered to learn how any of it works.

something([a, b, c]) is not a method call, it's a function call. Methods operate on class instances, so you need to instantiate the class first. e.g.:
Class().method([a, b, c])
or
instance = Class()
instance.method([a, b, c])

If you understand that all of python's basic types are actually objects, the string and list methods like ''.join([a, b, c]) make sense. It's the same as doing
s = str() # I have instantiated the string class
s.join() # I am invoking the string's join method

len() is a function rather than a method because it operates on multiple types like lists, strings, tuples, etc. (it actually calls an internal method that allows each class to define how len is determined)

When defining methods, you explicitly pass self because there are situations where you might not want to do that. For class methods you pass cls, and you don't pass any context for static methods.

String encoding is simple. In python 3, strings are UTF-8. Sockets and other objects that operate on raw bytes take bytestrings. That's all there is to it, and those are the only times you have to convert.
>>
>>57523215
>python 3

GET OUT
>>
>>57524635
>I hate Python 3 because my favorite library has not been ported and I'm too incompetent to do the conversion myself
>>
>>57524645
>implying i'm going to do a bunch of extra work just to use a slightly different version of the same language
>>
>>57524635
Python 3 is considerably better
>>
>>57523215
I prefer C#.

I for one prefer curly brackets.
>>
>>57524537
most mainstream languages are the same anyway
>>
>>57523215
Yes

Neckbeards will disagree
>>
My only complain so far is the inconsistency across different versions with the Windows API.

        while not hdl:
hdl = windll.kernel32.GetStdHandle(handle)
# prevents weird behaviour where Windows does not
# return anything and the loop freezes.
# It does not really wait any ammount of time except for the call
# ??????? Python 3.4 needs it / Pyhon 3.5 does not ???????
time.sleep(0.0001)


I just don't get it.
>>
I've been using Python at work a lot and it's crept it's way to my side projects as well.

I still don't feel like I'm proficient writing Python and there is just something about the language which rubs me in the wrong way which makes me feel like learning something more "real", but I never pick up anything else
>>
>>57523444

It's essentially the same with .length and .__len__ in python3. Just the old code that uses len() is numerous I reckon
>>
>>57523215
Python is awesome OP !
>>
>>57525227
Er, what?
>>
>>57524645

You're giving him way too much credit. I doubt he's even a serious programmer. My guess is that he just like to have an edgy opinion on something, to fool others into thinking he's smart.
>>
>>57525266
len() an is old convention that got preserved. You can access length as an attribute in python3.
>>
>>57525283
Coming from Ruby I find Python3 to obsessions with brackets disturbing
>>
>>57523215
Coming from C, I started tinkering with python because of the extensive modules available.
Onestly tho, I'm having an hard time using it because there's too much 'magic' for my taste.
And even if you try to look what the module you are using does, it will be pretty difficult to understand because of course they in turn use tons of others modules...
I'm just more proficent in C, because I know everything I code.
Also, indentation resulting in errors is bad.
>>
>whitespace with syntactic meaning
it's shit
>>
>>57525392
>Also, indentation resulting in errors is bad.
Just indent correctly.
>>
>>57525305
What? There's no .length attribute in Python 3, and .__len__() has always existed.
>>
I've never understood the whitespace issue. It's not that difficult to indent properly, is it?
>>
File: indention_style.png (66KB, 597x255px) Image search: [Google]
indention_style.png
66KB, 597x255px
>>57525392

>indentation resulting in errors is bad

I'm not a huge fan of this, but I never found this bad either..

I mean everybody uses indention, right?
It's just a convention to make it more readable by avoiding braces, see the pic.

No big deal.


>>57525316

Likewise. Ruby is such an distustingly cute language, it's hard to not rant about the small differences in Python, i.e. the braces or whitespace indention. But if you keep them seperated in your head, you can be a good Pythonista and a good Rubyist at the same time. I like Python for it's amazing libraries (i.e. numeric computation, GUIs) and Ruby for anything web related.
>>
>>57525514
hating forced whitespace is a meme.

especially when you consider the autistic lengths these guys go to for "MUH CONSISTENCY" in other languages.
>>
>>57523215
i respectfully disagree good sir
>>
>>57525565

>hating forced whitespace is a meme.

"The Python programming language was also a language candidate. The reason the Metasploit staff opted for Ruby instead of python was for a few different reasons. The primary reason is a general distaste for some of the syntactical annoyances forced by python, such as block-indention. While many would argue the benefits of such an approach, some members of the Metasploit staff find it to be an unnecessary restriction. Other issues with Python center around limitations in parent class method calling and backward compatibility of interpreters."
>https://dev.metasploit.com/pipermail/framework/2006-October/001325.html
>>
>>57525514
Python's forced indentation overloads the concept of whitespace with two non-wholly-overlapping definitions, leaving it up to the programmer to infer which meaning applies in a given context based on visual cues.

Yes, it's easy to use. No, it's not hard to indent. My objection is to the philosophy of the decision, not the practicality.
>>
seriously, why python 3?
>>
I prefer Ruby as a Java dev who hates Java. Python feels like something in between those two. A bit more annoying than Ruby and a bit less of a chore than Java.
>>
>>57525738
because it's better in every way
>>
>>57525738
PEP 3102
>>
>>57525627

To be fair, wether you programm Python, Ruby, Bash or Lua you will always follow certain style conventions. (Let's not talk about Perl here..)

>>57525685

You could also argue that it enforces a proper formatting, which is not necessarily a bad thing.

I generally think that Pythons strengths is that they try to make code is more "idiomatic" (which not 100% true, but they try). So when you look at legacy code you can see what's going on pretty fast, unlike languages where you have more "freedoms". Show me 3 C++ programmers and I'll show you 4 differnt programming/formating styles.
>>
>>57525627
Article is literally meme argument incarnate.
>>
>>57524079

I want to like lua but it looks hideous.
>>
>>57523215
I agree but i'm the only one at work who uses it..

I'm getting forced to use c# and powershell, because python is not default on windows platforms.
>>
>>57525829
One could argue that, but I wanted to avoid that issue. I don't personally think that a language's spec should be in the business of enforcing formatting aesthetics, but I recognize that's a personal objection.

I don't personally think any benefits gained from enforcing formatting guidelines outweigh the negatives, but if I made that argument in the first place then we'd get in a big huff about whether it really does have a positive effect, and I thought that would be a less interesting discussion.
>>
>>57523215
no multi-statement anonymous functions
into the trash it goes
>>
>>57523215
Python is the most disgusting language that's actually being used and considered a serious languge (so PHP etc. don't count)

and I don't mean syntax, that's irrelevant. I mean semantics. like holy fuck name errors and type errors at runtime? who the fuck thought this was a good idea? Never mind the fact that they can't even get together a decent REPL

How people can willingly condemn themselves to cripplingly inefficient test-crash-fix loops on an error-by-error basis is beyond me
>>
>>57525878
>holy fuck name errors and type errors at runtime? who the fuck thought this was a good idea?
That's the nature of an interpreted language with duck typing?
>>
>>57525878
I don't think lack of a decent REPL should really count as a fault of the language.
>>
>>57525866
>powershell
I feel for you. Such a powerful tool wrapped around the worst shit you could even think of.
>>
>>57525940
>an interpreted language with duck typing

The question remains: who the fuck thought this was a good idea?

>>57525878
>How people can willingly condemn themselves to cripplingly inefficient test-crash-fix loops on an error-by-error basis is beyond me

My guess is that they don't know any better.
>>
>>57525878
>Never mind the fact that they can't even get together a decent REPL
What is IPython?
>>
>>57526031
http://softwareengineering.stackexchange.com/a/122212

Also, Python 3.5 introduces type hinting.
>>
>>57526054
having to install something from a third party to get a decent repl doesnt put python in a good light
>>
>>57526242
Because Python was born in the age of the internet and collaboration. Third party is an obsolete term when used with Python.
>>
>>57523215

You accidentally said programming when you meant scripting.
>>
>>57523215
I switched from C# .NET to Python best decision in my coding life
>>
I like python for stuff that isn't performance critical. I've tried convincing my co-workers to use python. I immediately get shot down because it's open source and doesn't have an ISO standard. They insist on writing hundreds of lines of c++/Java instead.
>>
>>57526101

The topic has been discussed to death. Most of the arguments that try to defent dynamic/weak typing boil down to
>it's more hackable! (easier to build something that barely works)
>you don't need to learn how to use the type system
>you can do that too... sorta (eg. classes)
>you should write tests anyway
It's clear, even from that answer alone, that static/strong typing is backed by the most solid and factual reasons.

And it's a pity that just when the C language started to be seen as a dangerous, unsafe language to avoid, the industry was flooded with webdevs and their shitty scripting languages that break whenever you're looking the other way, not to mention the fact that they are unavoidably slow as molasses even when they work. Thankfully C# and Java are still alive and Rust was born recently as a light at the end of this tunnel.
>>
>>57523291
>Also why do you have to pass "self"?
class instances bind themselves to the instance methods, that's why.

>>57523325
>";".join
try:
str.join(';', [a, b, c])


>>57524603
instance = Class()
Class.method(instance, [a, b, c])

also works
>>
>>57523360
JavaScript has problems because of its weak standard library which makes it extremely framework dependent and flavor of the month.
>>
Python is beautiful but Rust is more beautiful
>>
Ruby is more consistent, more expressive, and easier to use.
>>
>>57526639

JavaScript is a botched language right down to its badly designed syntax. All those frameworks are attempts to mask the underlying mess which would be impossible to work with directly. The fact that most of them are webdev babbys' first code and that they're mostly used to bloat up websites contributes to the JS hate.
>>
>>57524603

>s = str() # I have instantiated the string class
>s.join() # I am invoking the string's join method

And that's exactly the point..

You say to an STRING instance:
"dear string, copy yourself behind each list entry of the following list".. Basically the logic is that a string can somehow multiply and merges itself with a list. Uhm..

While in Ruby ("list.join") you say:
"dear list object, produce a string with the following delimiter."

Way better.

>len() is a function rather than a method because it operates on multiple types like lists, strings, tuples

And again you create another "dimension", you have to remeber wether an method is a function or part of the string class. And you create a overloaded function that takes an list/tuple/string and try to "count" it (which means differnt things for differnt objects). This is just bad design from the dark procedural ages..

Why not giving list/tuple/string the "length" method, since the object knows best what "length" means for itself?

Those are the sublte reasons why Ruby is way more well-designed than Python.


>>57526639

ECMA6 is pretty good, desu sempai.
>>
>>57523215
Python doesn't like me much. If it try to do a mixture of tabs and spaces it just keeps throwing endless indentation errors and refuses to run.
>>
>>57526900
> using tabs at all
>>
is it possible to make a full featured game in python.
>>
>>57526945

Yes, depeing on what you want to do.
>>
>>57526886
Join as a string method is convenient because it allows any iterable to be joined.
len() calls obj.__len__() so again, it's for convenience
>>
>>57527153

>Join as a string method is convenient because it allows any iterable to be joined.

I still prefer "join" as method of any iterable..


>len() calls obj.__len__() so again, it's for convenience

But if you call a function at the object anyway, why not just making it more readable??

But why not using "[1,2,3].len()" in the first place? It's not convenient if the result is not logical because it's actually just a short cut.

My only explanation is that "[1,2,3].__len__()" means "this is an method with two underscores, so stay away from it!", but this is quite a stretch. You introduce a (wierd) shortcut for an simple function, so people COULD add their own ".len()" function while the "__len__()" function would still be available..

I don't really think the end justifies the means here.
>>
>>57523215
would like to agree but havent started the journey yet.
can you recommend any resources for beginners/retards?
>>
>>57526288
>Because Python was born in the age of the internet and collaboration
what the fuck is that even supposed to mean?
>>
disgusting. switch to go to find a beautiful language with 100% consistent grammar and style.
>>
>>57527744
There is a e-book my friend recommended to me called
>Learning Python the hard way

Also get a python bible while you are at it.
>>
I enjoy python, i just made rss downloader. I love using dictionary mapping as a switch work around.
>>
>>57523215
Python is Ok honestly, but I've been dealing with some issues the past year that's worth mentioning:

Dependency management is a major headache. For instance, at work (government agency) I have a Linux PC that's pretty much secured down to the pip commands so I can't just install dependencies. I have to get the system admin to run pip for me which is extremely annoying when you are developing and want to test out libraries. I've thought of resorting to using virtualenv or a standalone Python distribution like PyPy, but good luck writing a procedure so that normies can get a standalone Python distribution installed on their machine.

Low-level programming is extremely frustrating. I have a header file in c++ with struct definitions and a helper Python script that generates packer/unpacker methods for it in c++. The generated files then are wrapped using SWIG and then imported in my main script. This works fine except when I'm reading bytes from a socket and trying to unpack them using the imported c++ library in real time. Good luck passing a ByteArray (or memoryview) object to C++ using SWIG. Also forget about doing bit manipulations on a ByteArray because you have to keep casting shit from char to int to string to BitArray back to int and then again to char. You end up writing 5 lines of Python while it would've been 1 line in C++.

Overall, Python is very good at doing high level stuff, but as soon as you start diving into low level shit it becomes a huge time sink..
>>
File: warrior_queen_of_pol.png (390KB, 531x715px) Image search: [Google]
warrior_queen_of_pol.png
390KB, 531x715px
" ".join(list)

string.split(" ")


U wot m8
>>
>>57523215

it's extremely slow and doesn't deal with memory
>>
>>57523215
Wait until you have to use it in a industry project. You'll change your mind then.

Dynamic typing combined with Strong typing is a mistake
>>
python + string is fucked up.

OP is retarded and probably doesn't do anything really worthwhile
>>
>>57530593
>python + string is fucked up.
In what way?
>>
>>57530117
it's to allow any iterable to be joined. if it was a method on lists, then they would need to implement it on sets, tuples, etc... and anyone making their own iterable not inheriting from existing iterables would have to implement their own join method.

this is pretty clearly and concisely explained if you just look up "python why is join a string method" on google.
>>
>>57530670
he's probably referencing the fact that python 2 dealt with strings in a stupid way, hence the (breaking) change in python 3. what's crazy is that people blame python 3 for the breaking change rather than python 2 for being broken in the first place.

but lazy developers in any language will bitch and moan about change, even if it's clearly for the better.
>>
Python is a shit language for retards.
>>
>>57530771
In what way?
>>
>>57530812
why even engage with people like him, dude? the next 20 minutes trying to engage with him to give you concrete reasons that "python is for retards" is going to be like pulling teeth.
>>
>>57525941
Most level headed post in the whole thread
>>
>>57523215
>100% of my programming is now in python
Lucky you. I've still got to work within the JVM ecosystem. It's fucking terrible.

Where are you getting paid to write excursively in Python?
>>
>>57528191
Sounds like you may have to write your tests in c anon. No idea why anybody would want to work with low level compiled code in a completely different language
>>
>>57530912
>JVM
JUST


But I work for a company that creates an API parser / analyse distrubuted over dozens of servers throughout the world for thousands of services.


Stack is Luigi -> Python3 -> CouchDB -> Flask -> Memcached. (If they're not accessing our api themselves)

Shit is fucking fast to work on and add support to. (Human time being more valuable than cpu time)
>>
>>57530971
I work as a part of a bigger project so someone else is responsible for the header file I have to use to unpack the bytes into structs. And I can't use c++ because I need to be able to run Python commands in real time... My job is to build a Python glue so people can easily visualize the data on the socket and run Python commands at the same time.

SWIG works pretty well for wrapping C++ code, but sometimes it's takes some time for one to get familiar with it
>>
>>57523291
this
Ruby solves all this and more
all praise Ruby
>>
>>57527419
>I still prefer "join" as method of any iterable..
Then you have to write a method for every iterable class. It's inconvenient, considering join is more to do with the string than the iterable.
>But why not using "[1,2,3].len()" in the first place?
Why unnecessarily 'reserve' that method name?
>>
Hey python fags, watch this

switch(flag) 
{
case n:
...
break;
}
>>
>>57528191
What do you mean by
>secured down to the pip commands
?
pip install --user apackage
>>
>>57531853
http://code.activestate.com/recipes/410692/
>>
>>57531867
> Permission denied

It's a system managed by an admin and LDAP to make sure classified info doesn't get out. It's not that easy...
>>
>>57531853
I_HATE_NIGGERS = {
"whatever":lambda ....
"holocaust":hitler
}

if flag in I_HATE_NIGGERS:
I_HATE_NIGGERS[flag]()
>>
>>57531973
Permission denied to even use pip??! What can you do? Install from source?
>>
>>57531973
What do you do / create exactly?
>>
>>57531853
switch is redundant
if case 1:
...
elif case n:
...
else default case:
...
>>
>>57532035
If it can be written such that the cases are hashable, then a dict is much much quicker
>>
>>57532073
less readable and in most cases if saving 2ms is important then you shouldn't be using python for whatever you're doing
>>
>>57532151
I don't think it's less readable, personally, because the actual switching part is more concise. Then again I find multi-line list comprehensions easier to understand than equivalent for loops.
>>
>>57532017
I can't go into much detail but I'm on the Mars 2020 project.
>>
lambdas in python are really ugly thanks to weird separation of expressions and statements.
the way variable scope works is a little odd but it works fine.
whitespace having syntatic meaning sucks for REPL use.
the transition from python2 to python3 was a huge mess and it's left us with people who are still religiously against 3.
threads suck.
>>
>>57532280
>threads suck.
What's wrong with threads?
>>
>>57532290
GIL
>>
>>57532290
Not a fan of the threading library syntax and cpython's GIL makes them largely useless for many use cases. I don't mean to be someone yelling stupidly about the GIL, it's an elegantly simple solution to a difficult problem, I just don't like the tradeoffs that are made as a result of it. But then attempts to remove the GIL and do benchmarks have been as slow or slower as with the GIL so idk.

It just kinda sucks to have to spin up a new process to get the advantages that threads would give me in many languages.
>>
>>57530758
>python 3
>one way to do thing
>present 10 ways to format a string.
>none is really effective so they keep introducing a new way with each release
>>
>>57532902
I know of two ways. One is strongly preferred over the other. What are the other 8 ways?

And how are they not effective? What does effective mean?

I really mean all these questions I'm sorry if this sounds stupid but i googled this and "effective string formatting python" didn't surface anything.
>>
>>57526639
i don't know anything about programming so don't get mad, but this suddenly made me interested in the topic. what is a "standard library"?

i'm inferring from your post that a "standard library" basically standardizes how to do simple stuff in a language.

and when you say javascript is "framework dependent", does "framework" basically refer to "a subjectively useful set of standards that someone created and a bunch of people agreed those standards were sensible/good and started using them too"?

in order to use these various "frameworks" does that require you download some external tools or does javascript "natively" interpret it by default?
>>
>>57532934
????
>>
>>57533214
By standard library he probably meant the built in features.

Framework dependent I think means that basically you need to include all sorts of stuff to make it usable. For instance you need express, node, and a bunch of other libraries just to make a webserver. Or you need angular and jQuery just to use it as a front end framework
>>
>>57531124
Goddammit that sounds like heaven. Keep through dream alive for me brah.
>>
>>57533489
Only idiots need jQuery, node is the javascript runtime it is not a fucking "library", and I've yet to see any significant projects in Python using the standard GUI framework instead of something better like Qt.
>>
>>57533214

library = written code or binary that implements a set of related functions you can invoke in your program

standard library = a library that comes by default with the language and performs basic functions, like string manipulation and interfacing with the platform input and output

framework = an extensive library that sets a structure for your program, kind of the backbone of your application, often expected to be used with what you refer as "set of standards". in the js world, given the extremely limited std library, a framework is a necessary environment for your application to do useful stuff
>>
>>57533612
A framework is the standard for doing useful stuff in every language. Unless you're an autist and wants to reinvent the wheel every time.
>>
>>57533564
I never said node is a library. And almost every website uses jQuery. Youre an idiot if you try to reimplement shit that's already implemented in jQuery
>>
>>57533665
There is no need to reimplement anything because the native dom libraries are perfectly fine.
>>
>>57533676
Sure, the native library certainly has show/hide animations, collapse/expand, etc
>>
>>57533706
>animations
literally bloat for faggots
>>
>>57533712
Literally
>>
>>57533311
He was lying, there's only two ways
>>
>>57523215
>friend asks about algorithm in python
>sure why not
>it's slow as fuck
>do some googling and reading
>make a few adjustments
>faster
>still slow as fuck
>try to improve but interpreted+underlying data/memory model leads to some counter intuitive situations
>IDE always crashing so hard to edit/speed test
>try another IDE
>IDE always crashing
>IDEs are also slow as fuck
>who the hell likes this fucking shit?
>rewrite in C
>9,001x faster on first try
>"here you go; learn a real language friend"
>>
>>57537199
name the algoritm, name the IDEs
>>
>>57537212

PyCharm is the one that's still on my notebook's SSD. Don't recall what the other one was, it was quickly deleted.

The program was for something he was doing at work.
>>
>>57537199
Yeah it's slow, it's an issue shared by all interpreted languages. Generally speaking, gains in developer productivity outweigh the loss in speed. Also, there is always the option of dropping down to C for performance critical parts.
>>
>>57537272
why the fuck would you use an IDE for a scripting language, why not just use notepad++ or vim? this seems beyond stupid
>>
>>57537434
>/g/: Informed Opinions
>>
>>57537617
not really sure what you mean by this but I'm pretty sure it's a compliment so thanks
>>
I'm trying to learn python, have no past experience on programming.
putting the method after the variable really bothers me.

(title.name) makes more sense to me (the method title works on variable name, than
(name.title()) wich is the right way.
is this a normal thing and I just lack experiende or is a python thing?
>>
>>57538258
You're a mongoloid
>>
>>57523370
>It's not as arbritrary.

It is arbitrary. There's no good reason to have a global function len that just calls __len__ on the object. The operators and classmethods you speak of could just call __len__ directly and __len__ can obviously be overridden. Most of the double underscore methods are just legacy hacks.

Guido has always been a retard so it's not surprising.
>>
>>57526814
This. Python has much better scientific libraries but Ruby is an objectively better language. Dynamic typing is a mistake either way though.
>>
>>57538258
son, are you retarded?

i hate when people say that to me here, but this is just borderline retarded
>>
>>57523325
Reading fluent Python gives some insight into why len(x) has that syntax. Basically it's meant to be more of a core override-able operator than shouldn't be associated with any one type.
>>
>>57538856
Calling len(x) is actually faster, as it doesn't always call __len(x)__. Strings, for instance, are optimized to get the length without having to call any additional methods. In a way, getting the length of a string is more retrieving a value than calling a method.
>>
>>57539020
There's absolutely no reason that String.length couldn't do the same thing.
>>
>>57539020
So len actually dispatches on type. Python is even shittier than I imagined.
>>
What's the best way to create a program that install programs?

# helper.py

def runwait(cmd):
pass

def unzip(archive, destination):
pass


# install.py

_install_dir = ""

def install_firefox():
pass

def uninstall_firefox():
pass

def install_atom():
pass

def uninstall_atom():
pass



OR



# Installer.py

class Installer:

def __init__(self, install_dir):
this.install_dir = ""

def runwait(self, cmd):
pass

def unzip(self, archive, destination):
pass

# FirefoxInstaller.py

class FirefoxInstaller(Installer):

def __init__(self, install_dir):
super().__init__(install_dir)

def install(self):
pass

def uninstall(self):
pass
>>
>for i in range(x,y):

>no way to reset i
>have to use a while loop

gayest shit
>>
>>57526949
A complex 3D game engine?
>>
>>57539154

Full retard
>>
>>57523215
give me a solid tutorial series and im all in. i just need a good base for learning it, dont want youtube vids
>>
>>57539173

>Python as a first language

Idiot
>>
>>57523325
never use
type(x) == yourType
>>
>>57539201
why?
i dont need any in fact. im working as a webdev with js and scss.
I thought id be interesting to learn python for some home ideas
>>
>>57539072
What?
>>
>>57539210
What if you want to test belongs to a class but not any derived classes?
>>
>>57538258
>is this a normal thing and I just lack experiende
yes

i have literally never seen a language that formatted method calls as method.object
>>
The biggest problem with Python is that it lacks a do;while loop
>>
I kinda wanna learn it to use it as a general purpose high level programming language
should I learn 3 or stick with 2.7
>>
>>57540031
please learn 3.x, for the love of god

it's bad enough with all the legacy coders refusing to move to 3.x out of laziness, you don't need to contribute to the problem
>>
>>57540181
Learn 2. None of the big companies use 3 and he can't even convince his own employer to switch. Python will die completely before people adopt 3.
>>
>>57539154

I would use Godot. If you make your own engine you will never finish a game. And while not python godots scripting language seems pretty python inspired.
>>
>>57540031
Learn 3. I learned with 2.7, recently switched to writing "in" 3. 95% of my code is directly compatible with both, and it's generally easy to port from 3 to 2 (whereas the other way round is more difficult).
>>
>>57540388
t. unemployed NEET
>>
>>57523360
well as anon stated support of different libraries.

and my personal opinion, i always lost it when i see those
import com.android.lets.go.deeper.oh.here.is.my.module

but that is just personal opinion, don't h8, get l8
>>
>>57539143
> the language is shit because I can't use whatever keyword I happen to like

>>57539544
dothis()
while condition:
dothis ()

Whew, so much harder, my fingers broke when I had to write the function name twice

>>57537199
Are people here incapable of learning multiple languages?
Write the bottleneck in C and then handle the trivial shit in 10 lines of Python rather than 500 lines of C.
>>
>>57538726
I wish I was one.

>>57538909
neither.

>>57539533
thanks. only useful answer. as I stated first in my post, I lack any knowledge about writting code, so I didn't know this was the normal thing, in my head, the opposite makes more sense, so I'll have to get used to it.
Thread posts: 174
Thread images: 3


[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.