Re: Sikuli: the coolest Python project I have yet seen...

2010-01-24 Thread tim
On Jan 25, 11:18 am, Ron wrote: > Sikuli is the coolest Python project I have ever seen in my ten year > hobbyist career. An MIT oepn source project, Sikuli uses Python to > automate GUI tasks (in any GUI or GUI baed app that runs the JVM) by > simply drag and dropping GUI elements into Python scr

Re: list.pop(0) vs. collections.dequeue

2010-01-24 Thread Paul Rubin
Steve Howell writes: > There is nothing wrong with deque, at least as far as I know, if the > data strucure actually applies to your use case. It does not apply to > my use case. You haven't explained why deque doesn't apply to your use case. Until a convincing explanation emerges, the sentimen

Re: [2.5.1.1/dictionary] Change sorting order?

2010-01-24 Thread Arnaud Delobelle
Arnaud Delobelle writes: > Gilles Ganault writes: > >> On Fri, 22 Jan 2010 13:17:44 +0100, Gilles Ganault >> wrote: >>>To avoid users from creating login names that start with digits in >>>order to be listed at the top, I'd like to sort the list differently >>>every minute so that it'll start w

Re: list.pop(0) vs. collections.dequeue

2010-01-24 Thread Steven D'Aprano
On Sun, 24 Jan 2010 20:12:11 -0800, Steve Howell wrote: >> > The most ambitious proposal is to fix the memory manager itself to >> > allow the release of memory from the start of the chunk. >> >> That's inappropriate given the memory fragmentation it would cause. >> >> > Bullshit. Memory managers

Re: list.pop(0) vs. collections.dequeue

2010-01-24 Thread Steve Howell
On Jan 24, 12:44 pm, Paul Rubin wrote: > Steve Howell writes: > > Proposal: Improve list's implementation so that deleting elements from > > the front of the list does not require an O(N) memmove operation. ... > > It is possible now, of course, to use a data structure in > > Python that has O(1)

Sikuli: the coolest Python project I have yet seen...

2010-01-24 Thread Ron
Sikuli is the coolest Python project I have ever seen in my ten year hobbyist career. An MIT oepn source project, Sikuli uses Python to automate GUI tasks (in any GUI or GUI baed app that runs the JVM) by simply drag and dropping GUI elements into Python scripts as function arguments. Download at h

Re: easy_install error ...

2010-01-24 Thread tekion
I am also having another issue with easy_install, python setup.py easy_install --find-links thirdparty 'docutils==0.4' running easy_install error: Not a URL, existing file, or requirement spec: "'docutils==0.4'" I think both problem are related. I have setuptool version .6C11 install and I am run

Re: how to generate random numbers that satisfy certain distribution

2010-01-24 Thread Robert Kern
On 2010-01-23 21:30 , Steven D'Aprano wrote: On Sat, 23 Jan 2010 14:10:10 -0800, Paul Rubin wrote: Steven D'Aprano writes: The Box-Muller transform is reasonably simple, but you can't be serious that it is simpler than adding twelve random numbers and subtracting six! If you want a normal d

Re: medians for degree measurements

2010-01-24 Thread Robert Kern
On 2010-01-23 05:52 , Steven D'Aprano wrote: On Fri, 22 Jan 2010 22:09:54 -0800, Steve Howell wrote: On Jan 22, 5:12 pm, MRAB wrote: Steve Howell wrote: I just saw the thread for medians, and it reminded me of a problem that I need to solve. We are writing some Python software for sailing,

Re: Symbols as parameters?

2010-01-24 Thread George Sakkis
On Jan 25, 1:05 am, Steven D'Aprano wrote: > On Sun, 24 Jan 2010 10:11:07 -0800, George Sakkis wrote: > > Both in your example and by using a context manager, you can get away > > with not passing locals() explicitly by introspecting the stack frame. > > You say that as if it were less of an ugly

Re: Broken Python 2.6 installation on Ubuntu Linux 8.04

