« first day (1585 days earlier)      last day (3362 days later) » 

2:00 PM
I have a webapplication which is working but looked pretty ugly to me, I wanted to rewrite the whole but I have many difficulties implementing class based views
 
@IbrahimApachi newer projects seem to be keen on class based... I think the other ones are somewhat deprecated now... but it's good to know both.... so I'd struggle on...
 
@AnttiHaapala yes, and in that case str(ob) falls back to repr(ob).
 
I haven't even looked into django class-based views yet, but I have heard they are not that nice pattern either
 
okay, I will try my best then
 
@MartijnPieters that is object.__str__
 
2:02 PM
and if there is no __repr__ either, repr() falls back to using PyString_FromFormat("<%s object at %p>", Py_TYPE(v)->tp_name, v).
 
repr falls back or is it object.__repr__
 
I am not expecting on getting invalid input from the user though
 
>>> object.__repr__(1)
'<int object at 0x141f158>'
 
@AnttiHaapala not everything in the Python world has to inherit from object. Custom classes do, of course, but __str__ is not required.
@AnttiHaapala That's repr(). Or PyObject_Repr(), really.
So both __repr__ and __str__ are optional.
object.__str__ does exist and just falls back to object.__repr__.
 
In what sense
 
2:04 PM
but it isn't really necessary.
 
Question How to uninstall some package installed using pip?
 
@BhargavRao pip uninstall package.
 
I don't have to use` __str__` or` __repr__` to print?
 
@MartijnPieters Oh thanks
 
@MartijnPieters True, but __str__ is more optional than __repr__. :)
 
2:06 PM
you're right
if (v == NULL)
    return PyUnicode_FromString("<NULL>");
if (Py_TYPE(v)->tp_repr == NULL)
    return PyUnicode_FromFormat("<%s object at %p>",
                                v->ob_type->tp_name, v);
 
@Vader As Antti said earlier, you should never call __str__ or __repr__ (unless you have Martijn-like expertise and have a really good reason to do so). Instead, you should call str() or repr() and let Python do its "magic" of calling the appropriate method.
 
This question stackoverflow.com/q/28563187/4099593 is a dupe of the question he tagged
And the answer is a copy of poke's answer there
 
What would be a good reason to do so?
 
@Vader if you cannot achieve what you need to do without calling it directly
 
<pretend mystical voice> If you have to ask why you should call it...then you're not yet ready to... </pretend mystical voice>
 
2:14 PM
yes, exactly
 
