« first day (1943 days earlier)      last day (3230 days later) » 
00:00 - 17:0017:00 - 00:00

00:15
Okay. I understand the output difference it would give but * -zero or more and ? -zero or more . How does *? mean as few times as possible. @MikeEdenfield@QuestionC
 
5 hours later…
05:44
CBG all.
 
3 hours later…
08:38
Cabbage!
Morning cabbage
Excellent start to the day - python just segfaulted
08:57
wat
Code that I've been running for months, never said boo to a goose, immediately segfaulted when I ran it
happened to me a few time lately
Django's server was segfaulting
09:13
Hey folks, a Python doubt:

This commit of mine: https://github.com/Dawny33/PyHub/commit/490dd9b7843ca0747cbec9c8b00c520d6de07b8b

was shown as "both good and bad" when I did: `git bisect bad`
Can someone explain why?
I'm learning that when python segfaults, find the nearest bit of C code and kick it
Hi Dawny, not really sure that it's a python issue.
Cabbage
cbg("PM")
@Kevin CPython's garbage collection just returns the collected memory to Python's free memory pool for recycling, it doesn't actually return the memory to the OS. There is a mechanism that deallocates memory, but it only does so in special conditions, and it works differently in Python 3.3 and later than on early versions of CPython. See Releasing memory in Python for details. Martijn may be able to supply more info on this topic...
@Dawny33 And where does it show that it is shown as good and bad?
09:18
@IntrepidBrit I was doing `git bisect bad` in the shell on my local system.

Seems like I need to go through the docs of git bisect a bit more to understand that :)
@IntrepidBrit I don't remember ever seeing Python segfault... but I guess it's possible, especially if something dodgy is happening in a 3rd party library.
@Dawny33 You’re likely using git bisect incorrectly. Check this question for example.
In general: Git bisect cannot tell you whether a change was good or bad. You need to tell it that.
I think they're getting confused with GitHub's interface
@poke Yeah, was going through that answer there!

