Python moment
Python moment
Other urls found in this thread:
you are just a retard
You are just mentally challenged
retard moment
>getting filtered by local variables
OP is a faggot, always was a faggot, always will be a faggot.
Yikes. I can't believe I used to like python before switching to C++
I never wrote a line of python in my life, but when I look at that code even my intuition tells me "num" is a value, not a reference. A sensible compiler or interpreter should make a warning, though.
what am I looking at? am I supposed to be surprised or upset that a scripting language does pass by value instead of pass by reference during enumeration?
print([num + 1 for num in [1,2,3,4]])
why would an ide warn you about the normal behavior of a language? should you get a warning any time you reassign a variable that you are overwriting the existing value?
You are all faggots, OP is right and he was always right. My son says that language should produce warning on this.
Good job, son.
t. your mummy and dad
how are you this retarded
install D
void main()
{
import std.stdio: writeln;
import std.algorithm: map;
[1,2,3,4].map!(x => x += 1).writeln;
}
>filtered by pointer
you can do it fren i still have faith in you
OP, you just used an iterator, it has no side effects. What you want is:
a = [1, 2, 3]
a = map(lambda x: x+1, a)
a = list(a)
print(a)
Only retarded thing is that map returns a "map object", so you have to use "list", but it's not a terrible syntax.
Anyone knows why python does it this way with map? Why not simply return the same iterable type?
>bait_004.png
I think you should stay away from any programming languages. Try a normal excel spreadsheet desk job.
Map is iterable, but this helps with "lazy" eval is my guess, and is more performant
>bait_004.png
What am I doing wrong Any Forums? Why does the code on the left works fine while the one on the right hangs? Do I really have to populate an empty list for this?
t. retard who has been learning python for a while
seek help, Hans.
Your are altering my_list while iterating through it. It is probably running infinitely as you are adding new values every time.
You are foreach iterating the list so its 'locked'
There is no infi ite. Its just...it is defined to not able.
>python.org
Nice, danke user