« first day (1721 days earlier)      last day (3234 days later) » 
00:00 - 16:0016:00 - 00:00

user559633
12:04 AM
Because I don't have an awesome understanding of monads
 
647
Q: What is a monad?

ljsHaving briefly looked at Haskell recently I wondered whether anybody could give a brief, succinct, practical explanation as to what a monad essentially is? I have found most explanations I've come across to be fairly inaccessible and lacking in practical detail, so could somebody here help me?

but be warned: it will drive you insane then add more information and make you sane then add more info and suddenly you'll never be able to explain monads again ;)
 
Monad is a meme for "Functional programming is confusing". Boom.
 
user559633
Boom?
 
Any mods about ? Just messed up and flagged a question instead of answer to it. Wording of flag should make it clear what I mean I think, but just wondered if there's something I should do about it...?
 
user559633
Ah crap, it looks like the Martijn woke up. There goes my internet point farming.
 
12:16 AM
Boom is the sound your brain makes when you finally understand
 
user559633
@JGreenwell thanks :)
 
user559633
So confused by incomplete answers on a question I already posted an answer to
 
hmm...I wonder if I'm nicer to people who seem not to be a natural English speaker...
 
user559633
@JGreenwell I try to be a little nicer. I just answered a question and half-way through, I realized the asker is probably not a french speaker, but had just lazy copy/pasted his existing code together.
 
is it a raspberry question?
 
user559633
12:22 AM
maybe :) (yes. and i got to the rewrite bit before thinking "wait a minute, these are in french and he wants the new messages to be in english...")
 
@tristan I didn't tell the guy how to remove lines because his code already does that correctly.
 
user559633
@QuestionC Ah, Just saw that he had posted it as an answer and then edited it in.
 
user559633
Are the questions always this bad at this time of night?
 
well, @QuestionC edited it in, also yes that was the one I was wondering if I was being too nice as he obviously has some issues with English
 
user559633
@JGreenwell Yeah. I mentioned in my answer, but that would otherwise be a normal CV and move on for me
 
user559633
12:27 AM
 
Last week I struck gold with a nighttime question, so I'd say nighttime questions are pretty good.
 
also, the time of the year helps with bad questions (second summer intern hiring season here just started here)
 
user559633
@QuestionC Just because it was a karma farm doesn't mean the questions are good :]
 
Actually it was a really good question. I was just lucky enough to be the guy the answer.
 
user559633
mind sharing a link? EDIT, SO I CAN DOWNVOTE >:)
 
12:30 AM
150
A: Why does this for loop exit on some platforms and not on others?

QuestionC On my laptop running Ubuntu 14.04, this code does not break it runs to completion. On my school's computer running CentOS 6.6, it also runs fine. On Windows 8.1, the loop never terminates. What is more strange is when I edit the conditional of the for loop to ...i<=11..., the code only te...

It's a good question because he's a noobie experimenting with the language.
As opposed to your standard "How do I homework?"
 
user559633
Oh yeah, I saw this question :) Yeah, this was a good one
 
That guy's gonna go far.
 
Everytime I think the python questions are getting bad, I go play in the powershell tag - and if that doesn't work I start looking at SQL stuff.....then python questions look amazing
 
I usually stick to C. Python has too much competition and the C++ community just pisses me off.

And C is a learner's language so it's kind of a karmafarm.
 
user559633
@QuestionC I think I'm going to spend more time in the C and C++ tags to be honest
 
12:38 AM
Some day I'll learn OpenCV. Those questions come up all the time and they don't seem too bad. Lots of engineering students trying to do something impressive.
 
what is so bad about C++?
 
user559633
I get my Python fix from the wonderful people in here and from writing it at work. I find I learn more from C/C++ questions.
 
[language-lawyer] [python] -> 6 questions tagged
[language-lawyer] [c++] -> 1,122 questions tagged
 
user559633
I've never heard the term 'language-lawyer'
 
I would have to go look through my old answers, but I've had a lot of (I feel) correct answers downvoted, gotten kind of harassed for including C++03 backwards compatibility in my code, and just... I dunno, there's a definite C++ community here and they drive me up a wall.
 