Thanks for the link :)
Or not!
09:21
@IntrepidBrit Nothing to do with GitHub ;)
Aye, I know bisect has nothing to do with GitHub (love me a bit of some cheeky automated bisection)
Just got thrown by the github link, and didn't think that github showed bisect stuff (and why would it?)
… yeah, it doesn’t show bisect stuff :P
10:15
Morning
Word @JRich. When is V-Day?
10:44
@Ffisegydd On the morrow, mate. Trying not to make too much fuss and keep it fairly cool. A few people publishing new stuff in my area between hand in (October to now), so a few bits to read / highlight / argue for relevance...
Yeah just keep it chill.
I'd always not revise the evening before/morning of.
Yeah - I'm of the same mind. Worked for previous exams...
.... no... don't press thaaaaaaa....
:D
During my undergrad my friends would always be so shocked at me the morning of the exams. I'd have a lie in, get breakfast and a coffee from a cafe in town, then stroll into the waiting area and read my latest sci-fi book. I'd be sat there chilling and they'd be sat stressing out trying to cram the last bit of knowledge into their brains.
If it ain't there by then, it ain't there....
Exactly.
And the added benefit of being relaxed far outweighs any last minute cramming.
10:52
I should get away from web development before JavaScript becomes a standard for server-side.
Last minute reading also makes me forget a few more stuff.
11:14
Asynchronous programming is...fun...
And just in case anyone didn't get that, I WAS BEING SARCASTIC.
11:29
..isfun progAsynchronous ramming ...is
The final fullstop was dropped?
@BhargavRao and is was repeated. That's asynchronous ramming for you.
@JRichardSnape that explains a lot about Magister Yoda.
@BhargavRao I know, it's such a tired joke ;)
@bereal explain it does.
11:33
Lol, This is the first time I heard that
Hi everyone. Does anyone know a term for "annotate a data point with a graph". Seems like "annotate" is solely used for text/numbers...
11:53
Hi dear friends i am newbie in python : I need to check in my /home folder there is a hidden file .dbr exist or not in my code
i am using ubuntu
Hi everybody I posted this question a couple of days ago but I haven't received any response yet stackoverflow.com/q/35270979/5313264
might be that mod_wsgi doesn't have pythonpath configured.
@bereal Can you elaborate
you could try adding site-packages to WSGIPythonPath.
not that I ever used mod_wsgi
12:13
@bereal still no improvement.
got it buddies 2Ring
2Ring: you have idea about pygtk?
user559633
It's funny that we live in a world in which people just trust internet-connected things, don't understand how they work, and then feel justified in being outraged when something happens.
12:29
@Anes I have used pygtk quite a lot in the past, but I'm a bit rusty these days. However, please don't target people here with your questions. Just ask your question & if people are able to answer and feel like answering they will.
Hey guys, anyone noticing any problems with pip/setuptools?
For some reason I am suddenly unable to update/install certain packages that were fine yesterday
getting this error Download error on https://pypi.python.org/simple/setuptools_git/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590) -- Some packages may not be found!
ooh - The cert says its verified by DigiSign if you go to that link in a browser - the browser seems to say it's OK
well, I have unattended batch scripts that install packages as part of testing. Any idea if it might be a temporary thing?
Just did pip install matplotlib --upgrade with no problem. Which package is at issue?
specifically it seems to be the package pymssql
but it appears to only be because it requires setuptools_git
12:42
Ooh - I seem to remember that one had some patchy support at some time (dredging depths of memory)
Yes, it does. I need to install it with --egg and --ignore-installed as well
possible that the pip cert ran out for the setuptools site?
hmmm
nope, that is not it.
easy_install setuptools_git also fails
but easy_install setuptools doesn't
strange
makes me a sad panda :(
No local packages or download links found for setuptools-git
error: Could not find suitable distribution for Requirement.parse('setuptools-git')
Brief-Rbrb
Well @inbar it must be to some extent site specific as I just did pip install setuptools_git and it worked OK
Trying to install pymssql fails with a different error about a missing header file, but that sounds like it is a different root cause to the one you're experiencing
@JRichardSnape hmmm. seems that also works for me, but then pymssql fails.
yeah.
frustrating.
i think maybe pymssql had an update. let me check
> fatal error: sqlfront.h: No such file or directory
#include "sqlfront.h"
From pip install pymssql
12:50
Version 2.1.2 - 2016-02-10
yup
they just made a patch
a crappy buggy one :(
Yes - mine trying to install 2.1.2 as well :(
Whenever pip fails on my machine, it is invariably Mcaffee's fault
Mine usually fails due to a bat named vcvarsall on my work machine. Rarely gives up on my linux boxes
13:19
In regards to Python 3 - travel directory tree with limited recursion depth, is there a recommended way to determine the "distance" between two file paths, one being a direct descendant of the other?
"count the number of path separators and take the difference" seems like it would work in the normal case, but I'm wary of non-absolute paths and shortcuts.
Re-cbg all.
This page is awesome naishe.in/#/namaste. I liked the way he designed it.
(dirs if os.path.isdir(os.path.join(top, name)) else nondirs).append(name)
Somehow I feel this isn't the best way to do this in one line.
Obvious reply: "You shouldn't be trying to do that in one line anyway"
Yes, imaginary participant, I know.
@Kevin You can normalize symbolic links using readlink, and then convert them to absolute paths, as mentioned in the docs.
I don't think I've ever seen this before on SO: Could someone convert my python into pseudo code?. I guess he got the code he wanted via a "gimme the codez" question somewhere (or just stole it from a classmate) but his homework assignment wants pseudocode as well as the real code.
13:42
Properly written Python code is indistinguishable from pseudocode.
Agreed, although when using Python as runnable pseudocode I suppose one should avoid Pythonisms like comprehensions & generators.
@The6thSense Unfortunately, there is not much own work there.
I saw this on U&L a little while ago: linux unbuffered compression options. Surprisingly, I couldn't find an unbuffered stream compressor, or a line-buffered one, that would suit the OP's needs.
Well, there's run length encoding. That doesn't need the whole file at once unless the whole file is a single character repeated N times.
hi guys. I have a small python problem. I have defined gmkand k1 as strings and s is the string in which I want the string replacement (which should be case-insensitive). However, the following code raises this error - raise error, v # invalid expression error: nothing to repeat
13:52
I don't think you're going to get much compression out of it if you run it on English text though.
Which I assume is what log files typically contain.
Code - text = re.sub(gmk, k1, s, flags=re.I)
Code - text = re.sub(gmk, k1, s, flags=re.I)
any ideas?
@Chahat, that particular snippet looks fine. To diagnose further, I request an MCVE.
Morning cabbage.
Related:
9
Q: Python regex strange behavior

f0b0sI've discovered something that I can't explain in Python re module. Compilation of (a*)* or (a*|b)* throws an error: raise error, v # invalid expression sre_constants.error: nothing to repeat I've tested this regexp in javascript and it seems to be ok. Is it a bug?

DSM
DSM
Way too early morning cabbage for all.
13:57
Yo. I got a code that unserialize a custom file type to a TXT one. It works well on Linux but generate an error on Windows. Anyone interested to debug this or know wich function don't work the same on Windows ? Here's my script: pastebin.com/VrtQc81X And the Error on Windows: pastebin.com/ngX6Ut5r
Hey @DSM, do you know the answer to:
yesterday, by Kevin
Anyone happen to know how many consecutive primes are known? In other words, what is the largest value of N where "for every number below N, we know for sure whether that number is prime or composite" is true?
@Kevin Indeed. A variant of LZW may work ok, especially if the input character set is reasonably small. I'm almost tempted to write one in awk... (I assume the OP doesn't have the RAM to run Python on his embedded system).
@Kevin I debugged and I found that the error was raised when the text to be replaced was +. Any ideas how t overcome it?
'+'
re-cbg
@Addict I wonder if it has something to do with the fact that Linux and Windows use different characters to signify line endings. If you assume every line in your file has seven characters including a newline, then you'll quickly drift out of alignment on a file whose lines are eight characters including a newline and line feed.
DSM
DSM
14:02
@Kevin: hmm. Not sure that I do!
Dang. And now I've run through my shortlist of numerate regulars.
Maybe I'll ask on Mathematics if I continue to itch for an answer.
DSM
DSM
It's got to be be bounded by the smallest probable prime..
@Kevin I posted some relevant links yesterday, both in here and in a comment on that question...
@ChahatUpreti I'd have to play around with an MCVE, to give any salient advice.
@Kevin i'll try to look at this
Thanks !
14:05
@PM2Ring Whoops I might have missed that and/or forgotten about them.
FWIW, you can see the list of known (and probable) prime Fibonacci numbers on OEIS: A005478. Also see Wikipedia Fibonacci prime, in particular: "Except for the case n = 4, all Fibonacci primes have a prime index, because if a divides b, then F_a also divides F_b, but not every prime is the index of a Fibonacci prime". — PM 2Ring yesterday
@Kevin here -
`import re
s = '+ is a pretty good boy +'
gmk = '+'
k1 = 'dd'
text = re.sub(gmk, k1, s, flags=re.I)
print text`
error - raise error, v # invalid expression error: nothing to repeat
Ok, thanks :-)
Using the deterministic version of the Miller-Rabin test you can determine the primality of all n < 3,317,044,064,679,887,385,961,981, with these witnesses: (2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41)
Are you trying to replace the literal character "+" with "dd"? Because "+" in regex has a special meaning and doesn't just represent that character.
14:09
yes
If so, consider using ordinary replace instead: text = s.replace(gmk, k1)
Alternatively, use a backslash to indicate that the plus in the pattern is a literal plus:
import re
s = '+ is a pretty good boy +'
gmk = r'\+'
k1 = 'dd'
text = re.sub(gmk, k1, s, flags=re.I)
print text
Result: dd is a pretty good boy dd
I recently posted some Python code on SE.Mathematics that implements Miller-Rabin: math.stackexchange.com/a/1638487/207316
@Kevin actually in my case, the gmk is read from another file, so I dont know if I can do that
@PM2Ring Ooh, cool.
@ChahatUpreti If you don't have any control over the file, then the problem is out of your hands. Whoever does control the file needs to supply actual syntactically valid regex patterns, or accept the fact that your program will occasionally raise an error saying "that is not an actual syntactically valid regex pattern"
To insist otherwise is tantamount to saying "I need a calculator that correctly determines the output of "1 2 + - * hello sqrt("
Wiki has a list of some witness sets, also see The best known SPRP bases sets. A great resource for all things prime is the Prime Pages, eg Finding primes & proving primality
14:14
@Kevin Is it possible to make it regex-compatible after reading it?
all I want is that if I see a '+' in the file, I want to replace it
If you only want literal replacement, then just use text = s.replace(gmk, k1) and there's no problem.
Morning everyone
i think that would be good. for other values of gmk (which wont cause problem for regex), I can use re.sub
Thanks!!
... I have an idea. I don't endorse this as being particularly good code, but you can do:
import re
s = '+ is a pretty good boy +'
gmk = r'\+'
k1 = 'dd'
try:
    text = re.sub(gmk, k1, s, flags=re.I)
except:
    text = s.replace(gmk, k1)
print text
This will at least guarantee that your program doesn't crash, and does the "right" thing most of the time.
DSM
DSM
Bare except? tsk tsk
14:18
@DSM I didnt understand
But you'll occasionally get angry emails from your client saying "I set `gmk to '.+' and it erased my entire string instead of just replacing the parts where a plus sign immediately followed a period"
@DSM also, "errors should never pass silently"
@ChahatUpreti It's bad practice to have just except:. It's better to do, for example, except ValueError: or whatever error you're specifically looking for.
@DSM Well, he did say "I don't endorse this as being particularly good code"...
14:20
and to include log... :P
I tried except re.sre_constants.error:, but that doesn't seem to be the proper namespace for the error raised when you try to use "+" as a pattern.
So I gave up.
what about an re.escape?
@Kevin why would that happen (sorry)?
Because ".+" is regex meaning "any character besides newline, repeated any number of times other than zero times"
no I dont think that would happen since I have a list of gmks and .+ is not one of them
14:23
I'm beginning to suspect that the true solution to this problem is "you don't actually need regex, just use regular string replacement 100% of the time"
DSM
DSM
@Kevin: re.error, looks like. (Caught the exception and printed type(exc).
@DSM Yeah, that seems to work.
some of the gmks are to be replaced case-insensitively, thats why
I see.
In that case, Inbar's suggestion may be appropriate:
4 mins ago, by Inbar Rose
what about an re.escape?
DSM
DSM
Hey, speaking of working with text in Python: recommendation question for our web masters! I'm in the market for a solution to the problem of generating html from templates where I need a lot of natural language branching ("In [year], [quantity] [rose/fell] to [value]") cleanly. Is this a solved problem?
14:26
as in text = re.sub(re.escape(gmk), k1, s, flags=re.I)
Yeah.
works!! thanks a lot!
user559633
@DSM where [year], [rose/fell] come from where and have what result?
Ok, so my desired N is somewhere between 3,317,044,064,679,887,385,961,981 and the smallest probable prime (assuming the team that found it wasn't being dumb and testing in the range of numbers of known primality for no reason), which is no larger than 2^133454-1010591.
That's a reasonable bound, in an enormously astronomical sort of sense.
@Kevin What is your context for this?
14:34
This idle curiosity I asked yesterday.
@DSM You mean string formatting?
@Kevin so....... basically if you start counting at lets say 0, you want to know how many primes you can count (increasing the counter each time you get to a prime). but not to simply jump between known primes.
Although now that I think about it, it's not a super well-defined question. What do we count as "known"? Even if we can find the primeness of any number smaller than ~10^24 in sub-millisecond time, do we count all of them as "known" even if nobody has ever actually run their O(log log log log log N) algorithm on them?
@InbarRose Yeah pretty much.
DSM
DSM
@tristan: I'm describing a data table here, which can be accessed via Python functions. [year] would insert a number from (say) a dictionary, and [rose/fell] would have to be specified in some mix of hardcoding (for the words) and programmatically (based on a comparison of two numbers).
user559633
And you want someone writing Python to have it generate the HTML for you?
current_number, prime_count = 0, 0
while current_number < 3317044064679887385961981:
    if is_prime(current_number):
        prime_count += 1
    current_number += 1
print prime_count
14:40
A rephrasing of the question might be "What is the largest value of x where π(N) is known with perfect certainty for all N from 0 to X?"
user559633
Sorry, I'm trying to understand, but I'm not quite seeing the application/workflow. A guess would be picking a templating engine (jinja, mako) and calling some function/macro with a hint, e.g. to_html(val, type='date')
that's basically what you want?
Yeah.
but obviously not as naive as that.
Yeah :-)
14:41
i wonder if there is a formula to find the Nth prime in that series
I think a lot of mathematicians would be very interested in such a formula.
Emphasis on the "in that series"
obviously a formula to calculate the Nth prime is ridiculous.
but the Nth consecutive known prime....
If no million dollar prize exists for inventing a constant time algorithm to find the Nth prime, then it will be necessary to create one.
doesn't need to be constant time for the purposes of what I am wondering
DSM
DSM
@tristan: the application is that I want to automatically generate text to describe data tables, where the input is a datacube and the output is HTML. I guess I'm wondering if there's a templating scheme which already has good support for turning (23,29) into "grows from 23 to 29" or not, or if I'd have to write that side myself.
14:44
you know what
never mind, I am not a mathematician, and I am probably way out of my depth here.
user559633
@DSM Oh, I see. Extrapolation of natural language text and assignment of a suitable markup from some <type>:input(s).
@DSM its called string formatting: grows from {} to {}".format(23, 29)
So you could do......
"The problem with answering this question is small primes are too easy to find. The can be found far faster than they can be read from a hard disk, so no one bothers to keep long lists (say past 10**9). Long lists just waste storage, and if placed on the Internet, they just waste bandwidth. Nevertheless, due to popular demand, I have placed several lists on this site, such as the first 100,008 primes and the first fifty million primes."
DSM
DSM
@tristan: correct. I've done so manually to generate dozens of hundred-page powerpoint presentations in the past, but that was pretty hacky.
14:46
@PM2Ring Nice, that's my question
>>> for x, y in zip(range(10), range(10,20)):
	print "grows from {} to {}".format(x, y)


grows from 0 to 10
grows from 1 to 11
grows from 2 to 12
grows from 3 to 13
grows from 4 to 14
grows from 5 to 15
grows from 6 to 16
grows from 7 to 17
grows from 8 to 18
grows from 9 to 19
And it looks like they came to the same conclusion about the "soft edges" of the problem.
Is a prime known if it was calculated previously but never written down? etc.
DSM
DSM
@InbarRose: true, but I'd have to write all the branches to decide whether "grows from" or "fell to" is appropriate. I'm wondering if someone has addressed this question.
@PM2Ring Glad I read the whole convo - I was just about to suggest deterministic miller rabin. I guess from whatever paper shows that, you might be able to construct a list of witnesses for an arbitrary limit. And if you can, doubtless someone has done it to the limit of computing power so far.
@DSM that can also be a parameter
@DSM "blah blah {}".format("grows from")
user559633
14:48
@DSM I don't know of anything pre-made, but in the past, I did the aforementioned macro + hinting in jinja2.
"At the time I last updated this page, these projects had found (but not stored) all the prime up to 10^18, but not yet to 10^19". Interesting that this is smaller than the range of the Miller Rabin primality test with a having 13 values.
FWIW, I have all the primes < 3,000,000,000 stored on my hard drive, in 10 files, using a technique very similar to this: stackoverflow.com/a/35242279/4014959
@DSM Basically you create the tuples that you want to put into the formatting with some generator, and then simply put them into your string format.
Like I thought, finding any particular prime in a nanosecond isn't sufficient if you're testing 10^(a lot) numbers.
DSM
DSM
@InbarRose: yeah, I know that I can write a function myself to do what I need, and I know how string interpolation works. :-) I'm hoping to avoid it.
14:50
@Kevin I seems like the limit will simply depend on how many loops it's possible to do. I.e. "we can deterministically test if this number is prime or not, but we haven't"
user559633
[also, sorry for the responses only to say, yeah, sorry, i don't know of a made solution]
I wonder what the relationship is between a primes position N in the series of consecutive primes, and it's value.
That's a nice example for mathematical provability vs. computational power that I might steal use.
So now the answer to my question is "982,451,653 or 10^18 or 10^24 depending on the strictness of your definition of 'known'"
Trees falling in the forest, one hand clapping, etc.
14:52
The nth Prime Page has some cute stuff
DSM
DSM
@tristan: no worries. :-)
@PM2Ring very cool.
Well, given that page, 982,451,653 is out - Kevin's desired number, k >= 10**17
> All prime gaps in 0 < x < 4e18 have now been analyzed. The upper bound of exhaustive analysis of gaps has been extended successively, as follows.
@InbarRose π(N) ~ N / log(N) See en.wikipedia.org/wiki/Prime_number_theorem
I like that table. Imagine going up to 3 million in 1878. Must have been quite an undertaking.
15:00
Yep, the lower bound is 10^17 if "known" is defined as "was once calculated at some point in history, even if the result was immediately discarded"
True - he does seem to calculate on the fly, rather than having them all stored. Although he can give pi(n) for (10**17) in 0.1 seconds, so I guess some of it must be via tables.
I wonder why the paper in 1961 stopped counting at such a precise number as 104395289
That's precisely when their funding ran out ;-)
I feel like there could be an interesting game called "arbitrary or precise" that can be played with a lot of seemingly "magic numbers".
I reckon so.
15:04
OEIS says that π(10**26) = 1699246750872437141327603 was calculated Dec 02 2014
Hard mode: "is 0x5f3759df arbitrary or precise?"
So if we know that number we must have conclusively tested all numbers below that one way or another.
(I am now appropriating that result by use of the royal we)
;)
@Kevin Nice. I am going to award a rare technical star.
Knowing pi(n) isn't exactly isomorphic to knowing the primeness of all integers below n. For example, if I know that pi(10) is 4, it doesn't tell me which four digits are prime.
For all I know, there's some weird algorithm that calculates pi(n) without actually iterating up to n.
I mentioned here yesterday that during his prime gaps research Dr Nicely "discovered" the notorious Pentium floating-point division bug. However, Intel had been aware of it for some time but were keeping the information under wraps... en.wikipedia.org/wiki/Pentium_FDIV_bug
No doubt a room owner will veto my decision to award stars based on "ooh that's clever" rather than "ha ha ha"
15:09
@Kevin Well, yeah. And if we could prove the Riemann hypothesis that weird algorithm could be optimized.
@Kevin That is cool. :)
Yes it is.
That is what I like, great usage of mathematics in computing to optimize. And all for the sake (originally) of playing games. Reminds me of mathemagical tricks that magicians use with cards, using highly complex concepts in mathematics to entertain people with card tricks. :)
@Kevin There is, but it is only an approximation.
@InbarRose Like Fitch Cheney's card trick that uses factorial counting.
Rhubarb
15:21
@PM2Ring Nah, that trick uses a secret helper, thats lame :P
I've seen that card trick posed on the Puzzling site. It was a pretty popular question.
Even knowing that the card arranger is in on it, figuring out the communication scheme is quite tricky
DSM
DSM
Oh noes! I overwrote the data from a simulation I did last night because I was testing the code under valgrind and forgot to change the output filename. :-/ Senility is setting in.
kids, always remember to add timestamps to your output. :)
DSM
DSM
Guess who just added TIMESTR=`date +"%Y%m%d%H%M%s"` to a certain bash script?
does he have two thumbs?
DSM
DSM
15:29
Yeah, but they're not opposable.
DSM
DSM
I want to punch that guy in the face.
@DSM Why bash script? This is Python!
Reminds me of the short web comic about the baby fox who is tragically born blind, and knowing it is not suitable for this world, travels from the hills down to the beach where it lets itself be washed away by the surf. Likewise, such is the fate of all obsolete programmers.
datetime.now().strftime('%Y%m%d%H%M%S') FTW. :)
DSM
DSM
15:31
@Kevin: you are hereby forbidden from mentioning such sad stories when you see the DSM square present in the room. ;_;
I'm pretty sure the framing story also has a mountaineer stranded on a cliff face, hallucinating a final conversation with his lover. So it's twice as sad as I initially described.
Ok now I'm done being intentionally depressing.
@Kevin intentionally
Now I will return to my usual antics, which are like a haggard clown making balloon animals that deflate with an audible whine even as he creates them.
Beginning to die as soon as they are born, just like all of us. Ok now I'm done being intentionally depressing.
DSM
DSM
To be fair, today is an appropriate day for considering the mortality of all flesh.
15:37
Ah yeah, it's Lent innit.
@DSM Robots don't need flesh. (or mortality for that matter)
DSM
DSM
definitely lost: 65 bytes in 8 blocks: so close
Pretty sure Python tkinter Canvas root.after() maximum recursion depth exceeded is going to "one more thing" me with "ok, now how do I get the rectangle to stop moving down when I release the key?"
Which will necessitate a complete rewrite from scratch.
16:01
Hmm, I was going to preemptively write an answer to his hypothetical follow-up, but I can't remember how to disable autorepeat. My approach rather falls apart if you can have many more keydown events than keyup events.
I could keep a global set of "keys that are currently down" and ignore events from keys already in the set, but that's dumb.
16:16
Today I am annoyed that KeyRelease-<keycode> is a valid event, but isn't documented in the effbot documentation.
Do I have a new entry for my "Tkinter grievances" text file? It's been a while since I made an addition.
Yep I do. grievance #25 logged.
What dunder method do I need to support x = CustomThing(); y = x[:]?
I want to say... __getslice__.
Oh, it's version dependent.
> Deprecated since version 2.6: [getslice] is removed in Python 3.x. Use getitem() with a slice index.
class CustomThing:
    def __getslice__(self, a, b):
        print a, b
CustomThing()[:]
#result: 0 9223372036854775807
Uh... Huh.
I'm using __getitem__ and it seems to be working.
9223372036854775807 is max val somewhere? (for the system?) en.wikipedia.org/wiki/9223372036854775807
DSM
DSM
Ha! Fixed a memory bug in a third-party library, and now no bytes are leaked! #donefortheday
16:31
@BhargavRao Yeah, seems like it.
tomerfiliba.com/blog/Getslice describes a similar problem.
DSM
DSM
>>> sys.maxsize
9223372036854775807
But what if I want a list that's larger than that? How will I slice it?
DSM
DSM
?
??
[0]*9223372036854775806 also raises a MemoryError
Thank you. Having open IDLE from the console is a nuisance, so I am thinking about adding a new feature to make that not necessary.so that multiprocessing code will work from withing IDLE — Terry Jan Reedy 1 min ago
New feature for IDLE
16:50
that's interesting. It seems that even though the object at each individual index of the list doesn't take any memory (because list multiplication is done by pointer reference), the fact that there is a list index itself costs some memory
I could therefore memoverflow a system without having to create objects that cost memory - just a super large list of nothings
Is there a regex identifier for any type of white space, including newlines and carriage returns?
00:00 - 17:0017:00 - 00:00

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