« first day (1718 days earlier)      last day (3230 days later) » 

2:00 PM
Whoever did that, starred in the correct order. Well done!
 
def put(s):
    print type(s), repr(s)
    print s
    print s.encode('utf-8')
    print

put(u"all rights reserved © Kevin Kevinson")
put("all rights reserved © Kevin Kevinson")
<type 'unicode'> u'all rights reserved \xa9 Kevin Kevinson'
all rights reserved © Kevin Kevinson
all rights reserved © Kevin Kevinson

<type 'str'> 'all rights reserved \xc2\xa9 Kevin Kevinson'
all rights reserved © Kevin Kevinson
Traceback (most recent call last):
...
print s.encode('utf-8')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 20: ordinal not in range(128)
 
Filipino Longaniza and fried eggs at the breakfast club today, folks.
 
Everyone on this conference call sounds like a robot.
all tinny echoes and whatnot
 
Modulate the parameters.
 
2:13 PM
Are you using cans and string?
 
user559633
Are you speaking to robots?
 
looks for "parameters" dial on phone
If the other participants are robots, that's not the cause of the voices, because one of them is two rooms away from me and they sound normal over the air but weird on the phone.
 
Maybe they don't use their synthetic voicebox for phone calls
 
So you can actually compare the voices simultaneously, eh?
 
Yeah, it's actually a little disconcerting because the phone lags behind reality by a tenth of a second
 
2:16 PM
Maybe they're jacked in, and all the manufacturer could afford was a $1 voice chip for that
 
Maybe your phone is the Beats brand?
 
My coworker suggests that it's my boss' fault. I accept this theory.
 
Your boss approved the voice chip budget?
 
But you didn't fail to reject the simpler hypothesis that your coworkers are androids.
 
So...he did reject it?
 
2:23 PM
modulates his own parameters yeah, he leapt to that conclusion...
 
I rejected "my coworkers are androids" because they sound normal IRL. I have not rejected "my coworkers are androids that connect directly to the phone network but their speech synthesis software doesn't work perfectly in that specific context even though it's fine when used on their default speaker" but I don't consider that simpler
 
A fine example of Kevin's Razor.
 
What about "my colleagues' phones are androids"?
 
I have an Android phone. Is colleagueness reflexive?
 
No :)
Related thought: either you or your phone is an android
 
2:26 PM
Is it eether or eye-ther?
 
Maybe they're all on Apple and are using iSpeak, the new amazing voice protocol that only Apple users can fully make use of
 
@Dracunos either is fine with me
 
@Dracunos I say eever.
 
Same, mostly
 
@Kevin Recursion limit reached
I broke my application, and I'm not sure how yet. Bleh.
Rbrb :)
 
2:30 PM
Speaking of recursion, why do so many newbs try to use recursion in their input routines? Here's a recent example. It seems bizarre to me. Where do they learn this crap???
 
Recursion is the solution to every problem
 
They probably googled "Learn how to program" and were directed to a SICP shrine.
 
@Dracunos Recursion is the solution to recursion.
 
I find it slightly amusing that he has no qualms about using recursion, but didn't want to use return because he thought it would "completely break the function"...
 
(…is the solution to recursion is the solution to recursion is the solution to recursion is the solution to recursion…)
 
2:33 PM
There's a reason I specifically added a section on why recursion is a bad idea in my "asking user for input" megaquestion
 
I don't think I've ever actually used recursion in a real problem.
 
@QuestionC Ah. Good call. FWIW, I'm not anti-recursion. But I certainly try to avoid it (especially in Python) except where it's appropriate to the data structures you're handling.
 
Make a recursive binary search
 
@MorganThrapp it's useful in some cases, see this: stackoverflow.com/a/30316760/541136
 
I think your hint helped the suffler, @PM2Ring - they've managed to find the answer themselves and "hope to get better at asking questions on this site"
 
2:36 PM
Define 'real'. You can't write anything that parses (like an infix calculator) without some kind of recursion.
 
