Re: fastest data structure for retrieving objects identified by (x, y) tuple?

2012-10-04 Thread Oscar Benjamin
On Oct 4, 2012 3:02 AM, "Steven D'Aprano" < steve+comp.lang.pyt...@pearwood.info> wrote: > # populate a random matrix using both dict and list > adict = {} > alist = [[None]*2400 for i in range(2400)] > from random import randrange > for i in range(1000): > x = randrange(2400) > y = randran

Re: final question: logging to stdout and updating files

2012-10-04 Thread Ramchandra Apte
On Thursday, 4 October 2012 08:41:35 UTC+5:30, Littlefield, Tyler wrote: > pHello all: > > I've seen frameworks like django reload files when it detects that > > they've been changed; how hard would it be to make my engine reload > > files that it detects were changed? I'm also curious how ha

Re: final question: logging to stdout and updating files

2012-10-04 Thread Oscar Benjamin
On 4 October 2012 04:11, Littlefield, Tyler wrote: > pHello all: > I've seen frameworks like django reload files when it detects that they've > been changed; how hard would it be to make my engine reload files that it > detects were changed? I tend to think that it's better to reload things expli

How to print html in python the normal way

2012-10-04 Thread ashishjain . ash
Hi, I wrote a simple filter as: @register.filter() def html(value): return 'Check' when I use this filter in my template, it displays html as: Check I want to display as: Check am I missing something. - Thanks for your help Ashish -- http://mail.python.org/mailman/listinfo/python-list

Re: How to print html in python the normal way

2012-10-04 Thread Chris Angelico
On Thu, Oct 4, 2012 at 9:24 PM, wrote: > am I missing something. The first thing you're missing is more detail in your question. My crystal ball tells me you're using some kind of web framework and viewing this in your browser. And my second crystal ball suggests that it's probably Django. But i

Re: Python-list Digest, Vol 109, Issue 20

2012-10-04 Thread Benjamin Jessup
On 10/4/2012 12:20 AM, python-list-requ...@python.org wrote: How do you know that? No offence, but if you can't even work out whether lookups in a dict or a list are faster, I can't imagine why you think you can intuit what the fastest way to retrieve the nearest neighbours would be. Whats wro

Re: fastest data structure for retrieving objects identified by (x, y) tuple?

2012-10-04 Thread Benjamin Jessup
On 10/4/2012 12:20 AM, python-list-requ...@python.org wrote: How do you know that? No offence, but if you can't even work out whether lookups in a dict or a list are faster, I can't imagine why you think you can intuit what the fastest way to retrieve the nearest neighbours would be. Whats wro

Re: How to print html in python the normal way

2012-10-04 Thread Ramchandra Apte
On Thursday, 4 October 2012 17:00:57 UTC+5:30, Chris Angelico wrote: > On Thu, Oct 4, 2012 at 9:24 PM, wrote: > > > am I missing something. > > > > The first thing you're missing is more detail in your question. My > > crystal ball tells me you're using some kind of web framework and > > v

Re: design question:game skill system

2012-10-04 Thread Ramchandra Apte
On Wednesday, 3 October 2012 14:19:57 UTC+5:30, Jean-Michel Pichavant wrote: > - Original Message - > > > Hello all: > > > I'm looking at a skill/perk system, where the player builds up his > > > char > > > by using perk points to add abilities. > > > Each perk is under a category, an

Re: How to print html in python the normal way

2012-10-04 Thread Joel Goldstick
On Thu, Oct 4, 2012 at 9:11 AM, Ramchandra Apte wrote: > On Thursday, 4 October 2012 17:00:57 UTC+5:30, Chris Angelico wrote: >> On Thu, Oct 4, 2012 at 9:24 PM, wrote: >> >> > am I missing something. >> >> You should look at the built in django tags, and learn about them before writing your own

Re: final question: logging to stdout and updating files

2012-10-04 Thread Ramchandra Apte
On Thursday, 4 October 2012 08:41:35 UTC+5:30, Littlefield, Tyler wrote: > pHello all: > > I've seen frameworks like django reload files when it detects that > > they've been changed; how hard would it be to make my engine reload > > files that it detects were changed? I'm also curious how ha

ANN: Python Meeting Düsseldorf - 23.10.2012

