Re: how to calculate reputation

2013-07-06 Thread DJC
On 03/07/13 02:05, Mark Janssen wrote: Hi all, this seems to be quite stupid question but I am confused.. We set the initial value to 0, +1 for up-vote and -1 for down-vote! nice. I have a list of bool values True, False (True for up vote, False for down-vote).. submitted by users. should I

Re: Fwd: Python for philosophers

2013-05-14 Thread DJC
On 14/05/13 09:34, Citizen Kant wrote: 2013/5/14 Steven D'Aprano steve+comp.lang.pyt...@pearwood.info On Tue, 14 May 2013 01:32:43 +0200, Citizen Kant wrote: An entity named Python must be somehow as a serpent. Don't forget that I'm with the freeing up of my memory, now I'm not trying to

Re: Confusing Algorithm

2013-04-22 Thread DJC
On 22/04/13 13:39, RBotha wrote: I'm facing the following problem: In a city of towerblocks, Spiderman can “cover” all the towers by connecting the first tower with a spider-thread to the top of a later tower and then to a next tower and then to yet another tower until he reaches the end of

Re: Why are timezone aware and naive datetimes not distinct classes?

2013-03-11 Thread djc
On 11/03/13 17:27, Adam Tauno Williams wrote: Because date/time management in Python is *@*@R*(R *@Y terrible! Period, full-stop, awful, crappy, lousy, and aggravating. The design is haphazard and error inducing. +1 -- djc -- http://mail.python.org/mailman/listinfo/python-list

Re: Thought of the day

2013-01-15 Thread DJC
On 15/01/13 16:48, Antoine Pitrou wrote: Steven D'Aprano steve+comp.lang.python at pearwood.info writes: A programmer had a problem, and thought Now he has I know, I'll solve two it with threads! problems. Host: Last week the Royal Festival Hall saw the first performance of a new logfile by

Re: got stuck in equation

2013-01-02 Thread DJC
On 02/01/13 05:20, Ramchandra Apte wrote: On Tuesday, 1 January 2013 22:55:21 UTC+5:30, Usama Khan wrote: am just a begginer bro. . jus learnt if elif while nd for loop. . can u just display me the coding u want. .it could save my time that i have while searchning SN out. . i will give u that

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread DJC
On 04/12/12 17:18, Alexander Blinne wrote: Another neat solution with a little help from http://stackoverflow.com/questions/1701211/python-return-the-index-of-the-first-element-of-a-list-which-makes-a-passed-fun def split_product(p): w = p.split( ) j = (i for i,v in

sort order for strings of digits

2012-10-31 Thread djc
: unorderable types: str() int() The best I can think of is to split the input sequence into two lists, sort each and then join them. -- djc -- http://mail.python.org/mailman/listinfo/python-list

Re: sort order for strings of digits

2012-10-31 Thread DJC
On 31/10/12 23:09, Steven D'Aprano wrote: On Wed, 31 Oct 2012 15:17:14 +, djc wrote: The best I can think of is to split the input sequence into two lists, sort each and then join them. According to your example code, you don't have to split the input because you already have two lists

Re: A desperate lunge for on-topic-ness

2012-10-21 Thread DJC
On 20/10/12 15:18, Grant Edwards wrote: On 2012-10-20, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: Strangely, we've gone from 80-character fixed width displays to who-knows-what (if I drop my font size I can probably get nearly 200 characters across in full-screen mode)...

Re: color coding for numbers

2012-08-21 Thread DJC
On 21/08/12 12:55, Ulrich Eckhardt wrote: Am 21.08.2012 10:38, schrieb namenobodywa...@gmail.com: what is the best way Define best before asking such questions. ;) http://matplotlib.sourceforge.net/api/colors_api.html?highlight=colors#matplotlib.colors matplotlib.colors A module for

Re: How do I display unicode value stored in a string variable using ord()

2012-08-19 Thread DJC
On 19/08/12 15:25, Steven D'Aprano wrote: Not necessarily. Presumably you're scanning each page into a single string. Then only the pages containing a supplementary plane char will be bloated, which is likely to be rare. Especially since I don't expect your OCR application would recognise many

Re: Looking for a good introduction to object oriented programming with Python

2012-08-06 Thread DJC
On 06/08/12 02:27, Steven D'Aprano wrote: On Sun, 05 Aug 2012 19:12:35 -0400, Roy Smith wrote: Good lord. I'd rather read C++ than UML. And I can't read C++. UML is under-rated. I certainly don't have any love of the 47 different flavors of diagram, but the basic idea of having a common