FWIW, I actually used recursion today, in a program that finds loops in a connected graph. It took me a little while to get it right - the recursive function is a generator, which makes things a little bit hairier than normal. :)
 
I'm sure it has uses, I've just never had one apply. :P
 
@JRichardSnape Excellent
 
2:49 PM
FWIW, here's the function. `neighbours` is a dict of sets. If node `a` is connected to node`b` then `b` is in `neighbours[a]` and `a` is in `neighbours[b]`.
def find_loops(neighbours, looplen, a, chain):
    tail_len = looplen - len(chain)
    if tail_len == 1:
        for b in neighbours[a]:
            if b == chain[0]:
                yield chain + [b]
    elif tail_len > 1:
        for b in neighbours[a]:
            if b not in chain:
                for loop in find_loops(neighbours, looplen, b, chain + [b]):
                    yield loop
 
I shouldn't have eaten that pastry
Does a honey/cinnamon bun count as a pastry?
 
Hah. The Met Office has declared a Level 2 Heatwave Warning for the UK, saying that temperatures could reach 32C (89.6F).
 
I actually laughed at that.
 
@Dracunos Yes.
 
That's funny
 
2:56 PM
To be fair, that is really, really hot :P
 
Fizzy, will people die?
 
If it's 80% humidity
 
@Aaron joking about UKs temp vs other countries aside, yes some will probably die. Elderly and such.
Gotta remember what while it may seem not very "hot" to you, we don't have houses built to withstand heat regularly, I don't know anyone that has AC or anything.
 
It was in the 100's regularly in Florida, but we had AC everywhere.
 
It'll probably be over a hundred indoors, especially if you have a lot of electronics
 
2:58 PM
Plus people just aren't used to it.
 
You guys will be the first to go when the giant solar flare hits
 
(Some) shops may have some AC.
Hey up DSM
 
DSM
Cabbage, all.
I could click and find out what "find a 4th" means but I like the mystery.
 
Did Christopher Lee die?
 
Yeah a few weeks ago.
 
3:01 PM
I'll admit that 30°C is rather warm, but we had a few summer days this year that got to 40°C. It's now getting into winter here, and people are complaining when it's under 20°C.
 
@DSM I assume our barbershop triplet is looking for one more member.
Just can't quite get that harmony otherwise
 
We're quite lucky in UK, we don't tend to get horrendous summers (a few days of the year it may reach 30C) and we don't tend to get horrendous winters (a few weeks it'll be below -3C)
 
OMG, he was 93, astonishing.
 
DSM
We need a name for a Python-related band which is slightly corny-funny when you first hear it but then becomes less amusing with repetition. (#simpsons). Maybe "Zen Scales"?
 
He didn't look it.
 
3:04 PM
I can cope with 30°C, but I don't do well when it's colder than 15°, especially if it's windy.
 
DSM
14-15° and windy is my preferred arrangement!
 
Oh hey, here's my function to determine the size of a Python object (with its contents). Help me improve it and I'll credit you:
 
@Aaron would you mind throwing that in a dpaste.com link instead? We generally ask that code greater than 12 lines is linked.
(Or pastebin or Gist or your-text-host-of-choice)
 
I'm blocked at work, maybe gist
 
Or, you know, leave it in the answer of yours that you already linked
 
3:06 PM
@DSM I have a friend who lives in Melbourne who likes 15°C and colder. She had to live in Brisbane for a couple of years for university - she hated it. She called it Brisbain-marie.
 
went with davidism's suggestion.
 
Hi, Davidism.
 
@Ffisegydd Got a friend here who researches exactly that (building design vis-a-vis deaths due to heatwave). Surprisingly many at surprisingly low temperatures.
 
DSM
@JRichardSnape: do you mean surprisingly many at low-but-still-hot temperatures?
 
@JRS British buildings just aren't designed for it, you struggle to get a through draft, it's hard to avoid the sun heating a room through window exposure.
 
3:09 PM
yes - i.e. in low 30s. Not nearing absolute zero or anything ;)
 
DSM
When I was in London I spent more time in the office than I would have if it weren't air-conditioned and my flat not..
 
