« first day (1373 days earlier)      last day (3591 days later) » 
02:00 - 18:0018:00 - 23:00

2:02 AM
hai
 
Hello.
 
msw
hmm.. 2357112 is here but not here
oops
 
hai 235
 
msw
0(Im just lurking …
 
So, overexchange, you wanted to talk?
 
2:05 AM
am typing Sir):
For you point: 'The main in @main is defined to run the decorated function if the file is run as a script, while the main in def main(): ... is the function to be run.' this is what i understood
The main in @main is defined points to this function def main(fn):
am i correct?
 
Yes.
 
ok
so def main(fn) is defined to run the decorated function`def main():` , is that correct?
 
Yes.
 
my question is, As you said, When python interpreter reaches the line, @main, It executes the def main(fn): which is imported from ucb, But how does this function def main(fn): from ucb is able to call def main(): which is yet to be interpreted by python interpreter?
Shall i consider this as magic?
 
Here's how it works.
First, Python creates the function object from def main(): .... However, it does not yet assign it to the main variable.
Then, Python looks up the current value of the main variable, and finds the main function from ucb.py.
It calls the main function from ucb.py with the function object from def main(): ... as an argument. The main function from ucb.py runs the function it received.
Finally, Python assigns the return value of ucb.py's main to the main variable. This return value is the main function you defined.
 
2:18 AM
are you saying that, there are multiple pass done by python interpreter, and in first already python know the function object def main(): and in second pass variable main is named to object def main(fn):?
 
No.
 
Maybe if you from ucb import main as imported_main then decorate with @imported_main, this will make more sense.
You're confusing yourself by reusing names.
 
Indeed. The double use of the main name is awful.
Heck, the decorator itself is awful. It has a nasty initialization order bug.
 
@user2357112 Lab exercise is obviously to resolve such confusions and learn
 
University classes alway seem to encourage the worst Python practices.
 
2:22 AM
@overexchange: Not really. The whole problem you're experiencing is only slightly related to anything you're actually supposed to be learning in that lab.
 
Actually, if you look at the decorator's docstring, its example uses a different name for the decorated function.
 
yes it is my_run_function, that is why i say it is learning exercise
 
The lab uses main for both the decorator and the decoratee, though. See inst.eecs.berkeley.edu/~cs61a/fa12/labs/lab01/lab01.php
 
Actually, what the heck is the point of obscuring __name__ == '__main__' with a decorator?
 
hmmm am reading you answer now..
 
2:24 AM
I'd guess it's an attempt to avoid the issue of what __name__ and __main__ are.
 
@user2357112 am trying to understand this point: First, Python creates the function object from def main(): Is python creating function object [def main():] after entering into function [def main(fn):]?
 
No. The function you're defining must be created before the @main decorator can be called.
 
But how, it is below @main, python interprater is yet to reach this line [def main():]?
it, i mean, [def main():]
 
Try running this Python tutor as an example: pythontutor.com/…
 
pythontutor is not allowing inspect and sys modules
def main(fn): is using methods in this module
 
2:30 AM
Click the link I posted, it's a simplified example demonstrating the behavior.
 
from*
oh sorry about that
 
It doesn't immediately call the decorator when it hits the @main line.
 
First, the name main is bound to the imported function from ucb. Then that function is used to decorate a function called main in the current module, which rebinds the name main to the decorated function. Read the module from top to bottom, that's the order it will bind in at the top level.
 
@user2357112 In first step var main is named to main(f). In second step, something magic happened
@user2357112 the function defined below @main is passed to main(f) when @main is executed. what was that?
 
Here's the equivalent to the first link I posted, with things renamed so they don't rebind: pythontutor.com/…
 
2:36 AM
Okay, suppose you write something like f(g()).
 
Python doesn't immediately call f when it sees the f. It goes on and evaluates the g argument first.
 
It's the same with a decorator. The function you're defining is an argument to the decorator, and it has to be created before the decorator can be called.
 
oh this is syntactic sugar?
 
2:38 AM
Yes.
 
so instead of def main(): i can write any function name like def abc(x):?
after @main >
 
yes, as I just posted in the examples...
that's even what @main's docstring says
 
so decorator is def main(fn): ?and always decorator must have a single argument something like fn?
so that function defined can be passed?
 
Yes.
 