12:47 AM
ah, I have no job so I'm trying to answer questions in languages that reflect well in my resume (since people around here seem not to know how to use GitHub)
 
Aha, found it.
http://stackoverflow.com/a/30603106/3294441

Still boils my blood a little.
 
user559633
@QuestionC I can understand that. I'm not sure I'd say we're in a C++14 by default state
 
I've yet to use C++11 professionally.
Although I certainly do push for it.
 
hehe....someone thinks that technology being 12 years out of date means people don't use it...ahhh, that's funny
 
user559633
I've used C++11 for a thing.
 
12:53 AM
It's just very different from Python though where... I mean if someone doesn't understand implementation-specific behavior then they go read the source code for CPython. You guys are practical.
And friendly.
 
user559633
@JGreenwell I can still see his point though, I mean, that's like someone coming in with python 2.1ish.
 
user559633
Difference between "i work at boeing and..." vs "how does i file write c++ video game"
 
user559633
@QuestionC Pff I've never done that for a total stranger in the past 20-ish hours probably
 
I am almost certain I saw you dig through Python's generated code recently.
 
true
 
12:56 AM
It was string.transform vs string.replace I think
 
user559633
That was like 40 hours ago. Doesn't count.
 
user559633
also whoops i clicked an arrow on one of your answers totally by accident @QuestionC
 
was it that long ago? where does the time go
 
user559633
Speaking of which, it's 4am. Have a good night you wonderful people.
 
adios @tristan
 
 
3 hours later…
3:33 AM
time...
 
3:53 AM
Working late?
 
4:30 AM
cbg
 
Pi.DAY
 
Huh?
@HimanshuMishra Pi Day is on the 3rd March
Sorry 14th March. 3/14 (MM/DD format)
 
 
1 hour later…
5:46 AM
rbrb
 
rbrb - have a good day ;)
 
 
1 hour later…
6:52 AM
Cabbage, good people of the constrictor community
 
Hi @jon
 
yo fizzy
 
7:09 AM
Hey up
 
7:24 AM
cbg
 
7:34 AM
bbiab
 
7:58 AM
Cabbage!
It’s so warm
 
has AC
 
And someone in our offices opened the windows, so now it’s super humid
 
it's literally the only reason I still work here
 
Along with our ceiling cooling, this makes for a really wet feeling, like at a swimming pool (inside).
 
eugh, doesn't sound nice :(
 
7:59 AM
It was super cool here until they opened the windows :(
 
It's a common problem, I believe (work with a load of building researchers who bemoan opening windows in hot weather all the time)
 
So I shouldn't open my windows? But what about a draft?
My trick has always been to ensure there's a draft but keep any curtains that face the sun closed.
 
You don’t care about drafts if the temperature of the draft is 35°C or more…
 
I care about a draft if I'm in my small bedroom with a PC running :P
 
8:14 AM
Even if it’s 20°C inside?
 
If I leave the PC running without a draft it will not be 20C inside :P
I use this thing to warm me up during winter :P
 
Assume you have an AC that’s making sure it stays 20°C :P
 
hahahahahahahahahaha oh poke you so funny. AC doesn't exist in UK.
But yes I see your point. If your office has AC then opening the windows makes little sense.
I can see the temptation, as "fresh" air is nicer than "AC" air in my opinion, but you must resist this temptation.
 
Morning
 
Hey up munchkin
 
8:25 AM
Army of fans set up, cold drinks in the beer fridge (stupid Scottish drink drive limit)
It's going to be glorious today
 
@Ffisegydd Oh right, you’re the country that doesn’t know about heat and starts an outcry when it goes beyond 20°C. I forgot, sorry.
 
We rarely get above 30C so it makes no economic sense to install AC in homes :P it just means that the 2 weeks a year when it does we* all QQ [* I don't QQ, because I allow a nice draft through my home and keep windows covered :P ]
 
I think it was beyond 34°C and there was no outcry, but otherwise yes :)
 
Weeks?! Hahahahahaaaaaaa
 
UK offices have air con, just not homes
 
8:28 AM
There may be 2 weeks i.e. 14 individual days. But not in Scotland of course. You get about 2 hours.
 
Because we don't hate future generations
 
It's been insane. This summer has been about 40x longer than expected
 
This winter has been very short over here
 
That's a thought - do you actually welcome winter Bobby G?
 
It's nice over here because it basically doesn't rain at all in winter, and it's not cold in the day
But at night it gets cold indoors because places aren't built with insulation
And are often built with heat-sapping concrete everywhere: interior walls and floors, everything.
 
8:35 AM
That's not the end of the world. Quite a nice excuse to get out the blankets and wood fire on the go
 
Yeah but it's bad to walk around barefoot on tiled floors (which are everywhere) when you're getting up in the morning :)
But we got married in winter here because it's very nice in the day
Also it's like half the price
 