that's right. Not to mention the urban heat island (c.f. London), relatively high thermal mass buildings (once they're hot, they stay hot) and a few other things. It's a potential real problem
 
Some of the older houses here in Australia were not designed well for the climate - I suspect that they were designed in the UK & built here without modification.
 
I didn't care for that part of European life.
Of course there's a lot of places in NYC without cooling in the summer.
 
Having perfected my virtual-card gambling scheme from yesterday, I now possess in MTG Forge at least one copy of each member of the "Power Nine", the most potent and valuable Magic cards. And yet, despite my impressive virtual fake collectible card collection, I feel empty inside.
 
3:11 PM
and, somewhat counter-productively, the energy efficiency measures we implement which are in general good (more insulation, solar heating etc) can make things worse in the heat.
 
I know - I need four of each card. A Power Thirty-Six, if you will.
 
@Kevin The 4 black lotus should only run you ~6k or so.
 
Then, finally, I will be personally fulfilled. And this time I mean it.
@MorganThrapp The Forge economy is rather flat. Black Lotus is worth a buck twenty because it's a rare.
 
@Kevin Oh, I missed the Forge part. What is Forge?
 
A fan-maintained computer game that seeks to emulate actual Magic.
 
3:13 PM
@JRichardSnape Yeah. Insulation can keep the heat out to a degree in the early part of the hot season, but eventually the building heats up & takes ages to cool down.
 
@Kevin Oh, nice. I used xmage for a bit, but I'll have to give forge a shot.
 
I've been quite addicted to it, but I may be free soon because I've been gaming the system as hard as I can for the last three days. Once I transcend the rules of a game, I get bored with it.
 
@Kevin I just miss my infinite squirrel deck.
I haven't played in years, but I've been wanting to get back in to it.
 
Once I get the pieces for my 0-land Charbelcher deck, I should be able to consistently win on turn 1, and thus lose all interest in continuing.
 
@Kevin Holy power creep. :P
 
3:17 PM
@Kevin what is "actual Magic"
 
Well, the deck will be 95% cards from Alpha Edition, so it's kind of the opposite of power creep
 
Huh. That deck is really interesting. It seems like if you don't pull the exact opening hand you need, you lose.
 
Holy "stage where the game devs had a poor grasp of power balance"
 
cbg all
 
@MorganThrapp My friend actually has the deck IRL. Your perception is mostly accurate.
 
He can stall for five or so turns before his opponent can kill him, but if he doesn't get the pieces by that point, he just scoops
 
Is that roughly it?
Serum powder is really weird.
 
Yeah, minus the Spellbooks and plus Tinder wall, land grant, and one taiga
I guess it's technically 1-land belcher
 
Yeah, the spellbooks seemed weird to me.
 
rhubarb
 
3:21 PM
Why not run more cycle cantrips?
 
Street Wraith is the only cycling card that costs no mana. And since so much of the mana base of the deck is one-use-only, you don't want to permanently spend your most valuable resource to draw an unknown card
 
Ahh, gotcha. That makes sense.
 
It might be worth it if it was an especially potent draw spell, like ancestral recall
Which is what my belcher variant will be playing.
 
Though, by the time you can run alpha cards, why not just run timewalk. ;)
 
My decklist is like: every artifact ever made that produces more mana than it costs, ancestral recall, timetwister, demonic tutor, 1 charbelcher
 
3:24 PM
Fourth generation was where it was at.. Ever since then it has gone downhill, adding new stuff just to make people buy newer more powerful cards.. psh
Back when channel fireball was still legal
 
I don't want to run time walk because you get a ten dollar bonus for winning on turn 1, and taking an extra turn technically puts you in turn 2
 
I have finally hit upon a single, nominally necessary use-case for pass
 
@Kevin Wait, you can actually win money with Forge? Alright, I really need to give it a shot.
Can you give me the link?
 
It's fake money. "credits".
 
Ahhhh, okay.
 
3:26 PM
@AaronHall Which is?
Empty exception handling?
 
@Dracunos Heh, from a certain perspective you're not wrong
 