2:42 AM
return fn is doing all mgic in global frame where main will point to main() rather than main(f)
magic*
 
@overexchange see the documentation's explanation about functions, decorators are explained a few paragraphs down.
 
3:05 AM
Aww, missed my chance to close this as "opinion based", since no one can predict the weather. :)
 
@user2357112 For your point: 'The double use of the main name is awful.' I think the reason is to replace variable main binding from [def main(fn):] to [def main():](which ever function you define below @main)
if we define as [def abc():] instead of [def main():] below @main there would be two names pointing to two different function objects
 
yes
 
@user2357112 For your point: "If you pass arguments to your script on the command line (like python -i your_script_name.py argument), the @main decorator will call the decorated function with the text of the command-line arguments as function arguments (like main('argument') )"
Does decorator @main or any other name @abc take care of passing command line arguments?
 
3:21 AM
A decorator is just a function, it can do anything. In this case, yes the main decorator captures command line arguments and passes them to the decorated function.
Please consider trying to solve those basic problems, rather than understanding these details. You are asking questions that you don't seem equipped to understand. As you learn more by going through these lessons and others, you will be able to understand what is happening without asking us.
 
@davidism In your link, i think you are referring to this point: "The returned value is bound to the function name instead of the function object."
ok
ok thank you david
 
3:43 AM
@davidism another point, in the example , that is shown link, second() function is called explicitly
 
yes, it's just a demonstration of decorators and bindings, it's not the same as your code
 
But in my case link, How How run_tests() is being invoked?
 
guys i need lil suggestion
 
`print("Starting")
run_tests()
print("Ending.")` How these are executed in addition to binding?
 
@overexchange please re-read what I wrote above about focusing on the actual homework problems
 
3:45 AM
ok
 
@davidism : any idea how to automate the creation of apk file
?
 
yes, if I needed to do that, I would be able to come up with a way to
 
can you suggest me a way ..
i saw a website called appsgeyser ..
it basically takes an url from user and generates an apk file ..
how would they do it ?
 
You should ask them
 
well ,it's business ,why would they tell me ..
 
3:48 AM
Why do you think the Python room is appropriate for that question? Maybe try the Android room.
 
no .. they do all this in a server
so only i asked
 
Here is my suggestion: research how to build apk files, research how to write python programs, and write a python program to build apk files. Your question is too broad. Demonstrate an actual problem and we can help.
 
done it .. no clear info ..
 
Research and development are what's fun about being a programmer. Go forth and experiment.
 
3:59 AM
@david in this example link , when second() is called explicitly, the pointer points to @first rather than def second()? Do you think it make sense to know this?
 
4:27 AM
hi all
 
4:55 AM
cbg
heya @thefourtheye :)
 
@JonClements Cabbage Puppy :)
Just changed 3 DEs in my Ubuntu and not satisfied with anything
Any suggestions?
 
cup of tea?
 
Had 3 of them already :D
Looks like teas don't cheer me up anymore :(
 
Which did you try, and why didn't you like them? (DEs, not tea :) )
 
I'm still yawning, bear with me
 
5:01 AM
I tried Pantheon, LXDE and Cinnamon
 
I like XFCE, you might also consider MATE.
 
I liked a little Pantheon, are they anything like it?
 
@davidism oh, do you have an Amazon "wishlist" or equivalent?
 
Not at the moment
 
@JonClements I can create one, in 15 minutes. Want to buy me things? :D
 
5:05 AM
@thefourtheye don't think Amazon do scooby snacks puppy :(
 
@JonClements Ah, we hates it then
Gotta restart again, LXDE sucks big time.
 
Great, now Pantheon, OpenBox and the 14.04's default DE will not work.
Sigh... Bad morning
 
happy Sunday puppy?
I'm debating whether to go back to bed or not
seems to be an area I'm becoming less use to :(
 
@JonClements I vote in favor of, you going back to bed....
Restarting agin
 
5:32 AM
@JonClements turns out I do have a list, I just forgot about it until now :) amzn.com/w/2R2JXRBQSPLE9
 
@davidism if you and Stewie deliver before end on month, I'm sure we can arrange something :)
 
That'd be really nice, thanks. :) Well I got all of Utopia season 1 out of the way, so I shouldn't be distracted tomorrow.
 
no rush... just what's suitable for you :)
 
Cbg
 
Although, I did just start reading The Causal Angel. This series is really good.
 