2010-01-24 Thread John Ladasky
Thanks, Benjamin, I am getting a handle on this. I've written my own Python modules before, and have installed them using distutils. So I know that procedure. I just downloaded the Numpy 1.4.0 tarball, and I succeeded in installing it. A program I wrote which depends on numpy ran successfully f

Re: Symbols as parameters?

2010-01-24 Thread Steven D'Aprano
On Sun, 24 Jan 2010 10:11:07 -0800, George Sakkis wrote: > Both in your example and by using a context manager, you can get away > with not passing locals() explicitly by introspecting the stack frame. You say that as if it were less of an ugly hack than the locals() trick. But sys._getframe is

Re: ISO module for binomial coefficients, etc.

2010-01-24 Thread Mel
Dave Angel wrote: > But I still think there must be code for the gamma function that would > be quicker. But I haven't chased that lead. Log of the gamma function is also an algorithm in its own right (e.g. published in _Numerical Recipes_.) Mel. -- http://mail.python.org/mailman/li

Re: ctypes for AIX

2010-01-24 Thread Andrew MacIntyre
Waddle, Jim wrote: Is there a policy concerning getting functions like ctypes working on AIX. If you can get it working, post a patch on the bug tracker. -- - Andrew I MacIntyre "These thoughts are mine

Re: Broken Python 2.6 installation on Ubuntu Linux 8.04

2010-01-24 Thread Christian Heimes
Benjamin Kaplan wrote: > Extensions written in C must be recompiled for every version of > Python. Since you're using a version of Python not available through > the package manager, your packages are also not available through > that. You'll have to download the sources for those and compile them

Re: Consume an iterable

2010-01-24 Thread Peter Otten
Raymond Hettinger wrote: > FWIW, the deque() approach becomes even faster in Py2.7 and Py3.1 > which has a high-speed path for the case where maxlen is zero. > Here's a snippet from Modules/_collectionsmodule.c: > > /* Run an iterator to exhaustion. Shortcut for >the extend/extendleft method

Re: How to Embed PHP in HTML print

2010-01-24 Thread Steve Holden
NickC wrote: > On Sun, 24 Jan 2010 10:37:51 +, Duncan Booth wrote: > >> content with ajax. Alternatively, use urllib in Python to retrieve a >> page from the Apache server and insert that into its own output: that > > Thanks for hint on urllib. I shake my head in amazement with python > som

Re: Broken Python 2.6 installation on Ubuntu Linux 8.04

2010-01-24 Thread Benjamin Kaplan
On Sun, Jan 24, 2010 at 5:53 PM, John Ladasky wrote: > Hello everyone, > > I've posted this same question over on ubuntuforums.org, so I'm trying > to get help in all of the logical places. > > I'm running Ubuntu Linux 8.04 (Hardy) on a fairly new x86 box, with > two hard disks in a software RAID

Re: [2.5.1.1/dictionary] Change sorting order?

2010-01-24 Thread Arnaud Delobelle
Gilles Ganault writes: > On Fri, 22 Jan 2010 13:17:44 +0100, Gilles Ganault > wrote: >>To avoid users from creating login names that start with digits in >>order to be listed at the top, I'd like to sort the list differently >>every minute so that it'll start with the next letter, eg. display th

Broken Python 2.6 installation on Ubuntu Linux 8.04

2010-01-24 Thread John Ladasky
Hello everyone, I've posted this same question over on ubuntuforums.org, so I'm trying to get help in all of the logical places. I'm running Ubuntu Linux 8.04 (Hardy) on a fairly new x86 box, with two hard disks in a software RAID 1 configuration. Hardy comes with Python 2.5 as a standard packag

Re: start .pyo files with doubleclick on windows

2010-01-24 Thread News123
Hi Alf, Alf P. Steinbach wrote: > * News123: >> Hi, >> >> >> I'd like to start .pyo files under windows with a double click. > > C:\> assoc .pyo > .pyo=Python.CompiledFile > > C:\> ftype python.compiledfile > python.compiledfile="C:\Program Files\cpython\python31\python.exe" "%1" %* > > C:\

Re: list.pop(0) vs. collections.dequeue

