% string formatting - what special method is used for %d?

2016-12-09 Thread Veek M
When we do: print '%s %d' % ('hello', 10) what special method is being invoked internally within the string- format-specifier? format() invokes format__ print invokes __str__ I'm basically trying to make sense of: raise TypeError('urkle urkle %s' % list(dictionary)) <=> raise TypeError('urkle

Re: CLP stats: last 500 posts

2016-12-09 Thread Terry Reedy
On 12/9/2016 8:39 PM, Steve D'Aprano wrote: On Sat, 10 Dec 2016 08:07 am, DFS wrote: As of 04:04PM December 09, 2016 Posts 85 Posters [...] Interesting stats, but couldn't you have post-processed the results to avoid including the defamatory spam posts? Your post is likely to be removed

Re: Is there a replement for bsddb in python3?

2016-12-09 Thread Ben Finney
clvanwall writes: > I found that bsddb module was removed from Python3.  Is there a > replacement for it? The ‘dbm’ library is what you need now, I believe https://docs.python.org/3/library/dbm.html>. dbm is a generic interface to variants of the DBM database […] There is a third party

Re: Is there a replement for bsddb in python3?

2016-12-09 Thread Paul Rubin
clvanwall writes: > I found that bsddb module was removed from Python3. Is there a > replacement for it? Try "dbm" which has a few options for the underlying engine. Alternatively, try sqlite3. -- https://mail.python.org/mailman/listinfo/python-list

Is there a replement for bsddb in python3?

2016-12-09 Thread clvanwall
I have been looking for a simple indexed file database and Berkley-db was what I waa used to.  I found that bsddb module was removed from Python3.  Is there a replacement for it? John  Van Walleghen Sent from my Galaxy Tab® A -- https://mail.python.org/mailman/listinfo/python-list

Re: Running python from pty without prompt

2016-12-09 Thread Michael Torrie
On 12/09/2016 06:43 PM, Steve D'Aprano wrote: > On Sat, 10 Dec 2016 10:11 am, space.ship.travel...@gmail.com wrote: > >> Hello. >> >> I'm working on a script runner for Atom. >> >> https://github.com/ioquatix/script-runner >> >> We are trying to understand how to make python work well. I'll use a

Re: Running python from pty without prompt

2016-12-09 Thread Steve D'Aprano
On Sat, 10 Dec 2016 10:11 am, space.ship.travel...@gmail.com wrote: > Hello. > > I'm working on a script runner for Atom. > > https://github.com/ioquatix/script-runner > > We are trying to understand how to make python work well. I'll use a > comparison to the ruby executable because it's conve

Re: CLP stats: last 500 posts

2016-12-09 Thread Steve D'Aprano
On Sat, 10 Dec 2016 08:07 am, DFS wrote: > > As of 04:04PM December 09, 2016 > > Posts 85 Posters [...] Interesting stats, but couldn't you have post-processed the results to avoid including the defamatory spam posts? Your post is likely to be removed from the official web archive as it cont

Re: Running python from pty without prompt

2016-12-09 Thread Samuel Williams
Just in case it's not clear, this is running on a (virtual) PTY. -- https://mail.python.org/mailman/listinfo/python-list

Re: Running python from pty without prompt

2016-12-09 Thread Michael Torrie
On 12/09/2016 04:11 PM, space.ship.travel...@gmail.com wrote: > When you invoke `ruby` from a pty, you get no output (as opposed to > `irb`, interactive ruby [shell]). You can write a script to stdin, > and send Ctrl-D (EOT / 0x04). Then, ruby will execute the script. > stdin is not closed so progr

Re: Running python from pty without prompt

2016-12-09 Thread Michael Torrie
On 12/09/2016 04:11 PM, space.ship.travel...@gmail.com wrote: > Hello. > > I'm working on a script runner for Atom. > > https://github.com/ioquatix/script-runner > > We are trying to understand how to make python work well. I'll use a > comparison to the ruby executable because it's convenient t

Running python from pty without prompt

2016-12-09 Thread space . ship . traveller
Hello. I'm working on a script runner for Atom. https://github.com/ioquatix/script-runner We are trying to understand how to make python work well. I'll use a comparison to the ruby executable because it's convenient to explain the problem. When you invoke `ruby` from a pty, you get no output

Re: CLP stats: last 500 posts