That's what slippers are for damnit!
 
re-cbg
 
(Not for marrying, just walking around on cold floors with)
cbg(pup)
 
@IntrepidBrit I thought they were for chewing?
 
8:50 AM
Most certainly not!
 
@JonClements you shouldn't chew stuff you wee in!
 
When I want to generate random numbers between 1 and n, and want to favor the smaller numbers more than the larger ones, what’s the simplest way?
(using only a random function that gives a number between 0 and 1, because JavaScript…)
 
Oh right, squaring the random number
 
9:15 AM
Any folks using Arch linux in here?
(Or anyone somewhat knowledgeable about X / Wayland?)
I ask because I'm trying to determine whether I should go for the DE I like the look of (KDE Plasma) or whether I should go for the hassle of something like Hawaii, which is based off Weyland.
 
9:28 AM
Cabbage Guys
 
Argh massive problems found, all resolved when remembered that numbers in urlparams come in as strings and not ints. Duh.
@thefourtheye cbg
 
Cabbage Robert :-)
 
@Intrepid @Peter may be about and may be able to help.
 
I still eye Autobahn occasionally and want to try it on a project
 
10:12 AM
Woo finally got my pandas bronze.
 
Pineapple @Ffisegydd :-)
 
Cbg :)
 
It's fine. Decided to err on the side of caution and go with X
 
@Ffisegydd \o/
 
Thanks though Dr Fizz. (and congrats on your metallic Ailuropoda melanoleuca)
 
10:45 AM
cabbage
 
cbg @vaultah
 
Hi all
 
heya
 
Do anyone know how to print a HTML attribute's value as a string?
 
Probably just view source
 
10:53 AM
@RobertGrant: Then?
@RobertGrant: Thanks for the answer btw.
 
Look for the element the attribute is part of
 
In what kind of context are you?
 
@RobertGrant: I have found the element's attribute using Selenium. But I can't just print it.
 
My mom keeps telling me to find a job :[
 
@poke: I'm writing a bot. Using Selenium I have found the value of attribute located in an element, but I can't print it. It throw an error.
 
10:56 AM
Hello
 
Hi
 
Morning folks
 
Good morning
 
morning @Intrepid
 
This is the error that I get when attempting to print the attribute's value :
AttributeError: 'unicode' object has no attribute 'text'
 
11:05 AM
I hate to break it to you driver, but that's probably because you're trying to access a text attribute on an unicode object, and there isn't one ^^
But without any source code to peruse over, wouldn't be able to say any more on the matter
 
@vaultah you struggling to find work?
 
@IntrepidBrit: Thanks for the answer. You are right, I will post source code as soon as possible.
See you guys, thanks for the answers.
 
Would it be wrong to say that a unicode object is a form of a string by itself? And you are trying to do a string.text? Without the source, i would say that, what contains that unicode on the top level is the object that contains the text. Just my 5 cents
 
@Godfrey: Thanks for the answer, I will be back with source code.
 
@RobertGrant nope, I just don't want to work :D
 
11:18 AM
Wow, Python 3.5 is a lot tot take in, type systems, async/await, async iteration and a ton of stuff.
 
Ah, well then she definitely has a point :)
 
It's like a whole other language
 
cabbage
 
11:21 AM
@BenjaminGruenbaum I can't wait for more big applications to use that stuff and people say "How many processes are allocated to that to scale it to 1 million users?" Ans: 1 still.
 
Yeah, it looks amazing
 
I spent so much time trying to maintain the Riley Banks' story. Why do freelance job sites require a valid (UK) phone number :(
Plus some only accept real photos
 
closed
 