5:43 AM
@Ffisegydd STEWIE!!!!!!!!!!!!!!!
 
@Jon Briiiiiiiiiiiiiiian!
 
Ugh, why are both up at 6:45am ?
(on a Sunday!)
 
My internal body clock is too strong
I always wake up at this time for work so I can't help waking up for this time on the weekend
 
Mine's completely w*ered, wanna swap lives? :)
 
Nah I think I'm good. I enjoy opposable thumbs too much.
 
5:57 AM
Phew, finally
 
@thefourtheye any luck?
 
Managed to reinstall the default DE and I am configuring it now
Trust me, not trying anything really helps in not screwing up Ubuntu.
 
Unfortunately isn't trying things the point of Linux? :P
 
not my favourite artist in the world, but does have a haunting voice
 
6:01 AM
@Ffisegydd Its a vicious cycle. Install -> Configure -> Try something -> System screwed up -> Reinstall -> Goto Step 2
 
@thefourtheye the important step is learning why you screwed up "try something"
 
In my case, I just installed few DEs :(
The basic expectation is that they should work properly, your honour.
Keeping all these things in mind. When I get a chance to write a software, I ll make sure that the users will not be frustrated like me.
 
haha good luck mate :)
 
hehehe
 
rbrb for the mo'
 
6:11 AM
Have something to eat Puppy :)
 
7:43 AM
 
sup @Eric
 
lazy :P
and you ?? you are the "cv-pls" specialist
 
Not bad. Working on sopython website and thinking about breakfast.
 
its afternoon here and i'm fasting ;)
 
Ah sorry about that :)
I'll keep quiet about food then :P
 
7:52 AM
no problem..
no feel free to .. i have a strong control over my urges..
especially stomach related
:D
 
:P you have about a week left?
 
yeah 9 days
 
8:22 AM
sorry?
 
Never mind!
 
huh
i still dint get what t*********** means
Racist spotted
truly disgusting
you are violating the etiquettes of this room
 
You want to stone gays to death right. I'm gay
So tell me which is bad. Wanting to stone a person to death or calling them a T###########
 
@Ffisegydd is this what this place is meant to be for?
@JonClements
 
@EricCartman sorry I didn't reply, I was contacting the moderators.
 
8:29 AM
this is insane
personally targeting someone
man , i am a teenager , who loves coding
 
@Ufoguy I'd like to ask you to leave the chatroom, if this is how you're going to behave then we don't want you in here.
 
ban him
we don't need such loser heads on SO
 
@EricCartman is a great member of this community who has never done anything to you, and yet you spout off racist comments at him.
 
@Ufoguy : You are sick , and u have shown how u have been brought up
 
@EricCartman I can't ban him, but please don't speak to him or respond to him.
I've flagged for moderator attention and the mods can deal with him.
 
8:31 AM
if only Jon's feature request got put in place
 
ohk @Ffisegydd thanks
 
But he's no longer welcome here as far as I'm concerned.
 
things would be far more convenient
 
@Volatility yeah would be a lot better, but never mind.
@EricCartman please don't take what he said personally, you should know by now that this is 99% a welcoming room to be in (we can't help the occasional 1%). I hope this won't stop you joining us here.
 
yeah , its a sorry state of affairs nowadays . i'll just forget this , as far as i know ,i have far more pleasant memories here :)
 
8:36 AM
And now I'm going to make some food, I'll take my laptop with me though so if it kicks off again or a mod turns up to sort things out I'll be around (might need to @ping me)
Worst comes to the worst I can Gallery mode the room and give people write access, a lá JS room.
 
@Ffisegydd thanks man for your support , i love you all . i want peace in this world. i have never hurted anyone physically let alone murdering.. :(
 
anybody mining bitcoins?
 
Sraddhanjali Acharya?
 
@tila we've had a few people in in the past but I don't recall anyone mentioning it lately.
 
cbg al
@thefourtheye yup that is my name
 
8:40 AM
Oh okay
 
is there a problem with the name ?
@thefourtheye how come you know my name?
 
lol, was just wondering that; can't find it anywhere
 
cant find what anywhere?
 
your name
 
oh, which one, tilaprimera or the real one?
 
8:42 AM
the real one
 
@tilaprimera he he he Gooogle :D
 
: ) i found you on google+
and i followed you there.
 