2010-01-24 Thread Daniel Stutzbach
On Sun, Jan 24, 2010 at 1:53 PM, Steve Howell wrote: > I don't think anybody provided an actual link, but please correct me > if I overlooked it. I have to wonder if my messages are all ending up in your spam folder for some reason. :-) PEP 3128 (which solves your problem, but not using the impl

Re: ISO module for binomial coefficients, etc.

2010-01-24 Thread casevh
On Jan 23, 2:55 pm, kj wrote: > Before I go off to re-invent a thoroughly invented wheel, I thought > I'd ask around for some existing module for computing binomial > coefficient, hypergeometric coefficients, and other factorial-based > combinatorial indices.  I'm looking for something that can ha

Re: [2.5.1.1/dictionary] Change sorting order?

2010-01-24 Thread Gilles Ganault
On Fri, 22 Jan 2010 13:17:44 +0100, Gilles Ganault wrote: >To avoid users from creating login names that start with digits in >order to be listed at the top, I'd like to sort the list differently >every minute so that it'll start with the next letter, eg. display the >list from A...Zdigits the fir

Re: start .pyo files with doubleclick on windows

2010-01-24 Thread Alf P. Steinbach
* News123: Hi, I'd like to start .pyo files under windows with a double click. (I know I can just write a .bat wrapper, but somehow it would be more fun to start with a direct double click) Currently this works if the file does not import any other .pyo file. The problem is, that a doblecl

start .pyo files with doubleclick on windows

2010-01-24 Thread News123
Hi, I'd like to start .pyo files under windows with a double click. (I know I can just write a .bat wrapper, but somehow it would be more fun to start with a direct double click) Currently this works if the file does not import any other .pyo file. The problem is, that a dobleclick performs

Re: py2exe deal with python command line inside a program

2010-01-24 Thread im_smiling
Thanks for taking time to help me. If I use either way, requiring python being installed, or allow source codes exposure, it seems in some degree, there's not necessarily to make the executable package any more, which is very frustrating Suppose I take the first way, python environment must be

Re: ISO module for binomial coefficients, etc.

2010-01-24 Thread Dave Angel
Alf P. Steinbach wrote: * Dave Angel: kj wrote: Before I go off to re-invent a thoroughly invented wheel, I thought I'd ask around for some existing module for computing binomial coefficient, hypergeometric coefficients, and other factorial-based combinatorial indices. I'm looking for somethin

Re: Consume an iterable

2010-01-24 Thread Paul Rubin
Raymond Hettinger writes: > This code consumes an iterator to exhaustion. > It is short, sweet, and hard to beat. I've always used sum(1 for x in iterator) or some such. -- http://mail.python.org/mailman/listinfo/python-list

Re: list.pop(0) vs. collections.dequeue

2010-01-24 Thread Paul Rubin
Steve Howell writes: > Proposal: Improve list's implementation so that deleting elements from > the front of the list does not require an O(N) memmove operation. ... > It is possible now, of course, to use a data structure in > Python that has O(1) for deleting off the top of the list, but none of

Re: [Edu-sig] some turtle questions

2010-01-24 Thread Alf P. Steinbach
* Helene Martin: I'm almost sure that there's no way for a turtle to know anything about the background. That's an unfortunate limitation! The "background" for the turtle is just a Tkinter canvas. So yes, it's technically possible to inspect things there, since there is method to obtain the

Re: Terminal application with non-standard print

2010-01-24 Thread Rémi
My apologies, I did not run the lines properly. Thanks, that works great now. If I understand well, \r erases the last line. How about erasing the previous lines? For example when writing sys.stdout.write("1\n2\n") sys.stdout.write("\r3") the "1" is still visible. -- Rémi On 24 jan, 20:53, Gra

easy_install error ...

2010-01-24 Thread tekion
All, I am running into issue with easy install error, see error below: python setup.py easy_install -m 'docutils==0.4' running easy_install error: Not a URL, existing file, or requirement spec: "'docutils==0.4'" any idea as to why? thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Symbols as parameters?

2010-01-24 Thread Alf P. Steinbach
Just top-posting for clarity. :-) up = "UP" left= "LEFT" down= "DOWN" right = "RIGHT" # This code is not guaranteed to work by the language specification. # But it is one way to do the solution I presented earlier in the thread. import sys def import_from( module_name ):