Worst key function evah: stackoverflow.com/q/31203983/4014959 :)
 
11:26 AM
@vaultah accepting real photos isn't a terrible thing?
Although the phone number thing is a bit weird
 
@PM2Ring At least it’s not lambda x: float(myList[index])
 
@vaultah Riley Banks' story?
 
@poke But if it were, he wouldn't get that "list index out of range" error. :)
 
@RobertGrant I don't like posting my real photos on the internet
 
I've never had to submit a photo to a job site.
 
11:29 AM
makes total sense for free lancing
>_>
 
@IntrepidBrit Riley Banks is my name
My twin which lives in UK :D
 
Awesome. We'll have to invite him to sopycon. Sorry vaultah
 
Heh
 
I’m confused
 
I always post my real photo :)
 
11:32 AM
@vaultah Just send them the photo from your github account?
 
> • Please change your photo to one that shows just your face and no more of your body than your neck and shoulders. The photo should not contain any text. When in doubt, use a photo that you would use for your passport.
@poke I did ^
 
>_< They didn’t recognize that “text” on the photo, did they?
 
@everyone, pardon my bold intrusion but i am trying to do a REST project for the first time and i need ideas on how to attack this. Stand alone application needs to send data to a django site that then sends that data to google services. "Django site already works and authenticates users posts data to account."
 
Hi, I am new here. I have a query. I want to learn Hadoop (Big Data). Should I learn Python for it or Java would be fine? Thanks in advance
 
@Godfrey hey, so by “REST project” you mean that you want the Django site to talk to Google using their REST API?
@Ravish Python should be fine enough for it; but choose whatever you prefer
 
11:37 AM
Thanks, @Godfrey
 
@poke REST needs to only talk to Django site. The site handles the rest
 
Thanks, * @poke
 
@Godfrey REST is a certain kind of communication, it is not an actor, so I’m still unclear who is talking to what
 
I think he's saying the web page talks to a RESTful Django endpoint, and now he needs Django to talk to google services
 
11:39 AM
Stand alone application has all the data. That data needs to somehow get to that Django site
 
Oh, so you want to add some REST endpoints to the Django site which you can then communicate with from the stand alone application
 
yes
 
Do you want the Django site to save the data in a database, or just forward it on to Google without saving it?
 
I have only done stand alone applications that interact with local databases
the django site authenticates the user and sends data straight to the account without saving it.
So i guess the stand alone application becomes the user as it has to provide the credentials.
 
user559633
 
Thanks @Robert and @poke .It has already made me think about it further. I think my application needs to login first, then provide the data on top of that. I will try to figure out the rest. Still comment if you have to.
 
@tristan voted
@Godfrey Only thing to consider is that if Django doesn't save the data, then if there's an error (e.g. connectivity) how do you cope with that?
Common strategy is to start optimistic and switch to store-and-forward if there are errors
But that at least partially may depend on the source system's capabilities
 
@PM2Ring Hmm - i think you may have misinterpreted that question. Not saying it's good, but they've got a list of lists, I think - so they're trying to sort the list by the 8th member of each sub_list. I wonder if it might be an off-by-one (i.e. trying to sort by 7th member, index should be 6).
 
Cabbage, all, bugrit
 
user559633
I really should read Discword
 
12:06 PM
You should
 
@PM2Ring Oops - no I should have read the comments more carefully. Ah well - I'll expect another question on "why does my char not convert to a float properly" apologies for inferring you'd missed it :(
cabbage @holdenweb, how goes it?
 
@JRichardSnape Well, thanks. Had an interesting two-day class. Least experienced student had no programming experience, some had 2 years of Python.
 
user559633
Have a good day everyone
 
@tristan does that mean rhubarb from you?
 
12:08 PM
An interesting exercise in differentiated teaching
 
@JRichardSnape :) Sorry I didn't reply earlier, I was busy playing with this & accidentally had my speaker turned off.
 
It's OK - it'll teach me not to rush into things ;) Actually, it probably won't
 
@JRichardSnape Yes. Students professed themselves satisfied, but I'll know more when they turn their questionnaires in to their employer.
 
Cheerio!
 
@holdenweb ah yes. The cloak of anonymity, or even simply not having to say it face to face, elicits blunt (and often good) feedback.
 
