Why is python so retarded?

Why is python so retarded?

Attached: absolute state of snake.png (157x137, 3K)

Other urls found in this thread:

docs.python.org/2/reference/expressions.html#is
guilload.com/python-string-interning/
jeffknupp.com/blog/2013/04/07/improve-your-python-yield-and-generators-explained/
twitter.com/SFWRedditVideos

somebody explain

>1488
ebin le Jow Forums frogposter REEEE XD

mfw its true :o

you can check integer by `is` up to 256

it's for retarded people, thats why. Who even uses is? That shouldn't be in anyone's language.

so people like you needs libraries like is-odd, is-even or is-number
sad

So in Python int is char?

is is used for checking data type, not value. All of these threads are the same. You use some random language functionality in the wrong way with undefined behavior and laugh at the output. Have an xD and a (You).

docs.python.org/2/reference/expressions.html#is
here you go, retard

No you're just retarded.

Its byte up until 256

Due to automatic garbage-collection, free lists, and the dynamic nature of descriptors, you may notice *seemingly unusual behaviour* in certain uses of the is operator, like those involving comparisons between instance methods, or constants. Check their documentation for more info.

kek kek javascript tier language

Implicit reference semantics in languages with mutability is fucking retarded.

It looks similar to String pools in java.
Common strings are Object of strings that are in pool by default,
so creating new String without keyword "new" just uses literal String object from the pool.
If you create 2 Strings that are not from the pool you are implicitly creating 2 different objects.

>is
you should use '==' for integers

In Python, 'is' checks that the objects are the same, not if the values are equal. Python also reuses the same objects for integers up to 256, so two variables with the value 10 are actually references to the same object, while two variables with the value 1488 are references to two different objects

You shouldn't use is for what you think are value types

>The only smart person in the thread

This thread again shows why dynamic languages are not really easier than static languages. You write your Hello World and you are happy how elegant it looks, but later you try to write a bigger program, you get bugs and you have to understand how the language works under the hood anyway.

>using is to compare integers
you must be retarded if you do something similar like this. And OP is obviously baiting or a retard who needs third party libraries with functions like 'is-even'.

>a = 10
If you want,
>a is 10
but "A" is "10" in binary.
>b = 1488
We're both humans, we're equal.
>b is 1488
but I'm not you.

English motherfucker, do you speak it?

are you high?

>giving this shitty explanation for a shitty language
heres a (you)

Huh, so that's where java got the shitty idea

how can 1488 have different type than b?

>thinks is operator is the same as int comparison
>doesn't know instances can allocate different memory blocks
>doesn't know CPython preallocates all integers from -5 to 255 for performance
>calls something retarded through sheer ignorace

Attached: enough.jpg (436x536, 51K)

Python interns strings/ints.
guilload.com/python-string-interning/

imagine allocating garbage collected memory for an integer

Python was my first language as an idiot teenager, yet I never tried using it like this. If I did run into an issue where I was misunderstanding the usage of some syntax or operator all I had to do was google and find the same issue asked about on stack overflow. If you legitimately see this as a problem neck yourself.

Perchance you shouldn't be designing a retarded meme language around certain keywords that mean something entirely different in plain English. ;^)

>1488

Attached: back-to-your-shithole.png (546x700, 484K)

>We're both humans, we're equal.
cringé et azure-pillé

1488 creates a new int object, 10 does not.
Small integers used all the time are pre created at the start of the interpreter and use the same object.

You don't compare something with is except you really want to check if it is the same object.

Hey retard, you're supposed to use "==" to check comparison. "Is" doesn't do what you think it does and it only "works" up to 256.

Same could be said about most languages if we're nitpicking.

Attached: CF54C22C92E3453F8A8BDD3F44EB575B.png (480x447, 357K)

guys this seriously isn't fuckin funny anymore

Attached: wahtnowpyfags.gif (640x420, 792K)

nobody

Attached: nobody.png (1328x409, 40K)

>he doesn't know what iterators and next() are

kys macfag

>t. self taught programmer

Attached: xx.png (709x677, 28K)

This
>Uses language wrong, pretends it's the languages fault
OP needs to choke on a bag of dicks

thanks for the explanation

Both returned true for me in 3.7

list is a list retard

why do people always knitpick irrelevant shit in python when they could just point out that it's some of the slowest garbage imaginable?

interesting stuff. Thanks for the explanation.

It's supposed to accommodate retarded sõyboys who think they're smart enough to program. What do you expect?

There are only 8 bits in a byte. 8 bits has a maximum value of 255 (0 included making 256). 257 and up logically REQUIRES at least one more bit to exist.

>b-better than java