:(
 
cabbage
 
cabbage!
 
cabbage!
 
2:15 PM
i have question to print the current date formate
in python
 
Just ask bro.
 
But getting back to your earlier question, if card is an instance of your Card class, then you can just do print(card) - there's no need to do print(str(card)), since print will do that for you.
 
@PM2Ring not really, as the repr() function will make up a default using the __name__ value plus id() of the object.
 
@PM2Ring did you see that?
@PM2Ring an extension type does not need to do __repr__ at all
11 mins ago, by Antti Haapala
if (v == NULL)
    return PyUnicode_FromString("<NULL>");
if (Py_TYPE(v)->tp_repr == NULL)
    return PyUnicode_FromFormat("<%s object at %p>",
                                v->ob_type->tp_name, v);
 
@MartijnPieters what was the first python version you used?
 
2:18 PM
+1
 
what is the difference between strftime() and strptime() function in pyhon ??
 
I have used python 1 :D
 
@Vader I guess he discovered python and gave the credit to someone else (like Nikola Tesla)
 
@DaSaDiYaChaiTAnYa they do the opposite things
 
2:19 PM
is there a non lazy map or do I have to list(map( ?
 
strftime is time->string
 
string to date and datetime to string
 
strptime is string->time
f stands for "format"
and p stands for "parse"
 
TIL...
 
@MartijnPieters Sure, but that's generally not a very helpful representation. But what I was getting at with my __str__ is more optional than __repr__ remark is that if you do str(myinstance) and __str__ can't be found then __repr__ will be used.
 
2:20 PM
give me small example
 
@Vader I can't quite recall, somewhere before 1.5. I remember 1.5 being released.
 
so that I can understand better
 
I know the date when I have used but I cannot possibly know if that was 2.0 or 2.1
 
@DaSaDiYaChaiTAnYa you're best looking for examples via Google.
 
@DaSaDiYaChaiTAnYa there are many strptimes and strftimes
 
2:21 PM
As you'll be able to explore them better.
 
@MartijnPieters Does Guido know about you?
 
@BhargavRao look closely at my and Guido's resumes.
 
@BhargavRao he's worked with Guido :)
 
He is Guido! DUN DUN DUUUUUUUUUUUUUUUUUUUUUUUUUUN
 
@AnttiHaapala okey thanks
 
2:22 PM
He is Guido undercover?
 
No, Guido is Martijn undercover.
 
@MartijnPieters where's your resume
 
Google it
 
From October 2000 till July 2003, I worked for Zope Corporation as Director of PythonLabs. says GvR
 
@AnttiHaapala Me, too (Python 1.4). But then I didn't touch Python for a couple of years. At the time I didn't like the significant whitespace thing. Now I love it. Mostly. :)
 
2:24 PM
where Martijn was working December 1999 – December 2003 (4 years 1 month)
 
@AnttiHaapala linked from my profile, actually.
 
Then are you developing Python 4?
 
I was trying to find it on zopatista
 
@Ffisegydd Maybe it's like a superman thing... except when Martijn puts on a beard - he's GvR! But has a reasonable successful career as a Python programmer to shun the lime light :P
 
Python 4 is going to be exactly the same as Python 3. Except print will be both a statement and a function.
 
2:29 PM
Ffisegydd for Kevin!
 
I'll add "Plan to take over Starlord position" to the AGM agenda.
 
I am sure Martijn is developing some version of Python and it will be called Python Ultimate: The Ninja Version
 
Winter GM will begin in approximately 30 minutes.
 
29 minutes (tick ... tick ...)
 
GM ?
 
DSM
2:31 PM
Morning cabbage for all.
 
Cbg DSM.
 
cabbage
 
@WalleCyril Genetic Modificaiton
 
@WalleCyril Good Morning
 
we hold a gruesome experiment every quarter... see what mutants we can come up with
 
DSM
2:32 PM
@WalleCyril: "general meeting".
 
Last time we made a three legged dog.
 
@DSM oh - that sounds far less fun...
 
three legged puppy
 
@Ffisegydd see - @BhargavRao got it right!
 
Am I part of this or should I stay another year here
 
2:33 PM
@Walle everyone is welcome.
 
It's in this very room?
 
We should make a song for this chat room
 
Yessir.
 
The Zen of SOPython
 
We've got a fair bit on the agenda actually so we'll have to be a bit brutal with chairing. Make sure we don't get too distracted.
 
2:34 PM
@BhargavRao we have the burninate song already
 
Is Guido invited too ?
 
He is, but he never RSVPs ;_;
 
Guido is the undercover of Martijn, so he will be here
 
You are all way too excited about this.
 
Won't it be exciting?
 
2:35 PM
It will be intoxicatingly thrilling.
 
DSM
I can't be intoxicated during work hours. Wouldn't be appropriate.
 
I'll be intoxicated for both of us. I will do this for you, out of friendship.
 
@DSM it sometimes makes it bearable
 
Thank god it is a holiday here
 
Who said I'd be here?
 
DSM
2:37 PM
@Fizzy: there's a good man.
 
This user (10k only) is apparently convinced that they have text underneath the Base64 encoding. That's at least their second post about the subject. It's opaque binary data, we cannot possibly figure out what might be lurking on those depths.
 
Hello. @MartijnPieters, that link 404'd. :(
 
@n0ne That's why I qualified it. You need to have 10.000 reputation or more to see it.
 
New here. Sorry for that.
 
DSM
Every now and then you get lucky and recognize a header..
 
2:44 PM
I have 72 links bookmarked to see when I cross 10k.
 
@DSM Yeah, I threw zlib at it and that didn't make any difference. file also doesn't see a header in it.
@BhargavRao most will be a disappointment.
 
Hopefully not :)
If someone could gimme a bounty of 3680, It will be soo good
 
I am sure martijn makes that much a day just on interest
 
cabbage all
 
cabbage
 
DSM
2:48 PM
I'm fond of the best in the "CAN NE1 PLZZZ PROVIDE ME THE CODE OF THIS Q MY SUBMISSION DATE IS 25...THNKS IN ADVANCE" categories.
And there was this one guy who was so lazy he took a picture of the question with his camera. In an exam. WITH HIS NAME ON IT. I kindly pointed out to him that he wasn't cut out for a life of crime.
 
hah
 
Where did you spot that?
 
@DSM If only we could figure out the cell number of the exam supervisor. :-P
 
@Vader there is repcap
 
I propose exam boards put a QR code on the page for us to scan. In case of cheaters, call this number.
 
2:50 PM
@AnttiHaapala Not if you get 250 accepts, which Ninja gets on a daily basis
 
Isn't there a better way to report cheaters?
email?
 
@BhargavRao that's no "interest only" :D
 
Oh yeah.
 
DSM
@MartijnPieters: that'd really only catch the dumbest of the dumb, though, and they're probably going to fail anyway.
 
@DSM What, like the kid that posted his exam paper with his name still on it? :-P
 
DSM
2:53 PM
Yeah. I'd be very surprised if he made it through the rest of his courses.
 
I know, in reality kids that panic and cheat like that tend to not get far anyway.
 
I don't understand how someone could take a photo of their exam paper :/ in my university/school we had patrolling wardens and phones were absolutely forbidden.
 
DSM
Now I feel old. When I went, phones weren't a thing like they are today.
 
Why may is be static?
I did not use
@staticmethod
So I don't see how it could be static
 
@MartijnPieters if in zodb I don't use btree, everything will be always fullpickles?
 
2:56 PM
PyCharm thinks it may be though. It's trying to guess what you're doing.
 
@Ffisegydd Top tip - invigilators do not give a single yam. That's how
They walk up and down, they look but they don't see
 
or every dictionary
 
so btree is to solve the problem of "dictionary has many items" but "datastructure is deep" is not a problem
 
@AnttiHaapala You'd want to use objects deriving from persistent.
 
2:57 PM
I am
 
@Vader you haven't used self anywhere in the method, so it's saying you can mark it static.
 
It won't divvy up at the dictionary boundaries, no.
 
I am just considering when do I want btree
I will never have the 100000 item dictionary that i wouldnt want to unpickle in full
 
@davidism I see, the error went away right after. thx
 
Well, a Btree gives you a nice balanced division over persistent records.
Right, if you have small dictionaries, by all means use dictionaries.
 
2:59 PM
I call the Unique and Supreme Lodge of the Cabbage to order. Is the Door of Knowledge sealed fast against heretics and knowlessmen? Is the triple circle well and truly traced? Art all here who art here? And it be well for an knowlessman that he should not be here, for he would be taken from this place and his gaskin slit, his moules shown to the four winds, his welchet torn asunder with many hooks, and his figgin placed on a spike.
8
 
ok thnaks :D
 
Bugger, forgot about the circle.
I thought you were going to get the chalk, @Antti?!
 

« first day (1585 days earlier)      last day (3362 days later) »