;)
I hardly use that
 
google search on my real name is generally inundated by obituaries, and tributes....hence i chose a very neutral name : ) for the web.
 
All Ubuntu users, try Guake, if you havn't already. Me loves it...
 
8:45 AM
I used that a while ago...but removed it, because of its high cpu usage.
 
Aw :( I don't have much CPU intensive programs anyway, so I guess I am fine ;)
Did you find any lightweight version of that?
 
no, i just reverted to using my plain old terminal...
 
mmmm, it looks very cool though.
 
hello everyone,
Can anyone help me to convert a scanned image into a searchable image or a scanned pdf to a searchable pdf ?
Is there a way to do so in python.
I have been stuck in this situation since quite a while now.
i have tried pdfocr application in ubuntu but no sucess.
 
9:23 AM
@thefourtheye I use Tilda.
 
@EricCartman so you know: Ufoguy has been banned from chat for 7 days.
 
@ZeroPiraeus Thanks man :) I ll try that as well. Its completely written in C, so it might be faster than Guake
 
Curently using 3.5MB of memory on my machine; just tested to see CPU usage with sudo ls -AlR / and it didn't get above 3% CPU (it's 0% when idling).
That's how I have it set up; fairly customizabe though.
 
9:45 AM
I love this Ace editor. Kudos to @Peter for suggesting it...
 
10:02 AM
@Ffisegydd Yeah, that looks very nice :-)
 
10:30 AM
cbg
 
cbg @Mirac7
Trying to see if there's a way to highlight both Python code and Markdown at the same time
 
10:55 AM
Check out my first answer
6
A: python urllib2 can not fetch a specific url

user3620828Try this. This is working for me. You need to install the requests module first! pip install requests Then import requests r = requests.get("http://www.foxnews.com/us/2014/07/19/cartels-suspected-as-high-caliber-gunfire-sends-border-patrol-scrambling-on-rio/") print r.text Urllib is hard ...

It seems that requests automatically sets a user agent
 
 
1 hour later…
11:58 AM
@Ffisegydd I'm glad you liked it;)
 
It's really sweet.
You can use Tab / Shift-Tab to indent / outdent btw
 
cbg
 
awesome!
 
guys, want to see something funny?
-2
Q: Kitkat MTK6582 DOOGEE DG800 Cyanogenmod

TekkzzI bought some days ago a DOOGEE DG800 MTK6582 Kitkat Android (link) and I want to install the cyanogenmod. This mod doesn't support my device and I also can't root my smartphone, framaroot doesn't supports it too. Now are you interesting :D Can someone help me rooting my device and installing t...

 
cbg @Ahmad
 
12:00 PM
> I hope you can help me. I would be so happy, and if you help me maybe you can win a Paysafecard of 10€ for your hard help ;)
Ha. Ha. Ha.
 
12:15 PM
 
@Ahmad LOL
Whtat's cbg?
 
short for cabbage, meaning "hi"
 
ok
But since when does cabbage mean hi
LOL!
 
Look at the salad language
 
@Ffisegydd : thats great ,though 70 days would look much better
 
@EricCartman draw a line under it now. If he does anything like it again then please report it to mods but I'd just suggest you don't engage with him at all.
 
i'm looking forward to a day where there's a package called "ffisegydd" and people import it as stewie :)
import ffisegydd as stewie
yeah I don't need to soil myself ;)
 
12:59 PM
@EricCartman You forgot the counterpart package? ;-)
 
import jonclements as brian
:D
 
;)
there should be some reference to tea as well :D
 
he he he. Bad puppy
 
1:33 PM
cbg @AnttiHaapala
rhubarb
 
2:11 PM
cbg all
i would be a fool to ask this, but should i learn java besides python too? just to be sure?
 
Depends, what do you want to do?
Software development?
 
Most of the people here in my country are doing Java and there are not much python developers..
 
It's not a bad idea learning a C-like language.
 
i do know c/c++
: ) you know java too?
 
Nah just Python and FORTRAN
 
2:16 PM
oh...
 
And a small amount of javascript
 
will it be a hindrance if i just use python?
 
I can't tell you unfortunately.
 
: /
in what areas have you worked with python?
 
Me? None lol :P I'm doing a PhD in Physics and have used it a bit.
 
2:20 PM
ooo PhD!!!: )
What is your PhD thesis going to be?
 