12:13 PM
@JRichardSnape I am somewhat immune from criticism here, as I'm not looking for more training work - I become a full-time employee at Duedil next Monday
But yes, I do usually get better feedback when I hand out my own questionnaire.
 
good stuff - enjoy the new job :)
 
Hope I'm going to - I have two weeks on the job then I fly to the States for OSCON and Seattle PyData
 
@PM2Ring Interesting little problem. Are you writing something up? I think I might be able to see a little flaw in the OP code...
 
@JRichardSnape I've written some code for my own amusement, but I'm not going to post it, since the OP's asking about a problem for a coding contest. But I have just posted a comment with a hint.
 
12:31 PM
good stuff. I wonder, though, you don't think that the way they're tacitly dealing with \n is (part of) the problem? e.g. why is it len(phrase)-1 sometimes and not others... I think that happens to suit the exact sample set...
 
I've heard it's more common than you might think
 
Not surprised that it'd not be much of a subject of awareness campaigns, but still. Crazy stuff.
 
@JRichardSnape Oops! I didn't even notice that len(phrase)-1. I have no idea why they're doing that. :)
Here's the core of my solution:
 
@JRichardSnape But also depends on definition. Ie - if a girlfriend has ever chucked something at you, then that technically counts
 
12:38 PM
@IntrepidBrit both ways, yeah
 
because they got a random letter on the end - didn't know why so just cut it off :) because they tried to decode \n . Thought - ah, must be an artefact of when there's more than one code number repetition.
 
My mum once threw a spoon at me so hard that it snapped in half on my back.
 
I'm practicing psychic debugging again
 
def shift(ch, delta):
    i = vocab.index(ch) + len(vocab) - delta
    return vocab[i % len(vocab)]

def gronsfeld(key, msg):
    key = [int(v) for v in key]
    rep = float(len(msg)) / len(key)
    key = (key * int(math.ceil(rep)))[:len(msg)]
    return ''.join([shift(ch, delta) for delta, ch in zip(key, msg)])
 
12:39 PM
@Ffisegydd well you shouldn't keep sawing her spoons almost in half as a prank
 
I can't remember exactly what I said, some bit of cheek, and I realised I'd gone too far because I then proceeded to run (which is why she threw it at me and it hit my back)
 
@IntrepidBrit indeed so, indeed so...
 
potentially makes light of serious issues
 
But yeah thanks for making light of CHILD ABUSE ROBERT!
 
thinks this is somewhat dangerous ground to be on
 
12:40 PM
I think some women think men are Superman and actually can only be harmed by kryptonite, so they're just expressing themselves.
 
Gads, I originally misread that as half of the spoon getting stuck in you!
 
@JRichardSnape That makes sense, and it is a fairly common mistake for Python newbies to not handle EOLs correctly.
 
yeah - specially as the last line doesn't have one in the sample set - probably missed that he'd not decoded the . character.
A lesson in precision and accuracy needed. The computer never does anything you didn't tell it to he drones wearily, the 94th time he'd taught this class. "Turn to page 94 in your notes..."
 
:)
Well, it doesn't do anything you or whoever wrote the layer you're coding against, or whoever wrote they layer they're coding against (repeat to the CPU) told it to do :)
@JRichardSnape it's more terrifying that discussing it is considered dangerous ground, but yes, agreed
 
Use FOSS - then it's all down to you - if it does something weird - go find it, he replied. Now, where's my tinfoil hat
@RobertGrant Actually - I more meant it's quite possible to upset someone were they to be affected by the issue, rather than it being dangerous to discuss at all, I guess. Maybe I'm just walking on eggshells - it has been known.
 
12:49 PM
No it's a fair point.
It'd done now anyway, let's talk about tinfoil hat designs instead.
I personally prefer the sailor's hat for it's flair but at the same time you can't beat the bowler hat for maximum insulation properties.
 
I see @JohanLarsson lurking in the background... here's a funky piece called Toe Hold by singer / songwriter / guitarist / pianist and occasional harmonica player Ellen McIlwaine. And a more traditionally bluesy piece that shows off Ellen's slide-playing brilliance Secret in This Lady's Heart
 