Re: list.pop(0) vs. collections.dequeue

2010-01-24 Thread Terry Reedy
On 1/24/2010 2:26 PM, Steve Howell wrote: I think it's a good idea to write a PEP on this issue, and I will attempt a first draft. I think I should submit the first draft to python-ideas, correct? That is not a *requirement* for drafts in general, but it is a good idea for a community or com

Re: Consume an iterable

2010-01-24 Thread Raymond Hettinger
>      def consume2(iterator, n):  # the approved proposal (see #7764) >          if n is None: >              collections.deque(iterator, maxlen=0) >          else: >              next(islice(iterator, n, n), None) FWIW, the deque() approach becomes even faster in Py2.7 and Py3.1 which has a high

Re: Terminal application with non-standard print

2010-01-24 Thread Grant Edwards
On 2010-01-24, R?mi wrote: > Thank you for your answer, but that does not work: Works fine for me. > the second line is printed after the first one. Not when I run it. There's not much more I can say given the level of detail you've provided. -- Grant -- http://mail.python.org/mailman/li

Re: list.pop(0) vs. collections.dequeue

2010-01-24 Thread Steve Howell
On Jan 24, 11:28 am, a...@pythoncraft.com (Aahz) wrote: > In article , > Steve Howell   wrote: > > > > >Even with realloc()'s brokenness, you could improve pop(0) in a way > >that does not impact list access at all, and the patch would not change > >the time complexity of any operation; it would ju

[ANN] Python 2.5.5 Release Candidate 2.

2010-01-24 Thread Martin v. Löwis
On behalf of the Python development team and the Python community, I'm happy to announce the release candidate 2 of Python 2.5.5. This is a source-only release that only includes security fixes. The last full bug-fix release of Python 2.5 was Python 2.5.4. Users are encouraged to upgrade to the la

Re: Terminal application with non-standard print

2010-01-24 Thread Rémi
Thank you for your answer, but that does not work : the second line is printed after the first one. -- Rémi Grant Edwards wrote: On 2010-01-24, R?mi wrote: I would like to do a Python application that prints data to stdout, but not the common way. I do not want the lines to be printed afte

Re: Terminal application with non-standard print