Glasses under extreme conditions
 
does sapphire glass count?
 
Heh. Sapphire glass isn't actually a glass, it's a crystal.
 
: )
iphone6 is going to use sapphire glass... : )
maybe that is just a name
 
Well it's made from sapphire
 
2:22 PM
it is crystal display * :D my bad
 
Which is actually just aluminium oxide with some iron in it.
 
saw a review about the front panel of that, and a person does manual breakage testing on it...
Do you need to know chemistry too for your thesis?
what are the types of glasses that you are working on?
 
I know a little bit, I use high-pressure systems and a lot of systems use sapphire so I pick up some bits.
I work with chalcogenides which are used as lenses for IR and also used in DVD/Bluray.
 
ohkay..
heard about chalcogenides in my high school chemistry class : ) but that is all i have heard about it.
that is pretty cool thesis btw, you get to break things!! : )
 
I do. I've broken more than a few diamonds :D
 
2:26 PM
diamonds?? you make diamonds ?: )
 
No, but I break them...
 
hehe
would have been a pretty interesting thesis to mould/pressurize glass/carbons into diamonds : )
sort of like a Dexter laboratory thing...
he used to do that..
 
3:01 PM
cbg all again
@Ffisegydd oh. what for?
 
Dexter's Laboratory is gone and Cartoon Network is full of shit now
 
3:19 PM
@vaultah racism.
I miss Dexter's Laboratory.
Cartoons were better back in my day!
 
3:37 PM
There's great cartoons today: Avatar, Steven Universe, Gravity Falls, Adventure Time...
Steven Universe has awesome chiptune artists as composers: soundcloud.com/aivisura
Dexter's Lab was great though, Samurai Jack too.
 
3:58 PM
@davidism I've pushed some commits in. Mainly template issues in chatroom etc but I've also added Cancel buttons to the update forms for both Canon and Wiki
Ideally I'd have liked to redirect to /canon/1 for example but wasn't sure how to do that if /canon/1 didn't exist (i.e. you cancel while creating for the first time). So I made them direct to /canon. And obviously same for wiki.
 
@davidism thank you ;)
> The future is better than the past. Despite the crepehangers, romanticists, and anti-intellectuals, the world steadily grows better because the human mind, applying itself to environment, makes it better. With hands…with tools…with horse sense and science and engineering.
— Robert A. Heinlein, The Door Into Summer
 
Nope. They've made it worse. We need to go back to the original Power Rangers! This new stuff is rubbish!
 
I had karate lessons with three of the original power rangers when I was a kid.
 
:o
 
oh well, I'm very proud of myself ;)
I really like when I work so hard on the solutions of lots of smaller problems at the same time, for a really long time, but after a while, all the small parts are building into one huge monolith -- which is just working
just as it should ;)
the most beautiful moments in life are these ones..
 
4:06 PM
@Ffisegydd it wasn't directly in this room, but posted a transcript link in the RO board for someone we both don't enjoy
 
Yeah I saw :P urgh.
 
I'm going to ditch flask-oauthlib and just go with oauthlib directly. Think I'll start a Stack Exchange API wrapper.
 
Ok cool.
I love David Attenborough documentaries (and the man himself...)
 
4:40 PM
cbg again
 
cbg @tila
 
cbg dexter-like-experiment-maker!
cbg all
did i just do some weird stuff here? :D all went super silent:D
 
4:59 PM
what is the efficient way to solve this ?
 
user3444876
well haven't been in the python room for a while
 
cbg @Gaurav
 
user3444876
cbg to you
 
hi, I'm noob here
 
Welcome @Trimax
 
5:17 PM
reading the Salad...
 
@tilaprimera my first try would be to break it down to smaller problems and find a pattern
 
Ah in that case I'll say: cbg @Trimax :D
 
do it for 1-5, 1-6, 1-7, etc.
 
Melon @Ffisegydd
 
5:47 PM
My nephew finished his "race of life" thingy today... that's cool
 
Nice puppy
 
... in a dress... not quite so cool...
 
I dunno I reckon a dress would be even cooler...breezy...
 
Fair play to him.
 
5:50 PM
He's a cheeky little git :)
Must get him a b'day prezzie, he's 9 end of the month
 
02:00 - 18:0018:00 - 23:00

« first day (1373 days earlier)      last day (3591 days later) »