2016-12-09 Thread Chris Angelico
On Sat, Dec 10, 2016 at 8:34 AM, Jon Ribbens wrote: > > Was there ever an "International Obfuscated Python Code Contest"? ;-) I don't know, but if so, here's my entry: print(*([0,"Fizz","Buzz","Fizzbuzz"][[3,0,0,1,0,2,1,0,0,1,2,0,1,0,0][i%15]]or i for i in range(1,51))) ChrisA -- https://mail.

Re: CLP stats: last 500 posts

2016-12-09 Thread Jon Ribbens
On 2016-12-09, DFS wrote: > import sys as y,nntplib as t,datetime as d > s='' > g=y.argv[1] > n=t.NNTP(s,119,'','') > r,a,b,e,gn=n.group(g) > def printStat(st,hd,rg): > r,d=n.xhdr(st,'%s-%s'%rg) > p=[] > for i in range(len(d)): > v=d[i][1] > if st=='Su

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-09 Thread Chris Angelico
On Sat, Dec 10, 2016 at 5:40 AM, Marko Rauhamaa wrote: >> How do you represent the current and previous directory in a list >> without reserving identifiers for them? > > My idea covered absolute pathnames only. Well, you're going to need to cope with relative pathnames somehow. I suppose you cou

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-09 Thread Marko Rauhamaa
Steve D'Aprano : > On Fri, 9 Dec 2016 09:34 pm, Marko Rauhamaa wrote: >> Steve D'Aprano : >>> No that's incorrect. It isn't that . and .. are forbidden, but they >>> are reserved: every single directory in Unix file systems have a . >>> and .. directory entry. So they are legitimate directory name

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-09 Thread Steve D'Aprano
On Fri, 9 Dec 2016 09:34 pm, Marko Rauhamaa wrote: > Steve D'Aprano : > >> On Fri, 9 Dec 2016 04:52 pm, Marko Rauhamaa wrote: >>> In Linux, "." and ".." are taboo. >> >> No that's incorrect. It isn't that . and .. are forbidden, but they are >> reserved: every single directory in Unix file system

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-09 Thread Marko Rauhamaa
eryk sun : > Windows NTFS doesn't normalize names to a canonical form. It also > allows lone surrogate codes, which is invalid UTF-16. Somewhat related, surrogate codes are invalid Unicode and shouldn't be allowed in Unicode strings. However, Python does allow them. Marko -- https://mail.pytho

Best attack order for groups of numbers trying to destroy each other, given a victory chance for number to number attack.

2016-12-09 Thread skybuck2000
Hello, (This problem is probably too computationally intensive to solve with Python, though Python + Cuda could be interesting, and also Python has some interesting expressive powers, so it could be interesting to see how Python programmers might be able to express this problem with Python code

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-09 Thread eryk sun
On Fri, Dec 9, 2016 at 7:41 AM, Steve D'Aprano wrote: > Frankly, I think that Apple HFS+ is the only modern file system that gets > Unicode right. Not only does it restrict file systems to valid UTF-8 > sequences, but it forces them to a canonical form to avoid the é é gotcha, > and treats file n

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-09 Thread Chris Angelico
On Fri, Dec 9, 2016 at 6:41 PM, Steve D'Aprano wrote: > On Fri, 9 Dec 2016 01:52 pm, Chris Angelico wrote: > >> On Fri, Dec 9, 2016 at 12:34 PM, BartC wrote: >>> With a case-sensitive file system, how do you search only for 'harry', >>> not knowing what combinations of upper and lower case have b

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-09 Thread Marko Rauhamaa
Steve D'Aprano : > On Fri, 9 Dec 2016 04:52 pm, Marko Rauhamaa wrote: >> In Linux, "." and ".." are taboo. > > No that's incorrect. It isn't that . and .. are forbidden, but they are > reserved: every single directory in Unix file systems have a . and .. > directory entry. So they are legitimate

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-09 Thread Steve D'Aprano
On Fri, 9 Dec 2016 04:52 pm, Marko Rauhamaa wrote: > Random832 : > >> On Thu, Dec 8, 2016, at 20:38, Dennis Lee Bieber wrote: >>> In the original 8.3 scheme -- no files "contained" a dot >> >> Yes, but they do now, and the compatibility quirks persist. > > When porting a Python program to Window

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-09 Thread Steve D'Aprano
On Fri, 9 Dec 2016 01:52 pm, Chris Angelico wrote: > On Fri, Dec 9, 2016 at 12:34 PM, BartC wrote: >> With a case-sensitive file system, how do you search only for 'harry', >> not knowing what combinations of upper and lower case have been used? >> (It's a good thing Google search isn't case sens