« first day (1760 days earlier)      last day (3191 days later) » 

3:00 PM
With the bewildering sign-off "How is this not related to programming? Seriously?"
 
Saswat has hit -16 on his Serial Downvoting Meta question. And I've got 7 upvotes on my comment. :)
@Saswat: Could you explain why you ignore your spell checker? Those wiggly red lines aren't just for decoration, you know. — PM 2Ring 1 hour ago
 
Fairly understandable if he looked at the four off topic votes but didn't see what specific sub-category they were in.
 
DSM
@jonrsharpe: yeah, he probably just didn't read the "scope" part of "This question does not appear to be about programming within the scope defined in the help center." That's not how I would have worded it, myself.
 
@PM2Ring I like poke's comment there :P
 
Hey guys, mind if I get help from some of you with something?
 
3:02 PM
@MoAli, fine with me
 
@MoAli Ask right away. Don't ask to ask :)
 
@DSM I agree that one can be a bit misleading &/or confusing.
 
So I'm trying to run the specific string using python and return a list of drives within a server.
grep -E \"TOSHIBA|SEAGATE|ATA|HGST\" /proc/scsi/scsi

That's what I'm trying to run. I'm using subprocess.call however it states that a "SyntaxError: keyword can't be an expression"
https://gist.github.com/AkhterAli/66722885436a35adb402

This is what I have so far.
Don't mind the grains dictionary, I'm trying to get this to work in Python IDLE, however it retruns the syntax error I've just mentioned
 
@PM2Ring That was one __import__, not one import :)
 
@PM2Ring I wonder if Saswat is OK, they haven't posted a rant on Meta in like 2 hours.
 
3:04 PM
And I'm trying to understand why that's occurring.
 
Peculiar. I don't get a Syntax Error when I run that code.
(assuming I replace the NEED SOMETHING HERE part)
 
@BhargavRao Friends don't let friends use XP. :)
I understand that some people don't have a choice. But using XP online these days is just asking for trouble.
 
@ke
@kevin: >>> execString = ('grep', '-E', '\"TOSHIBA|SEAGATE|ATA|HGST\"', '/proc/scsi/scsi')
>>> process = subprocess.call((execString), subprocess.stdout=STDOUT)
File "<stdin>", line 1
SyntaxError: keyword can't be an expression
>>>
 
@JRichardSnape My highest rated question is still about about security, with no Python involved. Go figure.
 
Pfft, I'm still using Windows 98 and the hackers haven't stolen my car yet.
 
3:06 PM
process = subprocess.call((execString), stdout=STDOUT)
Don't use subprocess.stdout there
See here
 
Oh?
 
DSM
@MoAli: note that the code in your gist doesn't contain subprocess.stdout, but the code in your example does. When you do that it makes it hard for other people to debug. :-)
 
Sorry, I didn't import subprocess.stdin.
My bad.
 
Is there ever a time a function's parameter name could have dot syntax in it?
 
@PatrickMaupin Fair call. OTOH, it's possible to do that with an import statement, too, although that requires hard-wiring the module's name into itself. But I thought if I'm going to do silly things I might as well go the whole 9 yards. :)
 
3:09 PM
@SuperBiasedMan Like, the keyword name?
 
Oh, I see it now. subprocess.stdout can't be on the left hand side of the equals sign.
 
@BhargavRao It looks like I have to use shell=True, although I want to avoid that.

>>> process = subprocess.call((execString))
>>> process
1
>>> process = subprocess.call((execString), shell=True)
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
 
DSM
@MoAli: no, I mean that your code doesn't contain the string subprocess.stdout. This doesn't have anything to do with subprocess.
 
@MorganThrapp Yeah. It doesn't make sense to do that to me but I'm wondering if there's any unusual edge cases where it might be possible/useful.
 
DSM
3:11 PM
>>> f(1, a.b=2)
  File "<ipython-input-8-692f26a0f05e>", line 1
    f(1, a.b=2)
        ^
SyntaxError: keyword can't be an expression
 
@Kevin you can obviously assign to attributes, so in that sense they can be on the left-hand side of =, they just can't be parameters!
 
@DSM That answers that!
 
Just assume that I said what I meant instead of what I actually wrote :-P
 
DSM
@jonrsharpe: now, now, if a sentence becomes correct if you add "in the context we're talking about", I think it's fair to add it. :-)
 
I didn't realise that a.b was an expression.
 
3:13 PM
@DSM if you can't be pedantic in a programming website's chat room, where can you? ;o)
5
 