Also you can store a cornish pasty in there
 
@PM2Ring At work, listening later, thanks for the ping :)
 
What about a human-sized Faraday Condom?
 
12:52 PM
No worries, Johan.
 
laughs alone
 
ALL: I'd like to get your thoughts on dynamically assigning attributes (data or functions) to classes or instances. My thought: I'd rather not use getattr or try: foo.name except AttributeError: pass...
 
@Rob Faraday cages block electric fields but not necessarily electromagnetic radiation.
 
@RobertGrant I was about to suggest a farady tinfoil hat.
But I feel that tin-foil doesn't protect enough. I like to use a tin-lead alloy for my hats
 
I've had some people tell me they really like it though. Not much reasoning, just a direct contradiction.
 
12:56 PM
The problem with Faraday cages is you need to ground them too.
Of course one big advantage of Faraday cages is they're named after the single greatest scientist in the history of humanity, Michael "The Boss" Faraday.
3
 
@Ffisegydd ooh good knowledge bomb
And that makes sense
 
@Ffisegydd I advocate for the tinfoil balaclava. Maximum protection and added primary school cyberman costume aesthetic.
for nostalgia points
I can't not star Michael "The Boss" Faraday
 
The guy is a personal hero of mine. Had no real formal education. Taught himself by being an apprentice bookbinder and reading the books as he went. Managed to work his way up through being assistants to people. Worked his way to becoming one of the greatest experimentalists ever.
 
Very cool
 
@Ffisegydd What do you think the trailing wire following the hat around is for? I've also combined mine with a snazzy scarf combo that people inevitably trip on
 
1:05 PM
In a pinch you can use it as a garrotte if the Government comes at you head-on.
 
The thought had crossed my mind
 
I've read that cars are faraday cages (perhaps that's not entirely correct) but they are not grounded.
Same for planes
 
@AaronHall Oh I dunno. Most cars I've met are pretty humble and down-to-earth
 
Ones with chains I guess are grounded
But you don't see that so much these days
 
Faraday was awesome. FWIW, in my youth I helped build a high-voltage Faraday cage at the Lane Cove Testing Station. I think this is a picture of it in action:
 
1:06 PM
No comments about my attributes question?
 
Nope.
And I'm pretty sure Faraday cages need to be grounded, though I haven't looked at the theory in a few years.
 
@AaronHall I tend to run shy of dynamically added attributes, but I put that down to the legacy of a long time Java
 
I don't think they do need to be grounded FWIW, but I guess they could retain charge if they're not
 
I recall flask does it.
 
1:07 PM
Coool
@AaronHall I do it to some stuff before I pass it to a template for rendering, just because the normalised DB structure isn't necessarily the most useful for when you're doing template stuff
 
thinks about the physics from a long time ago
 
@Ffisegydd They don't have to be, but it helps. :)
 
realises he needs google
or @PM2Ring
 
Physics from a long time ago? It's all phlogiston!
 
I'm not quite that old, Robert !!
 
1:09 PM
Or is it ether? No - wait! It's dark energy!
Physics from a long time ago could well be before you were born :)
 
thinks about the english language from a long time ago
I'm using a lot of italicisation today. I know not why.
I think it's the stream of conciousness you're being subjected to
 
The Royal Institution Christmas Lectures are a series of lectures on a single topic, which have been held at the Royal Institution in London each year since 1825, missing 1939-42 due to the Second World War. The lectures present scientific subjects to a general audience, including young people, in an informative and entertaining manner. Michael Faraday initiated the first Christmas Lecture series in 1825. This came at a time when organised education for young people was scarce. Faraday presented a total of nineteen series in all. == History == The Royal Institution's Christmas Lectures were first...
 
I'll stop now
 
19, wow
All we had was Peter Snow enthusiastically nodding along to stuff he didn't seem to understand on Tomorrow's World
@Ffisegydd you can be this generation's Faraday
 
haven't heard this in ages...
 
1:23 PM
There are 2 books by Faraday at Project Gutenberg, and the University of Adelaide has a collection of facsimiles of material by Faraday: ebooks.adelaide.edu.au/f/faraday/michael
 
@RobertGrant I did not follow that at all.
 
welcome @stellasia
 