2012-10-04 Thread eGenix Team: M.-A. Lemburg
[This announcement is in German since it targets a local user group meeting in Düsseldorf, Germany] ANKÜNDIGUNG Python Meeting Düsseldorf http://pyddf.de/ Ein Treffen v

Re: final question: logging to stdout and updating files

2012-10-04 Thread Steven D'Aprano
On Thu, 04 Oct 2012 06:34:28 -0700, Ramchandra Apte wrote: > "Optimize code always even if it causes bugs" - Ramchandra Apte, 2001- Well, you've just added yourself into my list of people whose advice should always be ignored. That is *terrible* advice. But if you insist on following it, you ca

Re: fastest data structure for retrieving objects identified by (x, y) tuple?

2012-10-04 Thread Steven D'Aprano
On Thu, 04 Oct 2012 08:21:13 -0400, Benjamin Jessup wrote: > On 10/4/2012 12:20 AM, python-list-requ...@python.org wrote: >> How do you know that? >> >> No offence, but if you can't even work out whether lookups in a dict or >> a list are faster, I can't imagine why you think you can intuit what >

Re: final question: logging to stdout and updating files

2012-10-04 Thread Chris Angelico
On Fri, Oct 5, 2012 at 12:00 AM, Steven D'Aprano wrote: > That is *terrible* advice. But if you insist on following it, you can > optimize *any* Python program to this: > > # === start code === > pass # this line is optional > # === end code === > > > There you go. The most heavily optimized, fas

Re: Why is pylaucher in Python 3.3 being installed in Windows folder?

2012-10-04 Thread Piotr Dobrogost
On Oct 4, 6:30 am, Chris Rebert wrote: > Presumably because Program Files isn't part of the > $PATH.http://superuser.com/questions/124239/what-is-the-default-path-enviro... > Contrast (from the PEP): "However, the Windows directory is always on the > path." I guess that's the reason indeed. >

Re: final question: logging to stdout and updating files

2012-10-04 Thread Steven D'Aprano
On Wed, 03 Oct 2012 21:11:29 -0600, Littlefield, Tyler wrote: > I've seen frameworks like django reload files when it detects that > they've been changed; how hard would it be to make my engine reload > files that it detects were changed? Oh, about as hard as writing a program. What sort of fil

Re: Combinations of lists

