« first day (1692 days earlier)      last day (3481 days later) » 

01:37
rbrb
02:35
I'm back.
02:54
Cbg
@paul23 the problem is that they're misleadingly named. They aren't default values for a function, they're default parameters for creating member variables in a function object. So when the object is constructed initially, you can supply the values or the defaults will be given. Either way, from that point on the function object is constructed, and any mutable members, e.g. a list, can be modified permanently.
03:21
Woo, dev pyramid application on PythonAnywhere
Maybe now I'll be able to sleep again
Wow lol the last entry on pythonanywhere's list of whitelisted sites to wget to is zopatista.com
03:53
but why?
Dunno :)
Seems bizarre; it's just the list of sites that free accounts can wget to; $5/mo and you can wget anywhere
Maybe there's a secret API
Well @MartijnPieters, what secrets are you hosting for free PythonAnywhere accounts? :)
04:37
any body here?
I need a small help.
Need to find the percentage of a number repeating itself in a list...
example.
need to find how many times 1/37 loops number 6 repeats based on a list.
05:10
Cbg all
05:31
percent_6 = my_list.count(6) / len(my_list) * 100
(assuming it's python 3, if not, from __future__ import division first)
urllib does not work for this kind of url
urllib.urlopen("https://www.google.co.in/trends/hottrends/hotItems?ajax=1&pn=p3&htv=l")
is there any other alternative to urlopen? please try link once, it directly opens json
You're going to have to be way more specific than that. It works for me: I get a JSON document.
Why do you think it doesn't work?
req = urllib.urlopen("https://www.google.co.in/trends/hottrends/hotItems?ajax=1&pn=p3&htv=l")
print req
I was expecting req to print json content, but it does not
05:46
json.loads(req.readall().decode())
it returns a response object that you read from
consider reading the docs:
> For http and https urls, this function returns a http.client.HTTPResponse object which has the following HTTPResponse Objects methods.
actually, that's the py3 interface, py2 is a bit different:
Yeah in py2 I got json response using
data = json.load(urllib2.urlopen("https://www.google.co.in/trends/hottrends/hotItems?ajax=1&pn=p3&htv=l"))
if I use loads rather load it gives error, could not understand
yeah, looks like it returns a file-like object in 2 and 3, so you can pass it directly to json.load
for any serious work, the requests library is much easier to use
requests.get(url).json()
how to convert b'\xe3\xbb\xb4' to the string with original chars?
above is the output of
m.group(0).encode("utf-8")
when i try
m.group(0).encode("utf-8").decode("utf-8")
it shows
I get 㻴
UnicodeEncodeError: 'charmap' codec can't encode character '\u2265' in position 0: character maps to <undefined>
@davidism how?
06:00
b'\xe3\xbb\xb4'.decode()
in py3
why are you encoding then decoding anyway? (not that it should matter)
string contains chinese chars. I want to fetch that particular char which causes problem
actually, I still get a "valid" result when I use the charmap codec, so not sure what's wrong with yours
when i try this m.group(0) alone,
i get UnicodeEncodeError: 'charmap' codec can't encode character '\u2265' in position 0: character maps to <undefined> error
data.decode('charmap') gives 'ã»´'
ok this is the partial code.
m = re.search(r'[^\u0000-\u007Fμ±′]', str(col))
if m:
print(str(row[0])+ "\t" + str(i+1) + " ", m.group(0).encode("utf-8").decode())
it gives
UnicodeEncodeError: 'charmap' codec can't encode character '\u2265' in position 0: character maps to <undefined>
06:04
The problem isn't your code (which you should format properly), it's your system.
I'm on windows..
Ah, there's the problem, the solution is to use Linux.
The below code displays.
print(str(row[0])+ "\t" + str(i+1) + " ", m.group(0).encode("utf-8"))
output:
1418	9  b'\xe2\x80\xa2'
@AvinashRaj what was the input your ran the regex on?
06:10
@davidism I didn't want to ping him that early :)
@davidism applying the regex against the db rows :-)
I able to find the row id, column number
ok, what I meant was "post an actual program I can run that will reproduce your problem"
Backs away
I almost done.. What i need is, printing the char which was not in the ascii list.
06:42
Hey up
@Ffisegydd cbg
06:58
@davidism IIRC the list is created automatically based on some weird top-X criteria.
Cabbage all
I think it's to do with crawling from Python.org. So I'm a few degrees awayfrom Python.org and thus included in the list.
And cbg!
Cbg Martijn
07:15
is there anything wrong in using def my_function(things=[]) this type of function definition ?
I mean when we are defining the variables at function definition?
That depends on whether you know what that really does
That is, the default mutable argument.
ok, so if the default argument is not mutable, then there is nothing to worry ?
@ZdaR this may help
Well it's fine both ways, as long as you understand it
hmmmmm thanks a lot @RobertGrant, that small example was much helpful.
07:19
There's nothing "wrong" about the default mutable argument.
@ZdaR basically think of it like having a default value for an object's member variable, as the function is just another object. While the variable might start life as an empty list, as you do stuff to it it will remember what you did.
Just like any other object's member variable
Yeah I got your point, But if we know the consequences we can take measures to prevent such behaviour or if that behaviour us expected then use some other approach, but fundamentally, it is legitimate to use unless we know what is going under the hood
It's legitimate to use if you do know what's going on, as then you have the best chance of using it the right way :)
thanks man,
Good luck :)
07:26
Cbg :)
@MartijnPieters how you finding modding? :)
07:51
Rewarding! Strangely satisfying when you find a 25-account sock network and nuke it all.
Man people are bizarre setting that up
I think some people are dumb enough to believe a high SO score alone will earn some credibility for employment. I doubt I'd want to work for any company who hired on that basis.
Yeah, it is an indicator, but they'd need to take lots of other stuff into account. Like judging the actual answers given.
E.g. people from the early days who answered simple stuff and just have massive scores because of that
Or people who sit on SO all day at work :)
08:11
@RobertGrant ssshhhh!!!
I do wonder about the fact this is public and searchable :)
Just answered my first Pandas question. Took a little research. Does anyone else find that answering questions is a great way to learn?
Yes, although it's stressful
:)
@RobertGrant Surely the stress has to be self-induced?
I worry about someone who's more expert lazily deciding to quickly dash out a much better answer. It's like being a startup and hoping Apple, MS or Google don't just allocate 0.0001% of their budget to surpassing you.
08:14
I just see that as short-circuiting my learning process :)
Hm yeah that's a more positive view than my brain normally reaches :)
It's a matter of not looking at it as competitive. I've always enjoyed playing games, and try to enjoy the play whatever the result.
I've definitely become more competitive over the years
To the point where for some games, playing against people is so stressful that I'd rather not start :)
Wow, this has been a really helpful session. What do I owe you? :)
08:28
Psychiatric help comes at the usual 5¢ rate
I'll send you a bill at the end of the month
Think I may need to restart Chrome - I can no longer paste into the input widget
@JonClements ^^^
@AnttiHaapala: you available for a AirPair Pyramid job?
There is a $70/h request for a Pyramid expert to help someone figure out how to best handle serving multiple branded sites from the same Pyramid app. Its yours if you want it, just drop me a line and I'll hook you p.
08:55
That's fun, I'm also writing something that switches based on domain name, but for SAASy reasons rather than branding ones. Curious to see what he comes up with.
...that he's allowed to share, etc.
@holdenweb That's my main reason for answering on here. I've learnt a bit of pandas, sqlalchemy, cython and flask that way...
09:14
REMINDER: The PyCon UK call for papers is still open. How about a talk on the chatroom software?
I'll present on this :)
Whatever, I hope lots of people will be making proposals - and, of course, going to PyCon. Starring my own post would, of course, be immodest (and for all I know may not be allowed), but if someone DID star this it would remind people.
@RobertGrant
@RobertGrant Thanks!
@RobertGrant oh, and with regard to your earlier comment about public and searchable, it seems much worse than it actually is.
The downside is, if something DID blow up, the Internet would be all over it like white on rice. But we live in a world where shit happens every day ...
@RobertGrant the risk seems much greater than it really is because we believe others are more interested in us than they usually are
Yeah, but when Kevin runs for political office, that's it for him!
Yeah - I guess mostly, although it's all public and searchable, who would really bother. Except in the event of scandal
I think I've already blown my chances for high office
So let's not be scandalous, nor run for political office (the two being highly correlated)
09:20
Although I do quite fancy working in an attic ;)
That's the thing - people do bother. It's like that Twitter bullying thing where insane people pile on.
snorts at the truth in holdenweb's observation
Yeah, well that's another thing altogether, and all too real, but I suspect this community is too small to generate a viral controversy (and, of course, too polite)
True, I more mean coming from the other direction :)
@RobertGrant there's something in the anonymity for otherwise under-affective people. I remember seeing a few who were prosecuted here for twitter bullying. They were pitiable really - hardly the monsters they appeared online when seen in real life. Not to trivialise their online effects, of course
09:23
I saw @MartijnPieters' earlier mention of AirPair, and wondered who's using it? I just signed up (for the second time, I now discover :~{)
@holdenweb have you been to <Lounge C++>? ;P
No. Why would I? Or should I?
09:36
best not, really. But it may alter your view on the likelihood of viral controversy here. If here is stackoverflow rather than sopython
09:51
I see. That gives me a reason not to visit that room :)
"Here" was this list. I'm pretty much mostly Python
I could be in other rooms, but I can't be bothered to switch room all the time :)
I might visit a Pandas room from time to time when I look for it, but I'm currently not very motivated - spending enough time on SO as it is
@JRichardSnape I've never really had to contend with Twitter trolls, though I've had people blog vitriolic things about me. Clearly at least my critics are prepared to identify themselves
10:08
Leaves the Lounge
Cabbage
@IntrepidBrit cbg
@AaronHall I don't think language should be standardised, it should be free to evolve. Otherwise we wouldn't have terrific words like Jedi, anti-vaxxer and sideboob. We should record, monitor and examine the language as it evolves yes - but not fix it permanently.
picks up gauntlet and passes it back to Aaron. Here I think you dropped this.
@AaronHall and if we're being picky, Johnson's dictionary was published 70 years before Webster's
The Polish were amazeballs when it came to the Enigma. They reversed engineered one WITHOUT an original template, which is crazy when you think about it
10:24
That's awesome
They should make a movie of that with Bill (Paxton|Pullman)
Just any Bill will do :P
10:36
I'm looking forward to this project - both I and the management are keen to have TDD
(Tests are going to form part of the work agreement), and looks like I'll be able to do it in Python fist pump
This sounds like a cool one
Is it web dev?
Nope, looks like it'll fall into my usual embedded linux stuff
Aah okay I forgot about that stuff
Speaking of embedded Linux, have you heard of Jon Masters?
No, no I've not
But I'm also the kind of guy who's like: "Who's Steve Gates and Bill Jobs?"
Ah :)
He was a guy I went to university with
He's now the "chief ARM architect for red hat", whatever that is
Dunno how many ARM architects red hat employs
10:41
Nice
But you know, the sound of chief is always impressive
True
Wherever you hail from, you hail to the chief.
Googles the etymology of chief
Googles the etymology of etymology
watches the internet break. Welp, they'll be taking that doctorate away from you now.
Hah. Funnily enough I got to drop the doctor title for the first day today.
10:52
Did you forget to pick it up again?
I've heard from other PhDs that when dealing with rental agents and such the title can make a genuine difference.
So I made sure, when booking an appointment to see a place tomorrow, that I gave it in my name :P
That's why they have a separate M.D. for medical doctors in the US :)
Hah yeah she did actually think I was a real doctor, and asked when was the best time to call me back when I wouldn't be in practice.
facepalm
That's the natural assumption :)
10:56
True, even though I reckon PhDs outnumber medical doctors.
And why it helps with rentals - you get looked after by the NHS, so unless you really mess up you have a guaranteed income
Hello
cbg(direprobs)
£690 per calendar month for a 1 bedroom apartment.
10:59
I feel broken
And by seriously mess up, I mean it was 12 years before Andrew Wakefield was disbarred for falsely reporting autism relating to the MMR vaccine, so they're pretty safe
@Ffisegydd Wow, where?
Cheltenham.
Edinburgh?!
Ew - Cheltenham
Ah of course :)
Bath has broken me, that doesn't even seem that expensive.
11:00
Nice flat?
I'm renting my 3 bed semi out in a very nice area of Nottingham for a few quid under that :)
Bah, didn't catch it :)
I figured giving out the address of a place I may move may not be the best idea on the intertubes.
Looked nicely maintained though
I'd hate to pay that amount and have it be a hellhole
Yeah. Admin fees are scandalous as well, but I can claim them back from job.
Friends in Oxford are paying a grand a month for a nice little 2 bed
Crazy money
You almost can't find a flat for less there
Just found one that's £1k for 1 bedroom no living room.
11:07
Lol
@holdenweb I get a few sessions per month through them.
Wow, looks fancy
Generally customers are companies and they then take multiple sessions.
@Ffisegydd nice to know they are prepared to let you live in the place
11:21
I don't know what to do
Juggling can be calming
cbg(antti)
@MartijnPieters I see AirPair is advertising features due to be implemented in March and April. SHows some signs of recent neglect
Not that my own site is any better, but I am (or was) a one-man band
I can't think about it anymore, see my topic: academia.stackexchange.com/questions/46493/… I don't know if anyone if you has any sort of idea or anything
I mentally parallelized
11:29
@MartijnPieters hmm
@Ffisegydd good thing in Finnish that no one assumes that tohtori === physician or so anymore...
@direprobs I read your post, but unfortunately similarly to the academics board this room isn't really the correct avenue to get help.
@MartijnPieters hmm, the same req came on cm too, except for lower price :D
@direprobs I sympathize with your problem but would advise you to seek help from local sources - talk to friends, and so on.
An education abroad is no guarantee of anything (though I can see it would have been attractive, you may not have enjoyed it as much as you thought), and you don't need to get your education before you start work (though it's usually easier).
You are probably smart if you were accepted by a foreign college, so the best advice I can think of is "when life gives you lemons, make lemonade" - you may not have wanted lemonade, but it's better than being thirsty. Oh, and make it up with your folks. They probably feel pretty shitty about not being able to afford to send you where you so obviously had your heart on.
And that's it. Please don't start a long conversation, we really aren't here to help with personal issues, and we aren't qualified to do so. But by all means hang around for the Python ;-)
@holdenweb I'll let em know they need to update those messages.
They are actively reworking the site, they are just running behind.
@MartijnPieters best possible outcome, thanks - I'd like tp support them
11:46
@AnttiHaapala I don't have time for it right now, it's definitely below my usual rates, and I thought you'd like the Pyramid angle.
Are you signed on as an expert with AirPair already?
If so I'd be happy to send you the link.
Can/should this be tagged status-completed?
@vaultah status-completed.
Thanks :)
@MartijnPieters I am, but after reading the description I find it not interesting, I mean it either will be very short session or then I will need to explain too much for too little :D
I am a "bit" busy myself too though can fit interesting things in my sched
@AnttiHaapala I'll let AirPair know you are passing on it too.
12:03
@thefourtheye hey, I'm talking in front of thousands of people in a few days (about open source JavaScript) and I'm making the slides better now - would you mind if I mention your recent contribution to io.js?
Swanky website :P I'd be shocked if it was a boring one though
This is freakin swanky as well: bellbros.com
And this is the swankiest I've ever seen: getbeagle.co
replace exact word while ignoring punctuation. Unclear, unless someone can explain it to me
@RobertGrant That's pretty damn swanky.
12:17
I internally judge swanky websites
morning friends
@BenjaminGruenbaum wow, Crockford.
Nice
@BenjaminGruenbaum I don't know how you can present in front of a large group of people. I'd hate it.
Don't tell him that
@IntrepidBrit why?
I really don't mind crowds.
inb4 - I don't mind making a fool of myself, I'd much rather try and fail than not try and I'm not afraid of failing :D
I think I'll do just fine :D
12:22
@BenjaminGruenbaum Dude, that would be awesome :-) You can mention that.
@thefourtheye Awesome, thanks. How/why did you think about contributing to it by the way?
Well, I got to know about the project from you only. Do you remember, you once told me about landing a change for unhandledRejection in io.js?
And then I started looking at the project time to time.
@BenjaminGruenbaum That's a really great attitude - you'll enjoy the experience, I am sure
12:25
Thanks
I liked the way software engineering is done in the open
@BenjaminGruenbaum Nah - it's just that I hate no feedback. Don't mind like a classroom, or a workshop. I just hate the oppressive wall of impassive silence haha
Can I use your real name? @thefourtheye
Not only the technical discussions are discussed in open, but also the operational aspects of the project
12:26
@IntrepidBrit why do you care?
... having a conversation?
@thefourtheye this is pretty much the topic of my talk - software development in the open
@IntrepidBrit no, I mean - I like conversations better - but why would you care that much about doing it in front of a crowd, there are a lot of upsides too.
@BenjaminGruenbaum Just my name, right?
Reach and exposure to name two.
@thefourtheye thefourtheye (real name here)
If you'd like me to just use the alias - that's also fine with me, figured you'd enjoy the named attribution.
It's as an example of someone stepping up and making a contribution - to motivate others.
I find that I have a hard time reaching people during a presentation, because the stage is typically elevated ;-)
12:28
@BenjaminGruenbaum Yup, I am okay with my real name or thefourtheye. Both are fine :-)
You are not going to mention anything about the employer, right?
Also a very a cost effective way of passing on information. I guess a part of it is that I would hate it if I felt like I was wasting other people's (and as a result, my own) time
No, I can show you in 5 minutes and you can approve it
Cool, then :-)
@IntrepidBrit oh, you must be a more moral person than me - I don't mind wasting peoples' time :D
Do we have a canonical post for "how should I test that two floats are almost equal?"
12:33
Ha! Well, hope it goes well.
Basically I'm lazy and don't want to explain return abs(x-y) < epsilon to the OP if someone else has done it better already
@thefourtheye posting and deleting for privacy
The top answer is a little sparse, and the ones below it complicate matters with decimal and numpy...
12:40
Oh :'( I didn't see that :'(
Let me know if that's ok
Send it in FB?
You can see deleted messages as a room owner...
The reason I deleted it is so only ROs see it
Dude, thanks. Got it
Seeing it now
@Kevin Yeah. But doing abs(x-y) < epsilon isn't very safe unless x & y are roughly the same magnitude. So you do need to mention that problem.
12:42
If you have other feedback about the slides lemme know
Cool, I am okay with that :-) I am really honored. Thanks :-)
I am in office now, I ll go through them at night and let you know.
Heh. To be honest, I don't fully understand what the OP is trying to do, so I have no idea if x and y have similar magnitude.
12:43
And I hope that PR gets merged ;-)
I hope so too :)
in python, does there exist a way to try to call a method, but if it does not exist, don't call it and just return None?
a) yes, b) it's simpler to try/catch
sorry, try except, python
try:
    f = somefunc
except NameError:
    f = lambda *args, **kargs: None
print f(a,b,c)
I want to do it in an if statement in a way. if not isinstance(class.exports(), SomeClass): raise TypeError()
12:48
"Why not just call somefunc in the try?" you ask? Well, what if somefunc does exist, but itself invokes a NameError due to a programming bug? Then you would catch that error when you don't want to.
You can use the ternary if or code a little function <- will cost speed if you care about that ?
If you care about speed, I have bad news about Python as a whole...
you're right, but it'll be better hopefully in the future
baibob
12:57
Python 2.x is faster than Python 3.x in many contexts, but not always ! PyPy is also faster than Cpython 2.x & 3.x, however, when reading files, Cpython is faster that was about a year ago when I tested that with an old version of PyPy I don't know what about now.
There are some amazingly broad generalisations there.
I meant 2.7 and 3.3 to be specific and pypy-2.4.0
That isn't the generalisation part. "Python 2.x is faster than Python 3.x in many contexts, but not always" is a pretty useless statement :/
How ?
It all (2, 3, pypy, whatever) depends on what you're testing.

« first day (1692 days earlier)      last day (3481 days later) »