@AaronHall Dynamic class attributes are handy when you need them. Here's a situation where they (kind of) make sense: adding plug-in methods to a class at runtime :grumbles: I put a bit of work into that answer & didn't even get a comment for it. :(
 
2:21 PM
I'm reading that now, maybe there's something on programmers.se too...
There, I commented...
 
@AaronHall :)
 
mega class?
know how to use mixins?
 
I don't think use of dynamic attributes should be encouraged, since they can make the code a little harder to read: IMO object definitions should be condensed as much as is practical, not spread out all over the place. OTOH, Guido introduces them quite early in the tutorial section on classes, so I guess they're Pythonic.
 
They're a distinct feature of Python, that other languages don't have for reasons right?
 
@AaronHall I've never tried. And I get the impression that mixins are discouraged in Python.
 
2:29 PM
So maybe it (dynamic attributes) should not be the first way to go about things.
 
@AaronHall Well, dynamic attributes would not be pleasant in a language with strict typing, but that doesn't apply to Python, with its duck-typing philosophy.
 
Now mixins are just collections of methods that you can add in to an object.
 
@AaronHall I agree.
 
through multiple inheritance.
And if they're orthogonal to the rest of the object's code, there's no harm in sticking them in another file.
particularly if they can be reused in other contexts.
And using mixins to provide functionality is more static than just assigning attributes willy-nilly.
 
This gets me thinking about whether you could do OO programming by having a class and depending on what type you needed, you overwrote/added functions on it
 
2:36 PM
Some interesting thoughts on mixins in Python: Mixins considered harmful
 
Don't know why you'd do that, but hey :)
 
well you obviously could but that would seem much more difficult to reason about than mixins.
 
@RobertGrant You could, but it could easily get confusing for people reading your code. Explicitly defined stuff is almost always easier to keep track of than stuff that's created dynamically.
 
@PM2Ring Seem like weird arguments… just because you can use mixins that doesn’t mean that you shouldn’t be careful about what members you add to stuff.
 
I know guys, I was just saying :)
Rbrb y'all
 
2:42 PM
Open for extension, closed for modification...
Single responsibility...
 
@poke I guess the blog author is mostly complaining about having to work with a framework where the framework's developers weren't careful, so the resulting objects are a minefield.
 
Ignoring that the “XY considered harmful” title pattern is super stupid anyway, the title is wrong then. It should be “I don’t like to work with frameworks that are not well designed.”
Mixins are just an efficient way to reuse code by directly copying it into the new type. You shouldn’t put stuff in mixins that you wouldn’t put in the type itself anyway.
 
directly copying adding to the mro
 
implementation detail
I’m talking about the concept
 
ok, I'll let it slide - just this one time...
 
2:50 PM
Fair enough. Still, I guess the point is that mixins also make it easy to create messy classes. OTOH, I guess mixins can help to keep complicated classes flat, rather than having huge inheritance chains.
 
So I'm wrapping my head around applying the Interface segregation principle to Python. Seems like we get that with the ABC's in the collections and numbers module. And if we use and make use of that type of programming, then we have embraced the Interface segregation principle.
I'm thinking of a blog post: "Microsoft considered harmful"
And then when you depend on the abstractions provided by the base classes (whether actually used or just duck-typed) you've embraced the Dependency inversion principle.
Python: The SOLID programming language.
 
Welcome @LogicStuff and @vinni_f
 
Yes, welcome all.
 
3:17 PM
sup python! I use eclipse with pydev as IDE at work. I want to add another project as a dependency to the project I am working on... How can I acheive the latter?
 
3:32 PM
Can you believe this poor guy? workplace.stackexchange.com/q/49189/12321
 
omnomnom prosciutto and soft cheese bagels.
 
@Ffisegydd nice :)
 
3:51 PM
enjoy! :)
just for completeness: is it bagels with melted cheese baked on top of them or is the cheese inside the bagel, like a small toroid inside a larger toroid?
 
cbg
 
@AaronHall Dunno, some people need to rant sometimes
and cabbage to you @BhargavRao
 
@Ffisegydd So jealous.
 
00:00 - 16:0016:00 - 00:00

« first day (1721 days earlier)      last day (3234 days later) »