Identifiers can have only nums, letters and _.
 
Ok, so, the problem is solved now, right?
 
@SuperBiasedMan a.b is (sort of) syntactic sugar for getattr(a, b)
 
I enjoy being pedantic in every SE chat room.
 
DSM
No, you don't. You're not in every SE chat room. #wellactually
 
3:14 PM
Well played, DSM
 
I prefer being pedantic in only specific chatrooms.
 
You know about abc.xyz, right? But did you see abc.wtf yet? :D
 
It worries me when we point out a problem and the help-seeker doesn't reply with "that was it, thanks" or "ok, but now I'm getting...". Silence implies that a miscommunication occurred and they don't know we've already advised them.
 
That is next-level trolling from MSFT
 
@Kevin Sorry, I'm still a bit confused. I don't know what you mean by the attributes being assigned on the left of the = sign.
 
3:15 PM
Any simple Pythonic way to map specific mysql functions (like now()) to their sqlite3 counterparts (Datetime('now'))
 
@jonrsharpe Don’t think MS is behind that though.
 
@Kevin Reading through https://docs.python.org/3/library/subprocess.html#subprocess.call

I should be able to use stdout=STDOUT, it's just not advised to use PIPE attribute.
 
You're probably right, but we can hope
 
@MoAli Summary: process = subprocess.call((execString), subprocess.stdout=STDOUT) is illegal syntax because subprocess.stdout=STDOUT is illegal syntax because a parameter name can't have a period. You probably want process = subprocess.call((execString), stdout=something_goes_here)
 
import subprocess

def get_drives():
    return {
        'drive_list': subprocess.check_output([
            'grep',
            '-E',
            '"TOSHIBA|SEAGATE|ATA|HGST"',
            '/proc/scsi/scsi'
        ]).splitlines()
    }

print get_drives()
That works fine for me
 
3:17 PM
Okay, I'll try that.
 
@JonC Python2? o_O
 
Bah... only cos I opened up the copy of ST where it's the default
 
@BhargavRao It's a one-item dict, not a dict comp.
 
@PM2Ring Didn't get the context :/
I said Py2 lookin at the print :P
 
3:20 PM
I should drop into The Lounge one day and say hi to Jerry Coffin. I know him from the old FidoNet C_ECHO, but we haven't communicated since then.
 
Cabbage Potato,
Any simple Pythonic way to map specific mysql functions (like now()) to their sqlite3 counterparts (Datetime('now'))
 
@BhargavRao Rightio. I thought you were complaining that you can't do a dict comp in versions before 2.7
 
"this is an expert level question which demand an appropriate expert-level answer" programmers.stackexchange.com/questions/293416/…
 
@cshubhamrao what exactly are you trying to do?
 
@cshubhamrao You probably need to provide a bit more context for your question. And hopefully someone who works with that stuff will be interested in answering. :)
 
3:25 PM
You should consider asking people specifically familiar with Python. I would check with the Python chat room on Stack Overflow to help you with the discussion that will naturally evolve from such a question. — MichaelT 44 mins ago
Seek cover!
 
DSM
I think "expert level question" is going to be my new "web-scale".
 
I've got banned on russian stackoverflow. Why should this affect the rest of sites? And if I'll get banned because of discussing Putin politics? Or I'll get banned by some child on gaming SE? — Smit Johnth 6 mins ago
I remember that guy
 
DSM
@Kevin: uh oh.
 
@Kevin @JonClements Thanks. That works, I just need to figure out the exit status now.
 
Well, it doesn't look like he will be able to chat, since he hasn't hit 20 rep yet.
 
3:27 PM
@JonClements simple substitute for MySQL, for only the basic CRUD commands. Other things work, but the vendor specific functions dont, esp. date/time ones
 
DSM
Wow, I didn't know Programmers evolved from not-programming-related.
 
@vaultah such a charmer, that one
 
Agree. Chats should be isolated. Chimpanses should not be able to ban people on other sites. — Smit Johnth 5 mins ago
 
@Kevin Thanks ever so much, MichaelT. Luckily, the OP's got 1 point, so he won't be assaulting us with his "expert-level Pythoh" questions in the immediate future.
@vaultah He's not easy to forget.
 
@vaultah Well that escalated quickly.
 
3:32 PM
To be fair, I absolutely agree that chimpanzees shouldn't be moderating chat sites.
 
I prefer (ninja) puppies over chimpanzees. They are doing a good job. :D
 