try to figur out like that
>>> for i in range(100):
... if i == True:
... print str(i) + "is true num"
... else:
... print str(i) + "is false num"

i think python is the best language available when you are just hashing something out quick. the only thing i absolutely fucking hate about it is its logical operators... that shit fucking sucks because of how the langauge has arbitrary precision by default

Not a chance. Java is actually fast.

Java is actually very fast the 3 billion devices thing is a meme but there is truth to it.

That surprises me. I would think it would run relatively slowly, given that it runs in a virtual machine. Probably faster than Python, since it's compiled, but still slower than other compiled languages.

What about it?

No. Java's VM is pretty good except at providing the lowest possible latency. And there are of course more than one VM.

Sure, *hypothetically* you can make native code faster, but in reality pretty much everyone don't have the budget and manpower to exactly write code like that, and then something running on the JVM is ~equally fast and also better insulated against various failures plus not rarely easier to debug and fix [saving more time for optimizations or features].

Ergo in reality, the JVM is one of the very most used things in big web hosting, big data, bit processing, big everything. [Not saying that these don't also rely on Linux' C code and so on, but yea, the heaviest part of the business end of software often is on the JVM].

And it's not only because it has been around for a long while, even the new(-ish) things like Spark, Cassandra, [...] are Java again because it just works well.

this

Proliferation by wide acceptance doesn't make something good. You'll find most web applications and sites are hilariously bloated; you find it's in big web hosting, big data, big processing, big everything. In fact, even the applications and sites themselves are big. Hence, bloated.

>applefag
that's why its fucking broken

Attached: wdym.png (337x83, 3K)

>Python also reuses the same objects for integers up to 256, so two variables with the value 10 are actually references to the same object,
How is this not catastrophic? If I change one variable the other one magically changes but only if it's kinda small.

It's not "wide acceptance" only, it's wide usage and quick projects to install it in place that worked. Many of the currently used JVM big data things are pieces of software that usually more or less just werk'd where decades of fucking with other frameworks just caused scaling and even programming issues.

Spark beat the crap out of decades of failed attempts with MPI / OpenMP / [insert a thousand less popular multithreading multicore distributed things and beowulf servers with a thousand approaches to API/ABI design and what not].
And Cassandra provided essentially actually scaleable SQL (+more, it doesn't have most of the no-nos you needed to learn with most SQL implementations individually, such as certain BLOB types fucking up everything). With easier access from various programming languages on top of it all.

They are not the only examples and it just keep on piling on at this point. I figure it's partly because of the JVM having diversified into multiple actually very competent languages with very powerful libs and tools, but also because the JVM and variants themselves can accommodate all of these as an useful runtime environment.

>you can check integer by `is` up to 256

Why isn't there a flag or something to increase the size?

So numbers after 256 should be False?
for i in range(256,512):
b = i
if not b is i:
print "False"

it's for Objects... not up to 256.

I did some benchmarks, why are python built in expressions and functions so slow? x ** 2 and pow(x, 2) were both 4x slower than x * x

10000000 iterations took (s):
x * x = 0.33803770334
x ** 2 = 1.33271883596
pow(x, 2) = 1.45926661514

>leftypol safespace literally crying for an anti white safespace

Your Python shell is fucked up. That syntax should create an iterator, but it's given you a generator.

Here's a page that explains generators:
jeffknupp.com/blog/2013/04/07/improve-your-python-yield-and-generators-explained/

The general answer to this is that Python didn't really have a systematic design, it mostly was just terribly hacked together.

If there would be a flag for it there, it probably wouldn't be analogously in another comparable library function.

Why are you so retarded? That's not what is is for. It checks if twos things are the same object whereas == checks if their values are equal.

Attached: pythonequality.png (1267x410, 77K)

Because it's O(1). Multiplying n times is O(n), and only works on integers. You could check for special cases like if n == 2, but those checks would slow down every other case. That's hard to avoid with an interpreter.

All three versions perform identically in Pypy (JIT compiler), though. This is a perfect use case for Pypy.

Attached: pypy.png (172x46, 2K)

It's been a while, but if I remember right this is because ints are objects and instantiating them from literals used to (or still does?) involve a performance hit, so Python has 256 small ints already pre-instantiated to make common operations faster.
Typing "10" always retrieves the same pre-cached int object representing 10. Typing "1488" instantiates a new int object every time you do it, and therefore the first and second "1488"s have different addresses.

I don't think you know what those words mean

If you change a variable it becomes a reference to another object. Read it again and try using your brain.

>Neonazi doesn't understand a technical subject, blames other people for their own incompetence.
WOW, HOW UNEXPECTED.