« first day (1030 days earlier)      last day (3921 days later) » 

12:03 AM
@EiyrioüvonKauyf I think this weakref thingy is exactly what I was looking for...
 
@JonClements cabbage strikes again
 
thank you, will give it a chance -- and let's just see what it really does;)
 
you can also look at import gc
it shows all currently tracked files
and it only tracks certain ones
 
 
1 hour later…
1:22 AM
These lambda functions in python are amazing. :D (Random)
 
1:37 AM
@Interrupt yes they are
 
God dammit
I was around 80 consecutived days on meta
Then I didn't go on yesterday
 
@Haidro haven't seen you around for a while
 
Yea, been busy
 
no
C++ has pretty amazing lambdas too
also Haskell
it depends what you're doing
 
Guido didn't like lambda's
 
1:47 AM
What's a lambda
 
guido doesn't like alot of things
@Haidro :|
 
def func(x):
    return x ** 2
pls
 
how do you have 11k in python rep if you don't know lambdas?
 
@Haidro 2 .__rpow__ :P
 
I know what lambdas are :)
@Volatility 905
 
1:48 AM
@Haidro 900
 
heh
 
got 4 random upvotes this week
and a random accept
 
I got downvoted on three posts at the same time a few weeks ago
Still hasn't been reversed
Nothing really I can do now
I've flagged it, but the flags just say "helpful" and nothing has happened
 
Oh yeah, that
 
1:50 AM
...
 
oh for gods sake
o_o
why why why
@Haidro my eyes hurt
 
Same
 
@Haidro can we ban him from python
like globals() has credits
we should have globals()['bans']
 
morning, guys
 
actually night
nice prof picture ;)
 
2:12 AM
uhh
 
same as your head
:d
 
hungry so much
it's lunch time
 
Straya?
 
2:23 AM
no
Austrlia is my dream
 
I want to live in Austrilia as immigrant
That's a beatiful place
 
where are you from?
it's doesn't seem to be an English speaking country
 
What do you mean by that
 
?
it's pretty obvious
 
2:28 AM
How so
 
I'm from China
 
thought so
2 things
1) australia has many people that are racist against asians and immigrants so ... just a thought
2) what province if you don't mind me asking?
 
Hubei Province
 
interesting ^_^
are you in univ
 
no, I have workde for one year
 
2:32 AM
i see
 
where are you from? you are seems to be familar with china
 
i'm from US
but i have many asian friends
mhmm oh in spring i visited Xi'an and Shanghai ^_^
no inner city provs though
 
cool
welcome to China
How about US for immigrant
 
i see so you want to immigrate
honestly it's hard :(
i wish you luck!
 
difficult in speaking English?
 
2:41 AM
but regions with asians tend to welcome asians afaik
 
naturally
 
so like California might be nice for you? also parts of New York etc
uhhh no more like the US isn't really happy about foreigners at the moment
"they're taking our jobs" and all that
so the amount of foreign people being accepted is going down
 
so upset
 
if you can find a company to sponsor you you're good
also an education visa and a few more are common ones i know
 
How about programmer in US? If i can get a job there, it will be convenience?
 
2:49 AM
that's one of the ways
Baidu has a California branch I think?
haha I'm wondering if i want to try working in Shanghai :)
 
There are lots of programmer in shanghai and beijing
It's easy to find a job there
 
i see
was it hard to get a job after you graduated?
 
not very hard
 
did you go to Tsinghua o-o
 
no,
I'm in wuhan
 
2:54 AM
cool :)
nice buildings
 
Welcome to wuhan
 
one of my friends is studying at East China Normal University for the summer
sort of far from wuhan haha
 
it is in Shanghai
 
it's not very far from wuhan
 
2:57 AM
oh hmm
 
about 5 hours by motor car
 
Wuhan is like on the left of Anhei no?
thought that was far ._.
 
Anhui
lol
 
hehe sorry
 
The people talk to you is my gf
 
3:00 AM
安徽
 
her english is very poor
 
^_^
well i know 0 mandarin
so
 
you are genius
I can't wait so much to have a lunch
One hour later I will be died If no food is put ahead me
bye
 
made a stupid answer
 