Eh, I wouldn't issue a blanket ban. It depends on the chimp's qualifications.
 
Wow. Got an upvote after 6 days \o/
 
cabbage
 
cbg
 
3:38 PM
cbg @davidism
 
cbg
 
3:55 PM
That is the most confusing question I've ever read.
 
I think they're trying to ask if the Maya API's have tools to handle licencing (like limiting how long someone can use the plugin).
 
Maybe?
 
DSM
SBM's reading is plausible.
 
FWIW, Timmmm fixed his code with the bare except that masked a NameError, so if someone here down-voted him you might want to reverse your vote...
 
It's hard when the question begins with "Recently i have got into api"
 
3:58 PM
Is your problem different from I need help understanding python dictionaries? That's your previous question btw. Also: stackoverflow.com/q/31883429/2301450 (10k+) — vaultah 7 mins ago
This question is part of the final exam for the EdX course 6.00.1x Introduction to Computer Science and Programming Using Python ... you really shouldn't ask it here - it violates the honor code for the course. — jpw 1 min ago
People ask about that problem a lot lately
 
@vaultah That would explain why that question keeps getting asked.
 
DSM
And why online courses can only be taken so seriously. :-/
 
I reckon basically online courses are only valuable to the person taking them. As a measure of capability for a third party they are broken - as this illustrates.
 
DSM
4:13 PM
I wonder if I could provide a Python certification service to local businesses. "I will talk to your candidates for one hour. At the end, I will tell you how skilled in Python they are."
 
@DSM But then you'd have to stay talking for a full hour.
 
... "up to one hour" might be wiser!
 
He didn't say he would be talking about python for the whole hour. I'm sure for the right rate you could find something to fill the hour
 
Just ask them if print is a function or a keyword. ;)
That should fill the whole hour.
 
DSM
I guess I can make the time relative. Really, it's my evaluation they're paying for, and if I can get that right in fifteen minutes, so much the better for everyone.
 
4:20 PM
stackoverflow.com/q/31945760/400617 can't be reproduced, see comments
 
DSM
@davidism.. actually, I can reproduce..
 
"Welcome, applicant. To test your Python skills, place your hand in this box. You must not withdraw your hand under any circumstances"
 
@Kevin "I must not use semi-colons. Semi-colons are the mind-killer. Semi-colons are the little-death that brings total obliteration."
 
Anyone that makes a Dune reference during the trial immediately passes.
 
4:31 PM
The whitespace must flow!
 
Indent without rhythm and... Well, actually, we would really prefer you to indent in a consistent manner, so that juxtaposition doesn't really work.
 
DSM
@davidism: ah! When I vary the zoom, I see different portions of the 1/2 visible, and that applies to both. Maybe the default zoom is simply different on the two pages.
 
Huh, didn't think of that. Still not sure if it should stay open though.
 
DSM
I don't think it has anything to do with flask, anyway.
> @DSM Yes, you are right, after I zoomed in I was able to get the picture nicely. It seemed that I had a 90% zoom for the files coming out of localhost.
I think something's wrong with the code for his page (this shouldn't be happening) but I'm confident it's nothing on the flask side. VTC?
.. actually, I'm not sure what the best way to close it is.
It's not a pseudoproblem, it's real, it's just the OP's theory was wrong. And I don't know how to fix the real problem.
 
4:48 PM
Hi all
I am ought to learn python hehehe, so far so good, I found python quite OK for some certain tasks
however I see the issue with dependencies, sometimes it's hard to download the right ones to any given system
 
Have you tried setting up a setup.py and/or requirements.txt, then using a virtualenv to separate dependencies for a given project?
"My behaviour is ok." - I guess that solves that, then.
 
DSM
To be fair, he makes a strong case.
 
@jonrsharpe let me try that
 
Then you can python setup.py install or pip install -r requirements.txt and get all dependencies in one go.
 
If I could make a project (like a simple git repo), which could be run on stock centos7 (e.g. it would download dependencies) that would be really a bit of improvement
 
4:54 PM
 
DSM
I was about to raise Windows-related complications, but if you're working in the *nix world, yeah, the virtualenv-pip combination works nicely.
 
Ugh, finally, where was it?
 
Behind the dryer.
 
Ah, happens so often...
 
DSM
“We discovered the tile using using a computer to exhaustively search through a large but finite set of possibilities": well, there goes my idea for finding more.
 