2010-01-24 Thread Grant Edwards
On 2010-01-24, R?mi wrote: > I would like to do a Python application that prints data to stdout, but > not the common way. I do not want the lines to be printed after each > other, but the old lines to be replaced with the new ones, like wget > does it for example (when downloading a file you can

Re: list.pop(0) vs. collections.dequeue

2010-01-24 Thread Aahz
In article , Steve Howell wrote: > >Even with realloc()'s brokenness, you could improve pop(0) in a way >that does not impact list access at all, and the patch would not change >the time complexity of any operation; it would just add negligible >extract bookkeeping within list_resize() and a few

Terminal application with non-standard print

2010-01-24 Thread Rémi
Hello everyone, I would like to do a Python application that prints data to stdout, but not the common way. I do not want the lines to be printed after each other, but the old lines to be replaced with the new ones, like wget does it for example (when downloading a file you can see the percentage

Re: list.pop(0) vs. collections.dequeue

2010-01-24 Thread Steve Howell
On Jan 23, 3:04 pm, Terry Reedy wrote: > On 1/23/2010 12:17 PM, Steve Howell wrote: > > > Terry Reedy said: > > > ''' > > If you try writing a full patch, as I believe someone did, or at least > > a > > prototype thereof, when the idea was discussed, you might have a > > better > > idea of what th

Re: list.pop(0) vs. collections.dequeue

2010-01-24 Thread Steve Howell
On Jan 24, 3:20 am, Steven D'Aprano wrote: > On Sun, 24 Jan 2010 02:33:36 -0800, Steve Howell wrote: > > You are also a brilliant computer scientist, despite the fact that you > > are defending a list implemenation that can't pop the first element off > > the list in O(1) time. > > You say that li

Re: py2exe deal with python command line inside a program

2010-01-24 Thread Chris Rebert
On Sun, Jan 24, 2010 at 10:25 AM, im_smialing wrote: > On Jan 24, 6:35 am, Chris Rebert wrote: >> On Sun, Jan 24, 2010 at 3:28 AM, Jonathan Hartley >> wrote: >> > On Jan 22, 7:35 pm, susan_kij...@yahoo.ca wrote: >> >> Hi, >> >> >> I need to create a python subprogress, like this: >> >> myProces

Re: py2exe deal with python command line inside a program

2010-01-24 Thread im_smialing
On Jan 24, 6:35 am, Chris Rebert wrote: > On Sun, Jan 24, 2010 at 3:28 AM, Jonathan Hartley wrote: > > On Jan 22, 7:35 pm, susan_kij...@yahoo.ca wrote: > >> Hi, > > >> I need to create a python subprogress, like this: > >> myProcess = subprocess.Popen([sys.executable, 'C:\myscript.py'], > >>    

Re: Default path for files

2010-01-24 Thread Günther Dietrich
Rotwang wrote: >> Check out http://docs.python.org/library/os.html and the function >> chdir it is what you are looking for. > >Thank you. So would adding > >import os >os.chdir() > >to site.py (or any other module which is automatically imported during >initialisation) change the default locati

Re: py2exe deal with python command line inside a program

2010-01-24 Thread im_smialing
Hi Jonathan, Here is the traceback I got, 'test.py' is where "main" starts, and I replaced 'sys.executable' with string 'python': args: ['python', 'C:\\myscript.py'] Traceback (most recent call last): File "test.py", line 22, in File "subprocess.pyc", line 594, in __init__ File "subproces

Re: simple cgi program

2010-01-24 Thread Aahz
In article <4b531bf9$0$1140$4fafb...@reader1.news.tin.it>, superpollo wrote: > >i would like to submit the following code for review. it is a simple >common gateway interface program, which uses the least possible >libraries for the sake of mechanism undertanding. You should probably factor th

Re: Symbols as parameters?

2010-01-24 Thread George Sakkis
On Jan 22, 8:39 pm, Martin Drautzburg wrote: > Martin Drautzburg wrote: > >> with scope(): > >>     # ... > >>     # use up, down, left, right here > > >> # up, down, left, right no longer defined after the with block exits. > > Just looked it up again. It's a cool thing. Too bad my locals() hack

Re: Consume an iterable

2010-01-24 Thread Jan Kaliszewski
24-01-2010, 18:24:49 Peter Otten <__pete...@web.de> wrote: n=None using n=sys.maxint (consume3) is noticeably faster than 0-maxlen deque (consume1 and consume2): That advantage may not survive the next release: http://svn.python.org/view/python/trunk/Modules/_collectionsmodule.c?r1=68145&r2=7

Re: Splitting text at whitespace but keeping the whitespace in the returned list

2010-01-24 Thread python
MRAB, "MRAB" wrote: > >>> import re > >>> re.split(r'(\s+)', "Hello world!") > ['Hello', ' ', 'world!'] That was exactly (EXACTLY!) the solution I was looking for. Thank you! Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Re: [Edu-sig] some turtle questions

2010-01-24 Thread Helene Martin
I'm almost sure that there's no way for a turtle to know anything about the background. That's an unfortunate limitation! As for putting a limit on a turtle's travel, you need to write an appropriate conditional. For example, if you want your turtle to stay within a 200x200 square centered aroun

Re: Consume an iterable

2010-01-24 Thread Peter Otten
Jan Kaliszewski wrote: > But the corret results even more distinctly support my thesis -- that for > n=None using n=sys.maxint (consume3) is noticeably faster than 0-maxlen > deque (consume1 and consume2): That advantage may not survive the next release: http://svn.python.org/view/python/trunk/M

Re: Symbols as parameters?

2010-01-24 Thread Alf P. Steinbach
* Gabriel Genellina: En Fri, 22 Jan 2010 10:16:50 -0300, Alf P. Steinbach escribió: I get the impression that there's some message traffic that I don't see, perhaps on the mailing list, since (a) I haven't seen that about 'locals' pointed out by anyone else in this thread, and I think I've

Re: Splitting text at whitespace but keeping the whitespace in the returned list

2010-01-24 Thread MRAB
pyt...@bdurham.com wrote: I need to parse some ASCII text into 'word' sized chunks of text AND collect the whitespace that seperates the split items. By 'word' I mean any string of characters seperated by whitespace (newlines, carriage returns, tabs, spaces, soft-spaces, etc). This means that m

Splitting text at whitespace but keeping the whitespace in the returned list

2010-01-24 Thread python
I need to parse some ASCII text into 'word' sized chunks of text AND collect the whitespace that seperates the split items. By 'word' I mean any string of characters seperated by whitespace (newlines, carriage returns, tabs, spaces, soft-spaces, etc). This means that my split text can contain punct

Re: Symbols as parameters?

2010-01-24 Thread Gabriel Genellina
En Fri, 22 Jan 2010 10:16:50 -0300, Alf P. Steinbach escribió: I get the impression that there's some message traffic that I don't see, perhaps on the mailing list, since (a) I haven't seen that about 'locals' pointed out by anyone else in this thread, and I think I've read all messages

Re: how to list the attributes of a class, not an object?

2010-01-24 Thread Jan Kaliszewski
24-01-2010, 17:37:41 Alf P. Steinbach wrote: DictKeys = type( {}.keys() ) dir( DictKeys ) list( vars( DictKeys ) ) help( DictKeys ) It doesn't help much though because the only method of interrest is __iter__ Not only. Please, consider: >>> dictkeys = type({}.keys())

Re: Consume an iterable

2010-01-24 Thread Jan Kaliszewski
Don't the results look suspicious to you? Try measuring with iterator = iter([]) You are obviously right, my brain doesn't work well today :-( But the corret results even more distinctly support my thesis -- that for n=None using n=sys.maxint (consume3) is noticeably faster than 0-maxlen d

Re: how to list the attributes of a class, not an object?

2010-01-24 Thread Alf P. Steinbach
* Robert P. J. Day: On Sun, 24 Jan 2010, Alf P. Steinbach wrote: * Robert P. J. Day: once again, probably a trivial question but i googled and didn't get an obvious solution. how to list the attributes of a *class*? eg., i was playing with dicts and noticed that the type returned by the

Re: Default path for files

2010-01-24 Thread Rotwang
Christian Heimes wrote: Rotwang wrote: import os os.chdir() to site.py (or any other module which is automatically imported during initialisation) change the default location to every time I used Python? First of all you shouldn't alter the site module ever! The optional sitecustomize modu

PS.

2010-01-24 Thread Jan Kaliszewski
24-01-2010, 16:56:42 Jan Kaliszewski wrote: 24-01-2010, 16:28:26 Robert P. J. Day wrote once again, probably a trivial question but i googled and didn't get an obvious solution. how to list the attributes of a *class*? dir(type(an_obj)) or more reliable: list(vars(type(an_ob

Re: Consume an iterable

2010-01-24 Thread Peter Otten
Jan Kaliszewski wrote: > Dnia 23-01-2010 o 15:19:56 Peter Otten <__pete...@web.de> napisał(a): > def consume_islice(n, items): next(islice(items, n, n), None) >> >> One problem: the above function doesn't consume the entire iterator like >> the original example does for n=None. Pass

Re: how to list the attributes of a class, not an object?

2010-01-24 Thread Robert P. J. Day
On Sun, 24 Jan 2010, Alf P. Steinbach wrote: > * Robert P. J. Day: > > once again, probably a trivial question but i googled and didn't > > get an obvious solution. how to list the attributes of a *class*? > > > > eg., i was playing with dicts and noticed that the type returned by > > the key

Re: Default path for files

2010-01-24 Thread Christian Heimes
Rotwang wrote: > import os > os.chdir() > > to site.py (or any other module which is automatically imported during > initialisation) change the default location to every time I used > Python? First of all you shouldn't alter the site module ever! The optional sitecustomize module exists to mak

Re: how to list the attributes of a class, not an object?

2010-01-24 Thread Jan Kaliszewski
24-01-2010, 16:28:26 Robert P. J. Day wrote once again, probably a trivial question but i googled and didn't get an obvious solution. how to list the attributes of a *class*? dir(type(an_obj)) or more reliable: list(vars(type(an_obj))) (dir() uses __dir__ which can be implemente

Re: how to list the attributes of a class, not an object?

2010-01-24 Thread Alf P. Steinbach
* Robert P. J. Day: once again, probably a trivial question but i googled and didn't get an obvious solution. how to list the attributes of a *class*? eg., i was playing with dicts and noticed that the type returned by the keys() method was "dict_keys". so i'm now curious as to the attribu

Re: Default path for files

2010-01-24 Thread Rotwang
Krister Svanlund wrote: On Sun, Jan 24, 2010 at 4:08 PM, Rotwang wrote: Hi all, can anybody tell me whether there's a way to change the default location for files to be opened by open()? I'd like to be able to create files somewhere other than my Python folder without having to write the full p

Re: Consume an iterable

2010-01-24 Thread Jan Kaliszewski
Dnia 23-01-2010 o 15:19:56 Peter Otten <__pete...@web.de> napisał(a): def consume_islice(n, items): next(islice(items, n, n), None) One problem: the above function doesn't consume the entire iterator like the original example does for n=None. Passing sys.maxint instead is not pretty.

some turtle questions

2010-01-24 Thread Brian Blais
Hello, I am trying to think of things to do with the turtle module with my students, and I have some ideas where I am not sure whether the turtle module can do it. 1) is there a way to determine the current screen pixel color? I am thinking about having the turtle go forward until it rea

how to list the attributes of a class, not an object?

2010-01-24 Thread Robert P. J. Day
once again, probably a trivial question but i googled and didn't get an obvious solution. how to list the attributes of a *class*? eg., i was playing with dicts and noticed that the type returned by the keys() method was "dict_keys". so i'm now curious as to the attributes of the dict_keys

Re: Default path for files

2010-01-24 Thread Krister Svanlund
On Sun, Jan 24, 2010 at 4:08 PM, Rotwang wrote: > Hi all, can anybody tell me whether there's a way to change the default > location for files to be opened by open()? I'd like to be able to create > files somewhere other than my Python folder without having to write the full > path in the filename

Default path for files

2010-01-24 Thread Rotwang
Hi all, can anybody tell me whether there's a way to change the default location for files to be opened by open()? I'd like to be able to create files somewhere other than my Python folder without having to write the full path in the filename every time. Sorry if this is a stupid question, I do

Re: ctypes for AIX

2010-01-24 Thread Chris Rebert
On Sun, Jan 24, 2010 at 5:54 AM, Waddle, Jim wrote: > I need to use ctypes with python running on AIX. According to the ctypes readme, ctypes is based on libffi, which according to its website, supports AIX for PowerPC64. So, perhaps you could state what the actual error or problem you're encount

ctypes for AIX

2010-01-24 Thread Waddle, Jim
I need to use ctypes with python running on AIX. It appears that python is being developed mostly for windows. Is there a policy concerning getting functions like ctypes working on AIX. Jim Waddle KIT-D 425-785-5194 -- http://mail.python.org/mailman/listinfo/python-list

Re: How to Embed PHP in HTML print

2010-01-24 Thread NickC
On Sun, 24 Jan 2010 10:37:51 +, Duncan Booth wrote: > content with ajax. Alternatively, use urllib in Python to retrieve a > page from the Apache server and insert that into its own output: that Thanks for hint on urllib. I shake my head in amazement with python sometimes. I'll write it he

Re: ISO module for binomial coefficients, etc.

2010-01-24 Thread Alf P. Steinbach
* Dave Angel: kj wrote: Before I go off to re-invent a thoroughly invented wheel, I thought I'd ask around for some existing module for computing binomial coefficient, hypergeometric coefficients, and other factorial-based combinatorial indices. I'm looking for something that can handle fairly

Re: ISO module for binomial coefficients, etc.

2010-01-24 Thread Dave Angel
kj wrote: Before I go off to re-invent a thoroughly invented wheel, I thought I'd ask around for some existing module for computing binomial coefficient, hypergeometric coefficients, and other factorial-based combinatorial indices. I'm looking for something that can handle fairly large factorial

Re: iterating lists

2010-01-24 Thread Stefan Behnel
Steven D'Aprano, 23.01.2010 18:44: > On Sat, 23 Jan 2010 18:29:33 +0100, Roel Schroeven wrote: > >>> for w in l1[:]: #use copy of l1 for iteration >>> print(l1.pop()) #decomposite list >> I would prefer: >> >> while l1: >> print(l1.pop()) > > > I would prefer: > > for x in reversed(l1):

Re: ISC License

2010-01-24 Thread Joan Miller
On 23 ene, 18:45, a...@pythoncraft.com (Aahz) wrote: > In article > <00eb248d-c9c9-430f-bc83-41ac865c5...@e11g2000yqe.googlegroups.com>, > Joan Miller   wrote: > > > > >There is a license approved by the OSI, the ISC License [1], which > >should be included in the PyPi classifiers [2]. > > >[1]htt

Re: py2exe deal with python command line inside a program

2010-01-24 Thread Chris Rebert
On Sun, Jan 24, 2010 at 3:28 AM, Jonathan Hartley wrote: > On Jan 22, 7:35 pm, susan_kij...@yahoo.ca wrote: >> Hi, >> >> I need to create a python subprogress, like this: >> myProcess = subprocess.Popen([sys.executable, 'C:\myscript.py'], >>                                        env=env, stdin=su

Re: py2exe deal with python command line inside a program

2010-01-24 Thread Jonathan Hartley
On Jan 22, 7:35 pm, susan_kij...@yahoo.ca wrote: > Hi, > > I need to create a python subprogress, like this: > myProcess = subprocess.Popen([sys.executable, 'C:\myscript.py'], >                                        env=env, stdin=subprocess.PIPE, >                                        stdout=su

Re: list.pop(0) vs. collections.dequeue

2010-01-24 Thread Steven D'Aprano
On Sun, 24 Jan 2010 02:33:36 -0800, Steve Howell wrote: > You are also a brilliant computer scientist, despite the fact that you > are defending a list implemenation that can't pop the first element off > the list in O(1) time. You say that like it's a bad thing. It's very simple: the trade-offs

Re: How to Embed PHP in HTML print

2010-01-24 Thread Duncan Booth
NickC wrote: > Some possible ideas: > Is there a way I can get python to call functions within a PHP app? > Perhaps write the plugin in a separate script in PHP, and include that > page within my output so that apache recognises the page inclusion? How > to get apache to pay attention to the o

Re: list.pop(0) vs. collections.dequeue

2010-01-24 Thread Steve Howell
On Jan 23, 8:00 pm, Raymond Hettinger wrote: > [Steve Howell] > > > Why wouldn't you get a competent C programmer simply make > > list_ass_slice smart enough to make list.pop(0) O(1)? > > When this suggestion was discussed on python-dev years ago, > it was rejected.  One reason is that it was some

Re: distutils not finding all of my pure python modules

2010-01-24 Thread Gabriel Genellina
En Thu, 21 Jan 2010 12:41:20 -0300, Jeremy escribió: from distutils.core import setup purePythonModules = ['regex', 'gnuFile'] setup(name='PythonForSafeguards', version='0.9.1', description = 'Python code for MCNP and Safeguards analysis.', author = 'Jake the Snake', author_em

How to Embed PHP in HTML print

2010-01-24 Thread NickC
I am running a Python application under apache web server, executing as a cgi script. Most of the output is print statements that write HTML. I'd like to embed some PHP code within the HTML. The PHP is a gallery plugin script that talks to the core photo gallery application, written in php.

Re: ISO module for binomial coefficients, etc.

2010-01-24 Thread idrevetnom
Maybe this could be of interest : http://tnt.math.metro-u.ac.jp/nzmath/manual/modules/combinatorial.html hope this helps Id -- http://mail.python.org/mailman/listinfo/python-list