3:56 AM
Just found out that someone's answer does work, partly. Hate not having edit. :P
 
4:08 AM
Fixed, only took 300 edits. :)
 
4:37 AM
@DarkHorse lol bye
 
 
1 hour later…
5:57 AM
@EiyrioüvonKauyf Hi
 
 
3 hours later…
8:54 AM
Hello
Feeling very slow today. Can anyone help with the following: I'm checking if an element from array X, is in array Y. Problem is, array Y is of the following format [[Target,NotWanted],..,..]. How do I reference the first element of each element in the array?
Sorry, LIST not array.
There we are. Knew it would come back to me: [x[0] for x in Y]. Cheers :)
 
 
4 hours later…
12:53 PM
Hello
How would I turn
dict_items([('WESTS', 3), ('EASTS', 1)])
into a list?
Oh, don't worry
teams = list(teams.items())
 
 
1 hour later…
2:25 PM
hio
 
hello @JunatanmDegraded
 
Hi
I need help, I just started Python.
 
let's see if I could help
;)
 
    I get this error: <__builtin__.python instance at 0xfc0316c0>>

    My code:


class python:
    myvar = 0;

    def __init__(self, number):
        self.myvar = number;

    def hello():
        print myvar;

test = python(5)
print test.hello
I program in Java, php, javascript, and to be honest Python is so different.
 
first of all do not use ; at the end of the lines
you don't need that
 
2:27 PM
Yeah I used to, it's weird how python doesn't ahve that
 
it's wierd at the first place
but after 2 weeks or even less -- you will think about the other languages:
 
Haha yeah
 
why are they using those idiot braces and semicolons?;)
 
I just removed it, getting the same error.
 
anyway
back to you problem
oh it's not a source of error
you don't call hello
 
2:28 PM
I coded it at learnpython.org source, can it be because of that?
 
there is no error in your code
since the output is a function object
which hello is
if you want to execute hello
you should write: print test.hello()
 
Oh
Can't it be like in java or other languages?

public void hello() {
System.out.println(myvar);
}

class.hello();
That's so weird haha
Also why doesn't python use public, private , protected?
 
sure it can
def hello(self):
    return myvar
 
What is self?
 
and then print test.hello()
self is a conventional variable name
this refers to the first argument
of a method (a method is a function inside a class)
so that means
hello(self) == hello(<reference to the instance of your python class>)
 
2:33 PM
class python:
    myvar = 0

    def __init__(self, number):
        myvar = number

    def hello(self):
        return self.myvar


test = python(7)
print test.hello()
 
back to your question: in python you don't need public, private, protected vars or methods -> the philosophy is: we are adults here, we know what we want and when we want
besides that
 
Ok this returns 0, while my consturctor sets it to the given number (7) ?
If i don't use self, it will just say myvar is undefined.
 
you can always access to any private/protected stuff in any language if you really want.
yes
because
self.myvar = number
 
Oh sec
Yeah thats it
 
and you should delete myvar = 0
 
2:35 PM
So self is like in php, uses the variables inside the current class
But in PHP you only use self in a static
 
because you are automatically rewrire that value
 
Are there static in python
 
in the instance creation, since __init__ is the constructor
 
Are there arraylist like in java?
myarray.add(item)
 
first things first: DO NOT try to copy you knowledge from other languages and try to mimic those in python
 
2:37 PM
Ah yea bad thing
 
python is pretty powerful, easy to read and has it's own logic -- which makes it amazingly productive
 
You have any knowledge in creating websites with Python?
 
other languages has their special stiffs also -- which is not bad
bbut you can't code in a c++ way in python
websites? you should look at django
 
I have it installed, lol but could not know how to use it.
 
it has a really great documentation online
but before you use it, make sure you are comfortable with python first
 
2:40 PM
Yeah but I have no idea why do I have to set some URLs and stuff
 
anyway @JunatanmDegraded read these: sopython.com/Tutorials
 
Ok thansk
 
Does python have autoloads? Like I can make every class in its own file?
 
you mean import?
 
2:46 PM
yeh, thanks
didn't know it has importing
Peter, do I have to compile python files to make the update effect?
 
no, python does that for you
 