4:55 PM
I'm surprised that the angles are all an integer number of degrees.
... Unless there are actually several pentagons of this class and they simply chose the one with the nicest measurements to show the world.
 
Or maybe that was the search space they restricted themselves to, although I can't imagine that's particularly large in that case
 
that, too, is a likely explanation.
 
DSM
Maybe don't think of it as an integer number of degrees, think of it as a relatively low-rank ratio of 2*pi, and 360 is highly composite? (Haven't thought it through, but that was my first guess.)
 
The search space is probably larger than just varying the angles of the vertices, since you can also vary the side lengths and the positioning of each polygon on the plane
 
@Kevin Cute. FWIW, one of the world experts in pentagon tilings is amateur geometer Marjorie Rice
 
4:59 PM
The more I watch trailers, the less sure I am the movie will be good...
 
DSM
E.g. if we measured things in units of 100 instead of 360, then 135 degrees would be 37.5.
 
Could be.
Once we find the sixteenth tessellation, I expect to find the phrase "achievement unlocked" in subsequent scans of the cosmic background radiation.
 
@jonrsharpe I want to have a code disco.
 
Hey up all
 
5:05 PM
Google Translate claims you're saying "I want to remove ALL I HAVE IN MY HARD WITH A CODE DISCO", which sounds like fun! — jonrsharpe 6 mins ago
 
DSM
Closer would be "Everything that I have on my hard drive with a code". #sesamestreetspanish
 
rm -rf /
 
"Remove all I have in my hard"? In... In public? :-o
 
@Kevin No, at a code disco.
 
Taking advantage of the poor lighting, then.
 
5:06 PM
his code would effectively wipe his C: drive, but I have a feeling the problem is that he wrote walk rather than os.walk
 
Also ficher is a NameError
 
Not much point in actually answering the question, because if your fix works his computer will be too deleted to give you an accept.
 
if WindowsError: None
 
DSM
He claims there's no error, it simply doesn't work. I find that hard to believe.
I think I remember reading someone say that it wasn't a good idea to translate someone else's questions because (1) you might get it wrong, and (2) if they can't translate it themselves the answers might not help them much anyway.
 
@davidism is it possible to use sqlalchemy to compare two separate databases and get a diff? (I couldn't find any reference about this anywhere..)
 
5:12 PM
We have people that don't read answers even if they do speak English, so...
Copy-pasting code blocks without understanding what they do is the universal language.
 
(@davidism ofc, this could by a XY problem, so here is the real question: after several separated sessions, I want to get the whole diff from the original to the current state of the db)
(not all steps, only the delta/diff)
 
I don't think you can. At least, this isn't a SQLAlchemy feature. You'd have to dump the data and diff the dumps.
Or are you talking about the database schema? Because you can use Alembic to compare changes in the schema.
 
I'm not familiar with schemas at this point, but dumping was the plan B
 
There may be some db-specific function to do it, but I'm not aware of it.
 
@PeterVaro I'd say impossibru
 
5:18 PM
well, my plan B was this: I create changes/tracking file where after each commit, I update the diff myself
 
it is impossible with just a random db, but
 
but if there would be a tool to do it for me, it would be pretty nice
 
there are history logging extensions for sqlalchemy, say
so they'd log all the changes to any models
 
@AnttiHaapala actually my first question was plan A: pull down a db, save as original, duplicate it, and then make the changes in that one, and then compare it to the original
 
@PeterVaro perhaps you are looking for SQLAlchemy-Continuum to track changes to the database.
 
5:20 PM
anw, I have a python question too :D
anyone aware of concurrent datastructures for python
 
@davidism sadly it is not a flask app
:P
 
made a typo, the library is sqlalchemy-continuum
 
@AnttiHaapala concurrent and python at the same question.. well :P
 
well well...
what I want is something like the java.util.concurrent
I'd need some kinds of things like list with parallel iteration
 
You mean like how Java has a thread-safe version of every data structure?
 
5:21 PM
this question makes me wonder if there's any non-programming context where equality isn't necessarily symmetric.
 
@davidism yes
with some characteristics
 
(no jokes about social equality please)
 
It would make sense for such a package to exist, but I've never heard of it.
 
this is a continuation for the "how to embed flask into another app", which I did.
 
Speaking of pentagonal tilings, here's a Penrose tiling on the Riemann sphere:
user image
4
 
5:23 PM
Just lookit dat sphere.
 
just 2 stars, I can see so many there :P
 
@davidism quite interesting, thanks for the tip, will take a deeper look at it later!
 
@PM2Ring if @Kevin had made it, it would be animated. Time to step up your game.
 
I'd want something like ConcurrentLinkedDeque
 
5:25 PM
@davidism I did that sphere in POV-Ray, so it's easy enough to animate.
 
@PM2Ring I see the Pixar Ball has ascended to a higher plane of existence. Good for him.
 
Yikes! What happened to that last hour? Rhubarb!
 
Why does it get that black ring at the bottom?
 
Hey guys, another quick question. if I open a file using "with open('insert file here') as variable"

Would I have to go and close it afterwards?
 
There's also a white splotch within the black ring. I assume that's because this kind of depiction of Remannian geometry tries to represent an infinite amount of space using a finite amount of pixels, and the south pole represents an area "beyond" infinity. (I can only guessed based on what I read on Wikipedia though ;-) )
 