2012-10-04 Thread Steen Lysgaard
2012/10/4 Joshua Landau : > On 3 October 2012 21:15, Steen Lysgaard wrote: >> >> Hi, >> >> thanks for your interest. Sorry for not being completely clear, yes >> the length of m will always be half of the length of h. > > > (Please don't top post) > > I have a solution to this, then. > It's not sh

Re: Why is pylaucher in Python 3.3 being installed in Windows folder?

2012-10-04 Thread Ian Kelly
On Thu, Oct 4, 2012 at 8:41 AM, Piotr Dobrogost wrote: > Now, the question is why not put pylauncher together with python.exe > now, when 3.3 has an option to add Python's folder to the PATH? In > case there are more than one Python installed this would mean changing > pylauncher when changing act

How can I hide my stack frames in a TestCase subclass?

2012-10-04 Thread David Banks
I want to add a custom assert method to a TestCase subclass. I tried to copy my implementation from the unittest module so that it would match the behaviour of the regular TestCase as closely as possible. (I would prefer to just delegate to self.assertEqual() but this causes even more backtrace n

Re: fastest data structure for retrieving objects identified by (x, y) tuple?

2012-10-04 Thread Thomas Rachel
Am 04.10.2012 03:58 schrieb Steven D'Aprano: alist = [[None]*2400 for i in range(2400)] from random import randrange for i in range(1000): x = randrange(2400) y = randrange(2400) adict[(x, y)] = "something" alist[x][y] = "something" The actual sizes printed will depend on h

Re: Why is pylaucher in Python 3.3 being installed in Windows folder?

2012-10-04 Thread Oscar Benjamin
On 4 October 2012 16:51, Ian Kelly wrote: > On Thu, Oct 4, 2012 at 8:41 AM, Piotr Dobrogost > wrote: >> Now, the question is why not put pylauncher together with python.exe >> now, when 3.3 has an option to add Python's folder to the PATH? In >> case there are more than one Python installed this

Re: Can somebody give me an advice about what to learn?

2012-10-04 Thread Wolfgang Keller
> >> The point why Ruby was started (perceived deficit of > >> object-orientation) has been remedied since Python 2.2. > > > > Not completely. At the least, there's arguably still the issue of > > len() and friends (vs. `.length` etc.), and also of `self` being > > explicit. > > I'm not entirely

notmm is dead!

2012-10-04 Thread Etienne Robillard
Dear list, Due to lack of energy and resources i'm really sad to announce the removal of notmm from pypi and bitbucket. I deleted also my account from bitbucket as it was not really useful for me. notmm will continue to be accessible from my master site at http://gthc.org/dist/notmm until the se

Anybody know what's up with Gmane?

2012-10-04 Thread Mark Lawrence
Good evening all, I read some 20 Python mailing lists through Gmane using Thunderbird on Windows but nothing new has arrived for almost 24 hours, hence why I've reluctantly resorted to Google groups to try and find out what is going on. Looking directly at http://news.gmane.org/gmane.comp.pyth

Re: Combinations of lists

2012-10-04 Thread 88888 Dihedral
On Thursday, October 4, 2012 11:12:41 PM UTC+8, Steen Lysgaard wrote: > 2012/10/4 Joshua Landau : > > > On 3 October 2012 21:15, Steen Lysgaard wrote: > > >> > > >> Hi, > > >> > > >> thanks for your interest. Sorry for not being completely clear, yes > > >> the length of m will always be hal

sum function

2012-10-04 Thread mike20007
Hi All, I am new to python and am getting the data from hbase. I am trying to do sum on the column as below scanner = client.scannerOpenWithStop("tab", "10", "1000", ["cf:col1"]) total = 0.0 r = client.scannerGet(scanner) while r: for k in (r[0].columns): total += float(r[0].columns[k].va

Re: sum function

2012-10-04 Thread Ian Kelly
On Thu, Oct 4, 2012 at 2:52 PM, wrote: > scanner = client.scannerOpenWithStop("tab", "10", "1000", ["cf:col1"]) > total = 0.0 > r = client.scannerGet(scanner) > while r: > for k in (r[0].columns): > total += float(r[0].columns[k].value) > r = client.scannerGet(scanner) > > print total > >

Re: sum function

2012-10-04 Thread Ian Kelly
On Thu, Oct 4, 2012 at 3:04 PM, Ian Kelly wrote: > scanner = client.scannerOpenWithStop("tab", "10", "1000", ["cf:col1"]) > next_r = itertools.partial(client.scannerGet, scanner) > total = sum(float(col.value) for r in iter(next_r, None) for col in > r.itervalues()) That should be "functools" abo

Re: sum function

2012-10-04 Thread Mike
I get below error NameError: name 'functools' is not defined Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: sum function

2012-10-04 Thread Mike
Thanks Ian for the quick reply. I get the below error. NameError: name 'itertools' is not defined Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: sum function

2012-10-04 Thread Dave Angel
On 10/04/2012 05:29 PM, Mike wrote: > I get below error > > NameError: name 'functools' is not defined > functools is a module in the standard library. You need to import it. import functools -- DaveA -- http://mail.python.org/mailman/listinfo/python-list

Re: sum function

2012-10-04 Thread Chris Angelico
On Fri, Oct 5, 2012 at 7:29 AM, Mike wrote: > I get below error > > NameError: name 'functools' is not defined > > Thanks functools is a module: import functools ChrisA -- http://mail.python.org/mailman/listinfo/python-list

RE: Experimental Python-based shell

2012-10-04 Thread Prasad, Ramit
(A little quoting manipulation to make it easier to read with appropriate context.) > > On Wed, Oct 3, 2012 at 11:25 AM, Amirouche Boubekki > > wrote: > > > 2012/10/3 Jonathan Hayward > > > The chief benefit besides the searching, so far, is that you can use Py3k > > > mixed with shell command

RE: final question: logging to stdout and updating files

2012-10-04 Thread Prasad, Ramit
Chris Angelico wrote: > Sent: Thursday, October 04, 2012 9:28 AM > To: python-list@python.org > Subject: Re: final question: logging to stdout and updating files > > On Fri, Oct 5, 2012 at 12:00 AM, Steven D'Aprano > wrote: > > That is *terrible* advice. But if you insist on following it, you can

Re: notmm is dead!

2012-10-04 Thread Etienne Robillard
Thanks, but I tried all that and don't have much energy for continuing. If you're serious about open source then maybe you can forward the thread to django-developers and get some fundings to pay for a minimalistic fee to get the project maintained by someone else, otherwise I'd prefer sticking

Re: notmm is dead!

2012-10-04 Thread Chris Angelico
On Fri, Oct 5, 2012 at 9:13 AM, Etienne Robillard wrote: > Thanks, but I tried all that and don't have much energy for continuing. If > you're > serious about open source then maybe you can forward the thread to > django-developers > and get some fundings to pay for a minimalistic fee to get the

Re: fastest data structure for retrieving objects identified by (x,y) tuple?

2012-10-04 Thread Steven D'Aprano
On Thu, 04 Oct 2012 18:11:28 +0200, Thomas Rachel wrote: > Am 04.10.2012 03:58 schrieb Steven D'Aprano: >> alist = [[None]*2400 for i in range(2400)] from random import randrange >> for i in range(1000): >> x = randrange(2400) >> y = randrange(2400) >> adict[(x, y)] = "something" >>

Re: notmm is dead!

2012-10-04 Thread Etienne Robillard
Err not exactly.. :) Firstly notmm is still ISC licensed and available from here http://gthc.org/notmm/dist/. Secondly i don't want to leave it to the hands of people without I can get a single dime for the work did, however some peoples don't seem to get this point yet.. My apologies if you f

Re: sum function

2012-10-04 Thread Mike
On Thursday, October 4, 2012 5:40:26 PM UTC-4, Dave Angel wrote: > On 10/04/2012 05:29 PM, Mike wrote: > > > I get below error > > > > > > NameError: name 'functools' is not defined > > > > > > > functools is a module in the standard library. You need to import it. > > > > import functool

Re: notmm is dead!

2012-10-04 Thread Ian Kelly
On Thu, Oct 4, 2012 at 6:22 PM, Steven D'Aprano wrote: > By the way, the latest version of notmm (0.4.4) has an empty licence > file. No licence means that everyone using it is unlicenced and therefore > infringing your copyright. It's an ISC license. The notmm-0.4.4/LICENSE file is a link to th

Re: notmm is dead!

2012-10-04 Thread Etienne Robillard
You probably have a old tarball or something... $ wget http://gthc.org/dist/notmm/notmm-0.4.4.tar.gz $ md5sum notmm-0.4.4.tar.gz dff1b2ec5373b5157cf79d57169a336e notmm-0.4.4.tar.gz Cheers, Etienne On Thu, 4 Oct 2012 18:46:18 -0600 Ian Kelly wrote: > On Thu, Oct 4, 2012 at 6:22 PM, Steven D'A

Re: sum function

2012-10-04 Thread Ian Kelly
On Thu, Oct 4, 2012 at 6:40 PM, Mike wrote: > Traceback (most recent call last): > File "test.py", line 16, in > total = sum(float(col.value) for r in iter(next_r, None) for col in > r.itervalues()) > File "test.py", line 16, in > total = sum(float(col.value) for r in iter(next_r, N

Re: Anybody know what's up with Gmane?

2012-10-04 Thread Ned Deily
In article <4509cf54-a71d-44cc-90a5-0abd7c6a8...@googlegroups.com>, Mark Lawrence wrote: > I read some 20 Python mailing lists through Gmane using Thunderbird on > Windows but nothing new has arrived for almost 24 hours, hence why I've > reluctantly resorted to Google groups to try and find out

Re: How can I hide my stack frames in a TestCase subclass?

2012-10-04 Thread Peter Otten
David Banks wrote: > I want to add a custom assert method to a TestCase subclass. I tried to > copy my implementation from the unittest module so that it would match > the behaviour of the regular TestCase as closely as possible. (I would > prefer to just delegate to self.assertEqual() but this

Re: Anybody know what's up with Gmane?

2012-10-04 Thread Terry Reedy
On 10/4/2012 3:03 PM, Mark Lawrence wrote: > I read some 20 Python mailing lists through Gmane using Thunderbird > on Windows but nothing new has arrived for almost 24 hours, hence why > I've reluctantly resorted to Google groups to try and find out what > is going on. Looking directly at > http

Re: Experimental Python-based shell

2012-10-04 Thread Terry Reedy
Indexing Python code is ugly. I suggest prefixing non-Python with $. On 10/3/2012 1:24 PM, Jonathan Hayward wrote: I am open to suggestions and patches. I don't think the syntax strange, though: it offers a clear and distinct way to differentiate Python and shell commands, and shell commands can

Re: + in regular expression

2012-10-04 Thread Mark Lawrence
On 04/10/2012 04:01, contro opinion wrote: str=" gg" x1=re.match("\s+",str) x1 <_sre.SRE_Match object at 0xb7354db0> x2=re.match("\s{6}",str) x2 <_sre.SRE_Match object at 0xb7337f38> x3=re.match("\s{6}+",str) Traceback (most recent call last): File "", line 1, in File "/usr/l

Re: unit testing class hierarchies

2012-10-04 Thread Terry Reedy
On 10/3/2012 5:33 AM, Oscar Benjamin wrote: On 3 October 2012 02:20, Steven D'Aprano wrote: But surely, regardless of where that functionality is defined, you still need to test that both D1 and D2 exhibit the correct behaviour? Otherwise D2 (say) may break that functionality and your tests wo

Re: sum function

2012-10-04 Thread Mike
I agree with you, Ian. Thanks for all the help. Now I get the below error. File "test.py", line 17, in total = sum(float(col.value) for r in iter(next_r, None) for col in r[0].columns.itervalues()) File "test.py", line 17, in total = sum(float(col.value) for r in iter(next_r, None

Re: Re: + in regular expression

2012-10-04 Thread Evan Driscoll
On 10/04/2012 04:59 PM, Mark Lawrence wrote: why the "\s{6}+" is not a regular pattern? Why are you too lazy to do any research before posting a question? Errr... what? I'm only somewhat familiar with the extra stuff that languages provide in their regexs beyond true regular expressio

Re: notmm is dead!

2012-10-04 Thread Michael Torrie
On 10/04/2012 05:13 PM, Etienne Robillard wrote: > Thanks, but I tried all that and don't have much energy for continuing. If > you're > serious about open source then maybe you can forward the thread to > django-developers > and get some fundings to pay for a minimalistic fee to get the project

RE: + in regular expression

2012-10-04 Thread Saroo Jain
x3=re.match("\s{6}+",str) instead use x3=re.match("\s{6,}",str) This serves the purpose. And also give some food for thought for why the first one throws an error. Cheers, Saroo -Original Message- From: Python-list [mailto:python-list-bounces+saroo_jain=infosys@python.org] On Beha

Re: Experimental Python-based shell

2012-10-04 Thread Terry Reedy
On 10/3/2012 4:22 PM, Terry Reedy wrote: Indexing Python code is ugly. I suggest prefixing non-Python with $. Indenting, meaning indenting the Python header lines but not non-Python lines. On 10/3/2012 1:24 PM, Jonathan Hayward wrote: I am open to suggestions and patches. I don't think the

Embedded Python 3 porting issues when passing FILE* to PyRun_SimpleFile() in Windows mixed-compiler environment

2012-10-04 Thread Deron Meranda
Hi. I'm trying to convert a large C application that embeds Python so it works with Python 3, and am running into an new API limitation I can't solve. I have a report from Windows users that there is a crashing problem occurring with calls to PyRun_SimpleFile (and similar functions). This app

Re: + in regular expression

2012-10-04 Thread Ian Kelly
On Thu, Oct 4, 2012 at 9:44 PM, Saroo Jain wrote: > x3=re.match("\s{6}+",str) > > instead use > x3=re.match("\s{6,}",str) > > This serves the purpose. And also give some food for thought for why the > first one throws an error. That matches six or more spaces, not multiples of six spaces. -- ht

Re: + in regular expression

2012-10-04 Thread Cameron Simpson
On 03Oct2012 21:17, Ian Kelly wrote: | On Wed, Oct 3, 2012 at 9:01 PM, contro opinion wrote: | > why the "\s{6}+" is not a regular pattern? | | Use a group: "(?:\s{6})+" Yeah, it is probably a precedence issue in the grammar. "(\s{6})+" is also accepted. -- Cameron Simpson Disclaimer: ERIM

Re: How can I hide my stack frames in a TestCase subclass?

2012-10-04 Thread Manuel Pégourié-Gonnard
Peter Otten scripsit : > David Banks wrote: > >> Note that the custom assert method causes a stack trace with two frames, >> one inside the method itself, whereas the stock unittest method only has >> one frame, the relevant line in the user's code. How can I apply this >> frame-hiding behaviour