nah, just use a docstring for that, it's way better, ok, that might be another...
 
DSM
Ehh, ick.
 
user559633
@AaronHall Gandalf talking to things that aren't balrogs?
 
@MorganThrapp www.slightlymagic.net/wiki/Forge, last I checked
 
3:28 PM
@Kevin Cool, thanks.
 
I was thinking you meant: class MyException(Exception): pass vs `class MyException(Exception): 'useful documentation...'
 
When I played Magic, it was like 7th or 8th I think, and it felt like cards were getting weaker/slower. Stuff like shock vs lightning bolt.
 
Yeah, other than a brief reappearance in M2010, lightning bolt has been retired
Although there's no official word that it's gone forever
 
if you're following the principles of structured programming (preferring a single exit point for a function), also trying to keep it flat(ter), avoiding nested conditions, and want to bypass control flow on a condition (which semantically-ish works for except: pass too) then pass is the optimal way to go. Or so I think.
 
user559633
@AaronHall Example code?
 
3:31 PM
see my recursive function again. :D
 
There was this one pc mtg game where you actually didn't have to sink hundreds of dollars into booster packs and decks and crap, you just paid for the game itself and you would play mtg against AI and collect cards ingame as you played
 
@Dracunos Oh, the one where you walked around the map and monsters would run up to you and duel you?
 
Perhaps you're referring to Shandalar.
 
It had diablo looking graphics if I remember correctly
 
YEA, that was the bomb.
 
user559633
3:33 PM
oh, the link above. maybe later :)
 
Let's change the room name to "Python The Gathering." "The Round Table" or "Camelot" would work too, for 'tis a silly place.
 
You can play against those decks in Forge.
 
@AaronHall I suspect that it's impossible to define a noop function without pass, which would be a strictly necessary use of pass.
I had that come up during lambda shenanigans.
 
def foo(): 'doc the func...'
 
@AaronHall Ok, I'm done now ;-)
 
3:35 PM
No, do continue. Dueling monsters?
 
Let's talk about the pokemon card game now
 
DSM
When testing raw iteration speed I think for i in range(100): pass looks much better than for i in range(100): "syntactically valid but conceptually confusing".
 
It's a surprisingly robust game
 
Or Hearthstone, the new kid on the block.
 
@DSM but when would I do that?
 
3:37 PM
It is said that the GBC pokemon card game is excellent.
Yes, the video game based off the card game based off the video game.
add in a "based off the cartoon" somewhere, although I don't know the precise chain of causality
 
It's probably not even desirable.
 
gameboy color?
 
Yes
 
DSM
@AaronHall: I do it often to prove that people are worried about things which they needn't be.
 
ok, fair enough, have at you.
I'm not sure that made sense.
 
3:39 PM
Actual Python chat: I use pass as the body of an otherwise empty class definition, which is occasionally useful if you want to staple arbitrary attributes onto an object.
 
@Kevin Oh yes. The Pokèmon Trading Card Game game for GBC was amazing.
I loved it so much
 
@Kevin docstrings
 
I'll have to... acquire... A copy of the game for my upcoming vacation
 
class NameSpace(object):
    '''stick arbitrary names on me, I don't mind!'''
 
DSM
I really don't like the way that looks.
 
3:40 PM
@Kevin from types import SimpleNamespace
>>> x = SimpleNamespace()
>>> x.lets = 'put'
>>> x.some = 'attributes'
>>> x.on = 'this'
>>> x.object = '!!'
>>> x
namespace(lets='put', object='!!', on='this', some='attributes')
>>> vars(x)
{'some': 'attributes', 'lets': 'put', 'on': 'this', 'object': '!!'}
 
I love it. It's simple. It's documented. and types is hacky anyways. :P
 
I knew that functionality existed within the standard libs, but I can never remember where.
 
“and types is hacky anyways” [citation needed]
 
Empty classes have the benefit of not requiring me to remember a module name :-D
If I ever need attribute stapling for a serious project, I promise to do it the right way.
 
Empty classes for this purpose have the disadvantage that they don’t share a type, and are generally throw-away types which is bad for code maintenance.
 
3:43 PM
hackfest^^
optimal? sure, but let's see the sausage being made...
 
That is your opinion. Also, it’s not really hacking. Also, it’s Python 2.
 
Gotta go for a while, coworkers are switching out the router.
 
DSM
Nothing like some midday rhubarb as a snack.
 
which I may point out doesn't even have SimpleNamespace
 
@AaronHall That’s because you are still stuck in the past.
 
3:47 PM
2.6.8 to be precise...
 
That's odd. There's a "Kevin" making references to psychic debugging, but on C++ questions.
 
DSM
Is it pseudoKevin (the other Python Kevin, but not ours) or a different Kevin entirely?
 
cbg
 
so the moral of the story is to use docstrings instead of pass for empty class and function definitions.
 
DSM
3:50 PM
If by "moral" you mean "opinion of one Python programmer", then yes. :-)
 
you guys read the book Joel on Software?
 
@AaronHall Yeah, I've read it.
 
@AaronHall I dislike that… I would still put an explicit pass on it.
 
Well there goes my logic for superior moral authority...
 
@DSM There are too many Kevins on Kevin Overflow.
 
DSM
3:53 PM
itertools.repeat(["Kevin"])
 
I liked the Joel on Software blog, but I feel that moral superiority might be a bit much for what's essentially advice about managing time/expectations/complexity.
 
Heh.
 
@QuestionC I enjoyed the book. It's just a collection of essays he found useful/interesting.
 
My point was to argue that I had the moral high ground. Not that it was a really cool book and all.
 
Thanks for clearing your moral high ground up.
 
3:56 PM
wields Narya and Glamdring "You shall not pass!" Strikes bridge with staff.
 
http://livecoding.tv doesn't work but http://www.livecoding.tv does. This saddens me.
 
@AaronHall And what happened afterwards? The bridge collapsed. That’s why you let things pass.
 
Now if the pope/dalai lama/high priestess of Corellon wrote a book about software design, then I think you might have a case for moral superiority.
 
@poke applause
 
DSM
Okay, I have to admit using "shall not pass" in this sense is kind of cute.
 
3:58 PM
Gah. This website asks me for my "programming level" and says beginner, intermediate, or expert. But I want to say 4/5 D:
I want to be an advanced intermediate, or a mini expert :(
 
Expert it is.
 
DSM
I usually just go with "intermediate".
 
Probably should go with intermediate.
As I'm not an expert (round down and all that)
 
imposter syndrome ^^^
Fizzy, you have your silver Python badge. Only approximately 600 people on this Earth can say that.
And you're probably in the top 3% or so of users here.
And that's out of people who get over 200 rep.
 
@AaronHall But also, the badge (or SO reputation) doesn’t say anything about skill.
 
user559633
4:04 PM
Nor do points. They're internet points.
 
It takes no skill to answer questions here and not have them downvoted into oblivion?
 
Yes.
 
Ah, the things I know that just aren't so...
 
user559633
Heh, jokes aside, points and badges on stack overflow shouldn't necessarily be equated with knowledge or skill.
 
DSM
Equated, no. But I do think they correlate, although not very strongly.
 
4:07 PM
And the inverse is even more true (since you’re talking about the inverse actually): Having questions or answers with a lot of upvotes does not mean at all that you are knowledgeable in certain topics.
 
that's true, poke DSM, for example, prefers pass to documentation, so... :P
 
Weep. Can't get pokemon tcg working :(
 
@AaronHall That’s not what I said.
 
no it was DSM wasn't it.
 
DSM
I prefer using pass (with or without the presence of documentation) to its absence, yes.
 
4:10 PM
I've seen far too many high rep users who can't tell one end of a context manager from the other to give much credence to internet points.
There is some correlation, yes. There are better metrics for expertness though.
 
And then there's me. I have so little rep despite the fact that I know everything about everything. It's strange
 
I believe you can tell how knowledgeable someone is by looking at the questions and answers of that person. But by looking at the content, not the numbers.
 
Yes, it also correlates with the ability and willingness to answer questions on the main site.
Now if I could just figure out how to get more people to look at my content.
The sorting algorithm is very slow.
 
DSM
@poke: sure, more information is better. But that doesn't mean a noisy proxy is information-free.
 
for questions over a few minutes old, anyways.
 
4:14 PM
Is there a duplicate question for "What is list.append?"?
 
Maybe not, but I don't think that's a very good question.
 
user559633
@AaronHall what? why do you care?
 
@AaronHall Oh it's a terrible question. It just doesn't seem to technically fit any CV reasons, so a dupe seemed like the right way.
 
Well if it's a dupe, vote to close.
 
user559633
4:20 PM
If it's because you want the chance to offer more in depth explanations, it's often the case that the asker just wants to copy/paste and move on, so I wouldn't put much weight in point-to-more-correct-answer on a given question.
 
No argument here.
 
DSM
4:36 PM
Sometimes I think I should start a data-mangling consulting service for beer money to answer questions like this, but I'd have to advertise on SO to get business.. which wouldn't last very long before the ninjas get all slicy.
 
ninjas? slicy?
 
DSM
ninjas = our moderator friends, slicy = putting an end to my advertisement with extreme prejudice
 
I was assuming you'd be paying for your ads, so the question would be would SO consider you a strategic threat?
 
DSM
@AaronHall: the advertisements I had in mind would be comments of the "This really isn't a good SO question. Have you considered Epicyclic Consulting?"...
 
you'd be competing with the dollars of fast burning startups looking to hire. Could you make enough to pay for the ads?
 
DSM
4:44 PM
No.
 
About flipping time, our test harness is back up. Now we can get back to work.
 
@DSM it sounds like you want airpair, codementor, hackhands, etc.
the things that Martijn advertises in his profile
 
Ever wonder about the difference between unbound and bound methods? hg.python.org/cpython/file/2.7/Lib/types.py#l51
>>> types.MethodType is types.UnboundMethodType
True
 
cbg
 
DSM
5:08 PM
@davidism: ehh, but don't you usually have to apply for posted jobs there? I kind of want a steady stream of petitioners arriving with easy problems they're willing to overpay me for..
 
You'd have to ask @Martijn for the details, but no, I think you advertise what you're willing to help with at what price, and they get paired.
 
DSM
Hmm.
 
Isn't that more "programming help and advice"? What you want is something like fiver?
 
You get notified of new interested parties, but only if their budget is high enough.
And people can book you directly, but again, you set a price point.
 
user559633
@MartijnPieters did you answer @davidism's question about which python web framework is your favorite? if so, i'd like to read your response
 
user559633
5:12 PM
sorry, this was from an airpair "ask me questions" thing from months ago.. not exactly topical
 
What is your favorite, and why is it Flask?
 
user559633
Yes, that
 
I hear he prefers bottle.
Interesting fact: we had a proposal to speak at PyGotham on Bottle.
 
user559633
Anything good or was it an "intro to bottle?"
 
user559633
When I was first learning python (3 years ago), I liked bottle because !!single file!!
 
user559633
5:19 PM
i am continuously embarrassed by every thought i had up until 1 minute ago.
 
DSM
@tristan: you've only been using Python for three years?
 
Wait, bottle is only one file?
 
Sippin from a bottle - My new blog title :P
 
user559633
@DSM to be honest, maybe closer to 2 because my job title has never been "software developer"
 
It's only one file, but it's a pretty big file. It also falls into the category of "superficially similar to Flask, but not nearly as powerful"
 
user559633
5:22 PM
@davidism yeah, my reasoning was that it was superficially easy to deploy that one file because i didn't understand packaging at the time
 
user559633
including testing in a "why is x faster than y question?" that's an upvote
 
user559633
@JoranBeasley haha i want you to add the dis :[
 
user559633
embrace my lazzzyyyyy
 
:P
I would be more interested in some plots I think :P
(if i wanted to invest any more time into that q)
 
5:28 PM
Read Amber's answer there
 
user559633
String translate and replace are both Python, for what it's worth.
 
oh bleh :P ok
 
user559633
They're both in string.py
 
retracted my idiot statement :P
 
I think we're declining the Bottle talk on the basis that no one uses it and we'd rather that speaker to talk about a different topic.
I hedge because we're not finalized.
 
5:31 PM
Flask is my favorite
 
pretty sure falcon is the new "smaller than Flask" framework, but I don't hear a lot about it either
 
but sometimes I find my self reimplementing large swaths of django
 
And there ya go.
 
@tristan can't remember if I did now..
 
If django modularized everything, I would take advantage in a heartbeat.
 
5:32 PM
@davidism: commuting now too.
Django is not on my list, to start with.
Flask and Pyramid, with Flask currently being the front runner only because I haven't had that much of a chance to use Pyramid lately.
Pyramid should scale to larger projects because it uses component architectures better.
 
falcon looks pretty cool
based on those benchmarks at least
I know @AnttiHaapala hates them all except pyramid
Flask is really slow from the benchmarks on falcons page ...
(but its so nice to work with)
tbh I wish django would split its ORM off from its main project
I like django ORM much better than sqlalchemy
 
Really?
 
yeah
I think they did an awesome job with their ORM
I write subclasses for sqlalchemy to try and mock some of the behaviour
I mean
 
Nope, I definitely prefer SQLAlchemy there.
 
Users.get(name="bob jung").all()
 
5:36 PM
Django's ORM is half-baked in many places.
 
session().query(Users).filter(Users.username=="bob jung").all()
 
I had to work around a Oracle bug where a materialised view simply wasn't.
 
Yeah, it really just doesn't hold up. The unit of work model is way more powerful.
SQLAlchemy also has the advantage of everything being an object, rather than using magic keyword args everywhere.
 
With SQLAlchemy I was able to rewrite the syntax tree on the fly to retarget the query to the right view when we could make use of the indexes.
You could never ever do that with Django's ORM.
 
5:38 PM
hmmm you lost me
 
SQLAlchemy objects result in a SQLAlchemy abstract syntax tree for the SQL query. By hooking into the session you can introspect that tree and transform it.
Oracle is supposed to use a materialised view for certain queries against the underlying table, where the view is faster because it has pre-computed the results.
But due to a bug it wasn't doing that. So I'd watch for queries that matched the right criteria, and rewrite the query to use the materialised view explicitly in those cases.
Because it is just an AST, all that was required was manipulating that tree, swapping out table names, for example.
 
oh yeah ok now I know what your talking about :P
but thats not really a common case ... most of the time my models are fairly primative (with some relationships) ... which is just much easier in django ORM ...
 
Yeah, I totally grokked that. AST. :P
 
I do like the fact that Django puts a lot of effort into security and i18n/l10n.
 
django ORM is focused primarilly on ease of use and readability ... sqlalchemy is more powerful I will grant you that
 
5:43 PM
@JoranBeasley the difference at the "basic models" level is that Django uses the active record pattern, which is much less efficient when dealing with large amounts of data.
Although they did add better transactions recently.
 
tbh I like having models directly tied to a session object (As if by magic)
 
Another small advantage of Django is that because batteries are included, there's a pretty much standard way to override any part of the framework, rather than plugging a bunch of extensions together that all do their own thing.
 
in sqlalchemy I regularly try to get a lazy dynamic relationship query from an object only to learn the object has lost its session
I like sqlalchemy better only because I can use it in any python project...
but I dont really need the super advanced features usually
 
And the serialization support is really handy in Django.
 
yeah thats one of my subclasses I make for my sqlalchemy
I use a subclass that lets all models be easily serializeable, and I use another subclass that adds get and save methods to each class (get being a classmethod) this sort of lets me pretend I am using django orm
 
5:48 PM
Yeah, if you check out sopython's code I do something similar
So I like security, i18n, standardization, and serialization, but still not enough to justify using Django over Flask/SQLAlchemy.
 

« first day (1718 days earlier)      last day (3230 days later) »