5:29 PM
No, it gets closed when the with block ends, you don't need to explicitly .close
 
@jonrsharpe Thank you.
 
@davidism Because the Riemann sphere is a mapping of the whole complex plane. The Penrose tiling doesn't repeat, so it'd take forever to totally fill the sphere. I could have continued it to make the black region smaller than one pixel, but I decided to make it explicit that the tiling is finite.
:really gone:
 
@MoAli It's called a context manager, if you want to read more about how they work.
 
haha I went to #python @ freenode asking about concurrent deque :D
 
ztane?
 
5:44 PM
yes
 
@MorganThrapp Have any links?
 
@MorganThrapp Thanks much
 
@MoAli Do go through this also
 
You can also take a look at the docs. It has a pretty good explanation.
 
5:48 PM
I skimmed through those docs already.
Guess I should pay more attention.
 
mmm now I remember why I hate IRC :D
there is no rep in IRC :D
 
You read it through, try to pick up what you can, and then you reread it later as needed, and you pick up more each time. :D
I only trust NedBat on IRC. :D
 
@AnttiHaapala Yeah, plus if you're not nedbat or papna, you will have everyone jump down your throat.
 
haha it always goes like this, I go ask something then I need to explain the justification of doing so
 
@MorganThrapp Well I didn't have that happen, but I didn't "lol" there either. :D
 
5:58 PM
nedbat is teaching me time complexity
 
DSM
Everyone can rest easy-- after far too long, my office stores of emergency food have been replenished.
 
He's a smart guy.
Just teach us as you learn! :D
 
Is the IRC channel really that bad? I'm learning as I'm doing obviously, so I'm really thankful for you guys helping me out.
 
@MoAli It's... Interesting sometimes.
 
@MoAli it depends on what level you are
 
6:03 PM
< Novice maybe? I'm just making modules and grains for salt using python.
So not actually "programming" more like "scripting"
 
with me, I've been programming Python for 15 years, but I go sometimes ask a question there and those guys who have programmed python for 15 months think I've been doing it for 15 minutes
 
=\
Doesn't sound friendly.
 
I did it you guys, I finally did it
 
it mostly isn't about friendliness, though sometimes it is
 
I've found them plenty friendly, just don't assume that they know all about you going in.
 
6:06 PM
but as I said, there is no rep in #python
 
SO also demands justifications for what one is trying to do, if they catch any whiff of a potential XY problem.
 
Yep, unless you have sufficient rep to forestall such questioning.
 
or at least people will read the original question
 
Although competing for points does encourage a kind of race-to-the-bottom behavior that benefits truth seekers looking for a prompt answer
 
not just the latest comment
 
DSM
6:08 PM
Sometimes I wonder if I should open a question-only account, honestly do my best to ask questions that come up in my dev work, and see how well they go over.
 
Can you be bronze/silver in a tag? Or just gold? And is there a page where I can see the requirements?
 
Yes. No. See "Tag badges" on this page.
 
Danke!
 
Here's a goal you can set for yourself: stackoverflow.com/help/badges?tab=Tags&filter=unearned
 
6:14 PM
I want to be the 4th person to get the gold badge. Now I juve have to figure out what that is.
 
lol
 
Wow, every single badge has been awarded at least once.
 
Yeah... I think they don't show ones that haven't there.
 
Ahhhh, that makes sense.
 
No gold users of yet.
 
6:17 PM
s/gold users/users/
 
There's potentially a gold for every tag, but I hope no one will ever get a gold in Python 2.6.
 
There haven't been any badges awarded for and I have been meaning to learn it.
Hmmmm.
 