Ah, also is there any main method that runs the whole application?
 
no, you decide what is going to be the main -- if you want to create a function for that
 
Ok thanks
 
there is a formula, if you want to make sure that a function or anything else is only called and running, while you are running that script/module as the main script
if __name__ == '__main__':
     main()
 
2:54 PM
Ah yea I saw this on SO
Peter, how can I pass my inputs to the script's console, for example I write in '5', and the script will take user's input and do actions with it, and return a message or something.
 
a lot of developers using this formula to put the tests inside teh if branch
so when you import that module, it wont run
but of you run that module as main, the tests will alive
@JunatanmDegraded raw_input() if you are on python 2.x and input() if on python 3.x
 
I noticed that NotePad++ doesn't make true or false blue, does python have true / false booleans? like myvar = true
 
True / False
 
Oh, with caps
 
but @JunatanmDegraded please RTFM!
 
3:00 PM
RTFM?
 
Read The Freaking Manual ;)
 
Ah, not a fan of reading, but seems like I wll have to lol.
 
I know it's much easier to ask -- and in this room we try to help to anyone but, if you didn't tried something before -- just asking -- that's not good
you won't learn how to use the docs and you won't learn how the language is working in the first place
for example, python has a legendary error traceback -- but you have to understand it
so you have to make mistakes, to see, what python says about those, etc.
heya @roippi
 
cabbage
 
cbg, potato?
 
3:05 PM
reasonably banana
puppy-sitting a friend's chihuahua currently
 
?
I don't like chihuahuas.. what can you do with them?
;)
 
they pretty much want to be on your lap or wrapped in a blanket 100% of the time
it's cute in an exhausting-I'm-glad-this-isn't-my-dog kind of way
 
really exciting.. adventurous
@roippi exactly ;)
 
game = True;

while (game):
print 1;
anything wrong? O.o
Unexcpected ident
 
you did not indented the print 1 line
an you are still using ;
and don't use () around game, just use while game:
 
3:10 PM
Oh okay, and yeah I am used to the ;, I dont even notice it >.>
 
hehe, np -- I'm only saying to make sure, you will remember that
 
you lose 1 PythonPointâ„¢ every time you use a semicolon
21
 
@JunatanmDegraded you know python has ONE important philiosophy, that the whole syntax is built on:
 
READABILITY!
 
3:12 PM
But what do you mean by indented?
 
use fours spaces
or a tab
 
I always use tabs
This chat resizes it thoguht.
 
but four spaces is better -- that is more of a python convention
although using tabs is not a problem
@JunatanmDegraded read PEP8 python.org/dev/peps/pep-0008
 
Ah thanks. But what do you mean by indented?
This helps
 
# error
while True:
print 1

# correct
while True:
    print 1
^ that is indentation
 
3:15 PM
Yeah fixed it
Seems like Python really cares about the code design
 
since we are not using curly-braces the parser should decide what is in the scope and what is not
@JunatanmDegraded sure thing! and once you got it right, it will be fun to reread your or others code later;)
this was also a philosophical decision: forcing the developers to indent their code is good, makes it prettier and easier to read and understand
@roippi I have a bernese mountain dog -- that is another dimension;)
 
import Handler

Main = Handler()
Main.run()
TypeError: 'module' object is not callable
 
I guess you have a Handler.py right?
 
what variable/function/class do you want to use from it?
 
3:23 PM
Main,

class Handler:

	game = True

	def run():
		while game:
			if (input() == 1):
				print 1
 
then:
import Handler
main = Handler.Handler()
main.run()
 
Ohh I need to call the module name
 
the . means in this situation is 'from'
so from Handler module the Handler class
-> Handler.Handler
and don't use () in if, just type: if input() == 1:
in PEP8 you will also find that: use short and lowercase names for module names
you should use handler.py and then import handler and handler.Handler()
 
@PeterVaro nice
I prefer big dogs as well
 
they are so much better;)
 
3:33 PM
@Hiroto Thanks! Somthing like ~/env would do then.
 
4:02 PM
thank you so much
 
 
2 hours later…
6:29 PM
llama?
 

« first day (1030 days earlier)      last day (3921 days later) »