Re: Learning Python 2.4

2011-12-21 Thread DJC
On 21/12/11 02:13, Ashton Fagg wrote: I got the impression the OP was learning programming in general (i.e. from scratch) and not merely learning Python. If this is the case it shouldn't matter if they're merely learning the concepts as you can always get up to speed on the differences later

Re: OT: Meaning of monkey

2010-03-29 Thread djc
Mensanator wrote: On Mar 26, 2:44 pm, Phlip phlip2...@gmail.com wrote: On Mar 26, 6:14 am, Luis M. González luis...@gmail.com wrote: Webmonkey, Greasemonkey, monkey-patching, Tracemonkey, Jägermonkey, Spidermonkey, Mono (monkey in spanish), codemonkey, etc, etc, etc... Monkeys everywhere.

Re: should writing Unicode files be so slow

2010-03-21 Thread djc
Antoine Pitrou wrote: Le Fri, 19 Mar 2010 17:18:17 +, djc a écrit : changing with open(filename, 'rU') as tabfile: to with codecs.open(filename, 'rU', 'utf-8', 'backslashreplace') as tabfile: and with open(outfile, 'wt') as out_part: to with codecs.open(outfile, 'w', 'utf-8

Re: should writing Unicode files be so slow

2010-03-19 Thread djc
Ben Finney wrote: djc slais-...@ucl.ac.uk writes: I have a simple program to read a text (.csv) file Could you please: * simplify it further: make a minimal version that demonstrates the difference you're seeing, without any extraneous stuff that doesn't appear to affect the result

Re: should writing Unicode files be so slow

2010-03-19 Thread djc
Ben Finney wrote: What happens, then, when you make a smaller program that deals with only one file? What happens when you make a smaller program that only reads the file, and doesn't write any? Or a different program that only writes a file, and doesn't read any? It's these sort of

should writing Unicode files be so slow

2010-03-18 Thread djc
I have a simple program to read a text (.csv) file and split it into several smaller files. Tonight I decided to write a unicode variant and was surprised at the difference in performance. Is there a better way? from __future__ import with_statement import codecs def _rowreader(filename,

Re: Iterate over group names in a regex match?

2010-01-19 Thread djc
Brian D wrote: Here's a simple named group matching pattern: s = 1,2,3 p = re.compile(r(?Pone\d),(?Ptwo\d),(?Pthree\d)) m = re.match(p, s) m _sre.SRE_Match object at 0x011BE610 print m.groups() ('1', '2', '3') Is it possible to call the group names, so that I can iterate over them?

[issue7730] ssl has bad coding style

2010-01-18 Thread djc
New submission from djc dirk...@ochtman.nl: Sorry to be nitpicking here, but it kind of sticks out when you take your first look at ssl.py. While PEP 8 only talks about whitespace before the function call argument list parenthesis, I think this should also go for function definition. ssl has

[issue7730] ssl has bad coding style

2010-01-18 Thread djc
Changes by djc dirk...@ochtman.nl: -- type: - feature request ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7730 ___ ___ Python-bugs-list mailing

[issue7730] ssl has bad coding style

2010-01-18 Thread djc
djc dirk...@ochtman.nl added the comment: Thanks! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7730 ___ ___ Python-bugs-list mailing list

[issue7733] asyncore docs reference is unclear

2010-01-18 Thread djc
New submission from djc dirk...@ochtman.nl: http://docs.python.org/library/asyncore.html has this bit (for bind()): (The format of address depends on the address family — see above.) The only way this makes sense is if it points back to the family argument used in the create_socket

[issue7619] imaplib shouldn't use cause DeprecationWarnings in 2.6

2010-01-02 Thread djc
djc dirk...@ochtman.nl added the comment: Awesome, thanks! Will this be ported to the 2.6.x branch? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7619

[issue7619] imaplib shouldn't use cause DeprecationWarnings in 2.6

2010-01-02 Thread djc
djc dirk...@ochtman.nl added the comment: Perfect. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7619 ___ ___ Python-bugs-list mailing list

[issue7619] imaplib shouldn't use cause DeprecationWarnings in 2.6

2010-01-01 Thread djc
New submission from djc dirk...@ochtman.nl: imaplib still calls os.popen2(), which has been deprecated in 2.6. It should probably use subprocess instead, even in 2.6, IMO. See http://bugs.gentoo.org/show_bug.cgi?id=282859 -- components: Library (Lib) messages: 97121 nosy: djc severity

[issue1537721] csv module: add header row to DictWriter

2009-12-07 Thread djc
djc dirk...@ochtman.nl added the comment: I'd like to commit this, but it would be nice to get a review first: Index: Lib/csv.py === --- Lib/csv.py (revision 76697) +++ Lib/csv.py (working copy) @@ -132,6 +132,10

[issue1537721] csv module: add header row to DictWriter

2009-12-07 Thread djc
djc dirk...@ochtman.nl added the comment: Skip, I agree that it's hard to decide if we should have the class write the header on __init__(). I figured starting off with a method to make doing it manually is a good start; people can start using that, and if it's deemed useful we can always add

[issue7427] BadStatusLine is hell to debug

2009-12-03 Thread djc
New submission from djc dirk...@ochtman.nl: For whatever reason, BadStatusLine tracebacks often don't show the line passed into them. Given the errr, heavy architecture of httplib, this makes it pretty bad to debug. It's not clear to me why this is: Traceback (most recent call last): File

[issue7427] BadStatusLine is hell to debug

2009-12-03 Thread djc
djc dirk...@ochtman.nl added the comment: Also, it might be useful here if it showed repr(line) instead of just line, but that'd just be icing on the cake. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7427

[issue7252] list().index() should provide better error reporting

2009-11-02 Thread djc
New submission from djc dirk...@ochtman.nl: a = 'b' [].index(a) Traceback (most recent call last): File stdin, line 1, in module ValueError: list.index(x): x not in list This is suboptimal. IMO it would be much more useful if the ValueError reported the actual value that wasn't in the list

[issue7252] list().index() should provide better error reporting

2009-11-02 Thread djc
djc dirk...@ochtman.nl added the comment: FWIW, quickly grepping through the raises of ValueErrors in the 2.6 stdlib doesn't bring up any other usage of repeat-with-fake-variable-x. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue7252] list().index() should provide better error reporting

2009-11-02 Thread djc
djc dirk...@ochtman.nl added the comment: I want the actual value in there, though! So I can spot the bug. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7252

[issue6965] tmpnam should not be used if tempfile or mkstemp are available

2009-09-22 Thread djc
New submission from djc dirk...@ochtman.nl: I have a bug report in the Gentoo tracker (http://bugs.gentoo.org/show_bug.cgi?id=221183): This is a rather strange request, but please bear me. While building Posix module, python checks (among others) for tmpfile, tmpnam and tmpnam_r however man

[issue1537721] csv module: add header row to DictWriter

2009-08-06 Thread djc
Changes by djc dirk...@ochtman.nl: -- nosy: +djc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1537721 ___ ___ Python-bugs-list mailing list

[issue6491] Improve --with-dbmliborder option

2009-07-20 Thread djc
Changes by djc dirk...@ochtman.nl: -- nosy: +djc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6491 ___ ___ Python-bugs-list mailing list

[issue6119] Confusing DeprecationWarning

2009-07-02 Thread djc
Changes by djc dirk...@ochtman.nl: -- nosy: +djc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6119 ___ ___ Python-bugs-list mailing list

[issue1731717] race condition in subprocess module

2009-05-07 Thread djc
Changes by djc dirk...@ochtman.nl: -- nosy: +djc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1731717 ___ ___ Python-bugs-list mailing list

Re: Geohashing

2009-04-29 Thread djc
in __main__.geohash ***Test Failed*** 1 failures. (1, 1) -- djc @work -- http://mail.python.org/mailman/listinfo/python-list

[issue5853] mimetypes.guess_type() hits recursion limit

2009-04-27 Thread djc
New submission from djc dirk...@ochtman.nl: I've got hgweb (the Mercurial web app) crashing on guess_type() in 2.6.2, but not in 2.5.4. I'm passing in a filename like '/home/djc/src/hg/crew/templates/static/hglogo.png'. Doesn't happen on the REPL, but happens in side the hg serve web server

[issue5853] mimetypes.guess_type() hits recursion limit

2009-04-27 Thread djc
djc dirk...@ochtman.nl added the comment: georg.brandl remarked it might be due to demandimport. That doesn't seem to be the case: from mercurial import demandimport demandimport.enable() import mimetypes mimetypes.guess_type('/home/djc/src/hg/crew/templates/static/hglogo.png') ('image/png

[issue5853] mimetypes.guess_type() hits recursion limit

2009-04-27 Thread djc
djc dirk...@ochtman.nl added the comment: This could well be due to the SocketServer.ThreadingMixIn that's being used by the hg serve built-in web server (since it doesn't show on REPL or, as far as I can see, when used from within Apache + mod_wsgi

[issue4136] merge json library with latest simplejson 2.0.x

2009-04-09 Thread djc
Changes by djc dirk...@ochtman.nl: -- nosy: +djc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4136 ___ ___ Python-bugs-list mailing list

[issue4136] merge json library with latest simplejson 2.0.x

2009-04-09 Thread djc
djc dirk...@ochtman.nl added the comment: I'll take a stab at doing it Raymond's way this weekend. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4136

[issue4753] Faster opcode dispatch on gcc

2009-01-03 Thread djc
Changes by djc dirk...@ochtman.nl: -- nosy: +djc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4753 ___ ___ Python-bugs-list mailing list

[issue3187] os.listdir can return byte strings

2008-10-02 Thread djc
Changes by djc [EMAIL PROTECTED]: -- nosy: +djc ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3187 ___ ___ Python-bugs-list mailing list Unsubscribe

[issue3723] Py_NewInterpreter does not work

2008-09-25 Thread djc
Changes by djc [EMAIL PROTECTED]: -- nosy: +djc ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3723 ___ ___ Python-bugs-list mailing list Unsubscribe

[issue648658] xmlrpc can't do proxied HTTP

2008-09-05 Thread djc
djc [EMAIL PROTECTED] added the comment: Would this be solved by issue1424152? -- nosy: +djc ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue648658

[issue2534] Restore isinstance and issubclass speed in 2.6

2008-08-25 Thread djc
Changes by djc [EMAIL PROTECTED]: -- nosy: +djc ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue2534 ___ ___ Python-bugs-list mailing list Unsubscribe

[issue3123] 2to3 fails

2008-06-16 Thread djc
New submission from djc [EMAIL PROTECTED]: 2to3 fails in recent CPython trunk. This is because lib2to3 got some merges, but the 2to3 script wasn't updated to match. lib2to3.refactor.main() now requires a first argument which isn't given by the 2to3 script. -- assignee: collinwinter

[issue2585] urllib2.HTTPError broken due to urllib.addinfourl changes

2008-04-08 Thread djc
New submission from djc [EMAIL PROTECTED]: [EMAIL PROTECTED] tests $ python2.6 Python 2.6a2+ (trunk, Apr 4 2008, 20:21:45) [GCC 4.1.2 20070214 ( (gdc 0.24, using dmd 1.020)) (Gentoo 4.1.2 p1.0.2)] on linux2 Type help, copyright, credits or license for more information. import urllib2 try

[issue2585] urllib2.HTTPError broken due to urllib.addinfourl changes

2008-04-08 Thread djc
Changes by djc [EMAIL PROTECTED]: -- nosy: +georg.brandl -birkenfeld __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2585 __ ___ Python-bugs-list mailing list

[issue2444] Adding __iter__ to class Values of module optparse

2008-03-23 Thread djc
djc [EMAIL PROTECTED] added the comment: I'd like this. I had one instance where a number of options where dynamically added to the OptionParser based on loadable modules, so that I wanted to dynamically iterate over the Values returned as well. -- nosy: +djc

[issue2189] urllib.quote() throws KeyError when passed an iterator

2008-02-25 Thread djc
New submission from djc: urllib.quote(['', 'aa']) Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python2.5/urllib.py, line 1205, in quote res = map(safe_map.__getitem__, s) KeyError: '' I think this is a weird error message to throw. quote() is obviously

Re: simple way to un-nest (flatten?) list

2006-11-07 Thread djc
(), []) TypeError: can only concatenate list (not str) to list -- djc -- http://mail.python.org/mailman/listinfo/python-list

Re: simple way to un-nest (flatten?) list

2006-11-06 Thread djc
be the same word in variant cases result = sum(r.values(), ()) will do fine and is as simple as I suspected the answer would be. -- djc -- http://mail.python.org/mailman/listinfo/python-list

simple way to un-nest (flatten?) list

2006-11-05 Thread djc
')} to ('Aslib','ASLIB','JDOC','jdoc') -- djc -- http://mail.python.org/mailman/listinfo/python-list