Nim as in the heap removing game? Most of those get moved to mathematics, I would think
 
At the rate those questions are being asked, it's probably not a good idea to focus on it...
 
Nah, nim-lang
It's kinda like a compiled python mixed with pascal.
 
6:22 PM
there is this ... and I wonder why this is not in itertools :(
 
6:32 PM
I'm not sure it does what you want.
Well, it might.
But I guess you can use this:
>>> d = collections.deque(maxlen=0)
>>> d
deque([], maxlen=0)
>>> d.extend(xrange(1000000))
>>> d
deque([], maxlen=0)
And there you've used it.
 
@AnttiHaapala Fizzy posted this a while ago: more-itertools
 
nicee
 
yeah, it's not C, but it includes all the nice recipes from the docs
 
@davidism my point is that there is a recipe for "consume iterator" using deque, and then the deque has this single function for exactly that recipe to be fast... :D
(the function in deque is absolutely useless otherwise)
 
here's the source:
def consume(iterator, n=None):
    # Use functions that consume iterators at C speed.
    if n is None:
        # feed the entire iterator into a zero-length deque
        deque(iterator, maxlen=0)
    else:
        # advance to the empty slice starting at position n
        next(islice(iterator, n, n), None)
less the docstring
 
6:40 PM
@AaronHall and the deque(iterator, maxlen=0) has a special case in C
 
@AnttiHaapala ah, I see now, didn't catch that before
 
but it is not callable as itertools.consume_to_exhaustion
 
Yes, I saw that, that only uses it when maxlen=0. :) Yes, there's no stdlib func for it... oh well.
Suits the one way to do it theory, I suppose.
 
deque_init calls deque_extend which has a special case for maxlen=0 which calls consume
 
"lists are slower than dicts when I use this code"...."well, actually, no, I used your code and here's my timing"......"Yeah, that's what I did and sometimes the lists don't actually finish"
 
6:43 PM
and about 1 % of cases you actually will have a "dequelooking object" that you do not want to store any memory
 
Maybe one of you guys has a better idea about knocking sense into him.
 
@jonrsharpe sorry, invalidated your close vote on this question because I thought it was a dupe
 
I cannot understand how the OP's problem could be possible
dict ought to always have greater C
 
Maybe the bottleneck was the query, and he tried the list comp first, and on the second go the query result was somewhat cached?
 
6:53 PM
I dunno, but there's no there there in that question. Can it be salvaged or should it be closed?
 
@PatrickMaupin op can salvage it by editing in the correct code
the comments say that there is some extra checking; most probably something for which the dictionary is faster; maybe op's even incorrectly using some in/__contains__ operations
 
Yeah, he's got problems. He should have enumerated for the index for one.
 
That's what I'm thinking, too, but he's not handling subtlety very well, so those of you who have the rep should probably vote to close to get his attention.
And never mind the micro-optimizations -- see his last comment under my answer, where dicts finished in 3 minutes, and he killed lists after an hour...
 
I have voted to close
 
I am pretty sure "some checks" includes doing something with coll
 
6:58 PM
like a test for membership?
 
yeah
--- and would also fail with dictionaries :D
but it would fail fast :D
haaa
just realized this:
someone asked in #python if I could make a ConcurrentLinkedDeque implementation for python and post it to stdlib...
 
wut?
 
it will be a refcount nightmare...
 
>>> def l(n):
...     l = []
...     for i in xrange(n):
...         if i not in l:
...             l.append(i)
>>> def d(n):
...     d = {}
...     for i in xrange(n):
...         if i not in d:
...             d[i] = None
>>> timeit.timeit(functools.partial(l, 10))
2.4079999923706055
>>> timeit.timeit(functools.partial(d, 10))
1.6236610412597656
>>> timeit.timeit(functools.partial(l, 100))
69.25849986076355
>>> timeit.timeit(functools.partial(d, 100))
11.306548118591309
 
something like that
 
7:10 PM
I suppose Occam's Razor says you're right. It seems difficult for me to believe that he could go to all the effort to do the question and miss that, but Occam's Razor also explains that -- if he had noticed it, the question wouldn't have been forthcoming.
 
Never attribute to malice...
 
7:28 PM
>>> blackhole = collections.deque(maxlen=0).extend
>>> blackhole(xrange(1000000000))
 
When packages get too "themed" with their names they become increasingly irritating to google. "electron atom shell"... oh now it's all chemistry pages
 

« first day (1760 days earlier)      last day (3191 days later) »