Re: Python and (n)curses

2007-06-21 Thread peter
rror prone) it would have been had there been some pre-existing crossplatform module. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Screen Control in WinXP and Linux

2007-04-19 Thread peter
Frederik's examples Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and Tkinter Programming--Expensive!

2007-08-20 Thread peter
that isp subscription about a year ago. But the email I cite there has been abandoned to spam now. Peter -- http://mail.python.org/mailman/listinfo/python-list

Screen Control in WinXP and Linux

2007-04-17 Thread peter
t petulant - not intended, but I am genuinely perplexed as to why this is such a show stopper. Peter -- http://mail.python.org/mailman/listinfo/python-list

Alarming message when running Python code

2007-10-27 Thread peter
the Linux messages spurious, and if so how can I suppress them and ensure they do not slow the running of the code? Grateful for any help - preferably not too technical. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: can't find a way to display and print pdf through python.

2007-02-13 Thread peter
F, for example): > webbrowser.open(r'file://' + fileName) > starts Acrobat Reader with the document read in. I have no idea why, > because Acrobat Reader sure ain't my browser;) > > Maybe someone could try this out on Linux. > > Cheers, > Jussi Works on Ubuntu -- this opens a tab in my browser and then launches Document Viewer to view the PDF. [EMAIL PROTECTED]:~$ python Python 2.4.4c1 (#2, Oct 11 2006, 21:51:02) [GCC 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import webbrowser >>> webbrowser.open(r'file:///home/peter/appa.pdf') >>> -- http://mail.python.org/mailman/listinfo/python-list

How I learned Tkinter

2006-04-23 Thread peter
colleagues, and that in places the documentation is too sparse to be of much help. Any thoughts? Is my experience typical? Peter -- http://mail.python.org/mailman/listinfo/python-list

data entry tool

2006-05-08 Thread Peter
different computers; Win95, Win98, WinXP, Mac, Linux. So, would python be a good choice for this, and how should I go about it? I'm not a programmer and have only done a few little python scripts that run from the command line. TIA Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: data entry tool

2006-05-10 Thread Peter
suggest another language or approach? TIA Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: data entry tool

2006-05-10 Thread Peter
Serge Orlov wrote: > Peter wrote: >> A webapp isn't feasible as most of the users are on dial up (this is in >> New Zealand and broadband isn't available for lots of people). > > I don't see connection here, why it's not feasible? Our volunteers won'

Error messages when using the Console Module

2008-02-15 Thread peter
error messages to assist in diagnosing the problem. At times I have been reduced to writing new code a line at a time! I'm sure there is an easy solution to this problem, but googling has yet to reveal it. Can anyone help? Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Error messages when using the Console Module

2008-02-19 Thread peter
> import sys > sys.stdout = open("stdout.log","w") > sys.stderr = open("stderr.log","w") > print "This goes to stdout" > print >>sys.stderr, "This goes to stderr" > This did the trick. Thanks Peter -- http://mail.python.org/mailman/listinfo/python-list

Embedding Python. But not so easy.

2009-01-19 Thread Peter
implement this with the python interpreter. I am hoping to be proven wrong Thanks in advance Greets Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Embedded python 2.6 interpreter can't "import sqlite3" on Windows XP

2009-02-01 Thread Peter
ools that create embedded python applications could better document this issue, so that people using embedded applications will know that they have to install the proper run time libraries. It's also possible that Microsoft will someday install these new Visual Studio 2008 run time libraries via their update service or a future service pack. Peter -- http://mail.python.org/mailman/listinfo/python-list

datetime objects and __new__()

2008-11-25 Thread peter
aware of the problems of using datetime and timestamps) Could some kind soul please enlighten me? peter. -- http://mail.python.org/mailman/listinfo/python-list

Re: datetime objects and __new__()

2008-11-25 Thread peter
On Nov 25, 3:46 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > peter wrote: > >>>> import datetime > >>>> class ts(datetime.datetime): > > ...     foo = 'bar' > > ...     def __new__(cls, s): > > ...         c = super(ts, cls

Re: datetime objects and __new__()

2008-11-25 Thread peter
On Nov 25, 4:39 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > peter wrote: > > On Nov 25, 3:46 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > >> peter wrote: > >> >>>> import datetime > >> >>>> class ts(datetime

Re: end of print = lower productivity ?

2008-11-25 Thread peter
On Nov 25, 4:44 pm, [EMAIL PROTECTED] wrote: > I want my productivity back. > > In Python 2.x, I could easily write things like -- print "f" / print > "add" / print "done" -- to a lot of different places in my code, which > allowed me to find bugs that I could not track otherwise. When I found > ou

Re: datetime objects and __new__()

2008-11-25 Thread peter
On Nov 25, 5:16 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > peter wrote: > >> >>> from datetime import * > >> >>> class TS(datetime): > > >> ...     def __new__(cls, ts): > >> ...             return datetime.fromtimesta

Re: pyserial and file open conflict?

2008-05-23 Thread Peter
On 15 Maj, 19:37, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-05-15, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > I have a small but rather annoying problem withpyserial. I want to > > open a file on disk for reading and then open a com-port, write lines > > from the file to the port a

post-mortem from core dump

2008-06-09 Thread peter
AFAIK pdb only can do postmortem debugging if fed a Python stack trace. Is there any way to obtain such a stack trace if all you've got is a core dump? Or, put another way: can I do post-mortem debugging from a core dump? Thanks, peter. -- http://mail.python.org/mailman/listinfo/python-list

Re: post-mortem from core dump

2008-06-10 Thread peter
Bump Has noone ever needed this? On Jun 9, 10:58 am, peter <[EMAIL PROTECTED]> wrote: > AFAIK pdb only can do postmortem debugging if fed a Python stack > trace. Is there any way to obtain such a stack trace if all you've got > is a core dump? > > Or, put another

question about nasty regex

2006-04-03 Thread Peter
I'm wondering if someone can tell me whether the following set of regex substitutions is possible. I want to convert parallel legal citations into single citations. What I mean is, I want to change, e.g.: "Doremus v. Board of Education of Hawthorne, 342 U.S. 429, 434, 72 S. Ct. 394, 397, 96 L.E

Re: question about nasty regex

2006-04-03 Thread Peter
Tim Chase wrote: >> What I mean is, I want to change, e.g.: [snip regular expressions lesson] > Whoa. That is super-duper extra cool. Thank you *very* much. -- http://mail.python.org/mailman/listinfo/python-list

testing command line scripts that use optparse

2009-12-03 Thread Peter
ython2.6/optparse.py", line 1578, in error self.exit(2, "%s: error: %s\n" % (self.get_prog_name(), msg)) File "/usr/local/python2.6/lib/python2.6/optparse.py", line 1568, in exit sys.exit(status) SystemExit: 2 >> begin captured stdout <<

AttributeError: logging module bug ?

2009-12-15 Thread Peter
r-man's Singleton Logger class ( see Python Cookbook 2nd edition p.275), so I rebind 'logger' to the only instance of its class. What's the problem ? Thanks Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: AttributeError: logging module bug ?

2009-12-15 Thread Peter
What's the problem ? Please provide the config file "logging.cfg" to ease debugging. Peter Here it is, thanks for having a look Peter # supports no whitespace !!! [DEFAULT] logdir=/tmp logfile=python logging_server=localhost [loggers] keys=root,module,class,data

Re: AttributeError: logging module bug ?

2009-12-18 Thread Peter
you want external help please (1) make sure that you provide all necessary files needed to reproduce the error (2) remove as much of the code as possible that does not contribute to the problem. (This is also an effective debugging technique) Peter (1), (2): That is sometimes easier said than

Re: AttributeError: logging module bug ?

2009-12-21 Thread Peter
On 12/21/2009 08:35 AM, Gabriel Genellina wrote: En Sat, 19 Dec 2009 00:18:26 -0300, Peter escribió: This was somehow unexpected for me, since in a module using logger.py, I could use either import: from mylogger import logger # without package name or from of.mylogger import logger

Recommended "new" way for config files

2010-01-07 Thread Peter
be prefered for new projects ? thanks peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Recommended "new" way for config files

2010-01-07 Thread Peter
for myself, I am using python coded configuration files, but: we all worship python in the team and thus are familiar with it. so do I. JM So what is the "worshipped" approach, when you need more than name=value pairs ? Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Python books, literature etc

2010-01-07 Thread Peter
a rather large opensource library for natural language processing ( sorry forgot the exact name,but easy to find on the net) All these book make you feel warm and confortable if you have ever tried to do these things in Perl, C++ or Java Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Recommended "new" way for config files

2010-01-07 Thread Peter
have additional .ini files, ,possibily several in different locations, for simpler options in name,value format. Has anybody experiences with other tools that use this approach ? Peter -- http://mail.python.org/mailman/listinfo/python-list

restructuredText editor ?

2010-01-08 Thread Peter
What editor do people out there use to edit .rst files for sphinx-python documentation ? Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Scripting (was Re: Python books, literature etc)

2010-01-08 Thread Peter
turned out that the point is not "scripting versus not scripting" or "static versus dynamic typing" but having automatic unittests or not having automatic unittests. My most important module is "nose" for running unittests the easy way. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Recommended "new" way for config files

2010-01-08 Thread Peter
On 01/08/2010 03:57 PM, r0g wrote: Chris Rebert wrote: On Thu, Jan 7, 2010 at 10:19 AM, Peter wrote: The .ini file is the simpliest solution, at least from the user point of view, no need to learn any python syntax. I am speaking from the point of view of a python

Re: restructuredText editor ?

2010-01-09 Thread Peter
On 01/09/2010 03:32 AM, Florian Diesch wrote: Peter writes: What editor do people out there use to edit .rst files for sphinx-python documentation ? Emacs with ReST mode and YASnippet Florian Great, works very well and thanks for mentionning YASnippets ( useful for many

Re: Python and Tkinter Programming by John Grayson

2010-01-13 Thread Peter
ducing GUIs using Python and Tkinter - so it still does an excellent job for that even though I have abandoned the GUI application framework that John provides in his book (I used it once for my first GUI, but these days use Pmw more for my GUIs). Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and Tkinter Programming by John Grayson

2010-01-14 Thread Peter
On Jan 15, 6:24 am, Mark Roseman wrote: >  Peter wrote: > > Besides, the book is mainly about using Python with Tkinter - and > > Tkinter hasn't changed that much since 2000, so I believe it is just > > as relevant today as it was back then. > > I'd say t

Re: thread return code

2010-01-19 Thread Peter
prior to exit. After the join() just read the results from the queue. Using a queue or pipe is just a suggestion, the multiprocessing module offers numerous ways to communicate between tasks, have a read and pick whatever mechanism seems appropriate for your situation. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and Tkinter Programming by John Grayson

2010-01-21 Thread Peter
On Jan 15, 9:12 am, Kevin Walzer wrote: > On 1/14/10 3:39 PM, Peter wrote: > > > > > > > On Jan 15, 6:24 am, Mark Roseman  wrote: > >>   Peter  wrote: > >>> Besides, the book is mainly about using Python with Tkinter - and > >>> Tkinter has

Re: Wrap a function

2010-01-28 Thread Peter
uld be to run everything in a loop i.e. place all the commands into a list and create a loop that ran each command in the list. Almost all editors support macros - most editors support some form of language sensitive editing (NOT the prompt call parameters style but rather help with the syntax via a 'form' style of fill-in) that will allow you to reduce typing effort. But macros would be the first and easiest choice for this activity. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Your impression of for-novice writings on assertions

2010-02-02 Thread Peter
e (x, y): return x / y The programmer obviously assumed that y will never be 0 - so with one simple example you teach two points: 1. how an assert can be used 2. when programming look for unconscious assumptions Peter P.S. You also raise an interesting issue in my mind when quoting Knuth and sit

Re: Is a merge interval function available?

2010-02-11 Thread Peter
this list so they can propose something else. They can also grade the submissions against the code kept in this area - exact copies could receive an "F" (for example :-)) Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: RELEASED Python 2.6.5

2010-03-23 Thread peter
hout any problems and used the advanced compile option. Is anyone else having trouble with the 2.6.5 Windows x86 installer? Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: RELEASED Python 2.6.5

2010-03-25 Thread Peter
:\bin\Python26\Lib" So it appears that the Windows XP shell is interpreting the "|" characters within the -x option's args as pipe characters and trys to pipe the "multiple commands" together. The simple work around is to not use the Advanced compiling option. Peter -- http://mail.python.org/mailman/listinfo/python-list

Archiving Modules

2011-02-16 Thread peter
ed it for the zipfiles by using zipfile.getinfo to read the original date then os.utime to rewrite it. It seems rather messy - have I missed something simple like a flag setting within zipfile? Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Archiving Modules

2011-02-18 Thread peter
ely readable forever, and to be that > they need to be in a widely used, open format. I agree, but if a file is only available as a rar archive I would like to be able to extract it without using another 3rd party application. peter -- http://mail.python.org/mailman/listinfo/python-list

Scope (?) question

2010-06-15 Thread Peter
X(): execfile('test-data.py') print data where test-data.py is: data = [1,2,3,4] I checked help on execfile and could only find the following (mystifying) sentence: "execfile() cannot be used reliably to modify a function’s locals." Thanks Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Scope (?) question

2010-06-15 Thread Peter
This one seems to do the trick - thanks! :-) On Jun 16, 10:12 am, Inyeol Lee wrote: > On Jun 15, 3:22 pm, Peter wrote: > > > > > > > I am puzzled by what appears to be a scope issue - obviously I have > > something wrong :-) > > > Why does this work: >

Re: Q for Emacs users: code-folding (hideshow)

2010-07-15 Thread Peter
de to work with. One day when I have run out of other (programming) things to do I might investigate this :-) Anybody else now of any better ideas or whatever? Now that I think about it, I wouldn't mind using folding mode if I could make it "easier" to use myself! :-) Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: How to Learn Lambda Calculus: A Guide

2010-07-15 Thread Peter
On Jul 16, 6:40 am, Nonpython wrote: > 1: Try to learn lambda calculus > 2: Fail to learn lambda calculus > 3: Sit in corner rocking > 4: Consider suicide. You forgot: 5: (quietly) drooling But then that might be part of the advanced course? I really can't remember, my PHD in 'lambda calculus'

Pickle MemoryError - any ideas?

2010-07-20 Thread Peter
out getting a MemoryError This seems like a bug in pickle? Any ideas (other than the obvious - don't save all of these files contents into a list! Although that is the only "answer" I can see at the moment :-)). Thanks Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is python not written in C++ ?

2010-08-02 Thread Peter
n't seem to know any better, but then the signs of the breakdown of society surround us on a daily basis and I guess C++ is just another signpost on the way... Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is python not written in C++ ?

2010-08-02 Thread Peter
from the very beginning - something that many programmers find an abhorrence for :-) But I always used to tell people - by the time I got a program to compile then I figured 99% of the bugs were already discovered! Try that with C/C++ or almost any other language you care to name :-) Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: python interview quuestions

2010-08-08 Thread Peter
On Aug 9, 6:49 am, Terry Reedy wrote: > On 8/7/2010 7:53 AM, Peter Otten wrote: > > > > > You mean you'd go for the candidate who took the conservative approach and > > got it right: > > > print 1 > > print 2 > > print 'Fizz' > >

Re: python interview quuestions

2010-08-08 Thread Peter
On Aug 9, 10:39 am, Steven D'Aprano wrote: > On Sun, 08 Aug 2010 17:28:59 -0700, Peter wrote: > > On Aug 9, 6:49 am, Terry Reedy wrote: > >> On 8/7/2010 7:53 AM, Peter Otten wrote: > > >> > You mean you'd go for the candidate who took the co

Re: python interview quuestions

2010-08-10 Thread Peter
id not match. This was one of the many reasons why I decided on a career change and went back to being a dumb and happy programmer! That was 14 years ago now and I haven't regretted the decision one single day of that time :-) Peter On Aug 11, 6:44 am, J Kenneth King wrote: > James Mill

Re: most popular gui framework for python

2010-08-11 Thread Peter
tform compatibility may not be such a big deal. I would strongly recommend reading the Python Wiki page on GUI programming: http://wiki.python.org/moin/GuiProgramming Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: python interview quuestions

2010-08-11 Thread Peter
g them for you - big investment for zero return. So I would recommend to anybody that they attempt to maintain a stable work history in this respect. For example, my personal work history is 8, 7.5, 8.5, 0.5, 3, 3, 8 (years that is). My current company is extremely stable, I enjoy the work, so I don't see any reason why I won't be here until I retire (or die at my desk - whichever comes first :-)). Peter -- http://mail.python.org/mailman/listinfo/python-list

Python Imaging Library download link broken?

2009-06-27 Thread peter
Just got a new computer and I'm trying to download my favourite applications. All's well until I get to PIL, and here pythonware and effbot both return a 502 Proxy error. Is this just a temporary glitch, or something more serious? And if it's the latter, is there any alternative

Re: Python Imaging Library download link broken?

2009-06-29 Thread peter
Whilst this is an interesting discussion about installers, I'm still trying to find a copy of PIL. Any ideas? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Imaging Library download link broken?

2009-06-29 Thread peter
Thanks for this - looks promising. But I've just tried pythonware again and it's back up - so it was just a glitch after all. Peter -- http://mail.python.org/mailman/listinfo/python-list

How to use Python to interface with Web pages?

2009-07-07 Thread Peter
o even start on this one. Thanks for any help/pointers Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Using freeze.py's output and compiling in Windows

2009-09-10 Thread Peter
tup = good combination! :-) Hope this helps Peter -- http://mail.python.org/mailman/listinfo/python-list

xlrd+excel determine decimal separator

2009-09-17 Thread peter
Hi experts, i want to ask you if somebody knows how can I determine, with a help of xlrd, what kind of decimal separator (. or ,) does the user have. Thx in advance. Rg, Peter -- http://mail.python.org/mailman/listinfo/python-list

Customising Tk widgets

2010-09-20 Thread Peter
this? Also, John Shipman's Tkinter reference shows the Radiobutton drawn as a diamond and yet when I create one in Windows I get a circle - again, how and where do I need to look to change this behaviour? Thanks Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Nautilus Python

2010-09-27 Thread Peter
On Sep 28, 12:31 pm, Steven D'Aprano wrote: > On Mon, 27 Sep 2010 15:28:34 -0700, Eduardo Ribeiro wrote: > > But it doesn't work. > > What do you mean "doesn't work"? > > - It crashes the operating system; > - You get a core dump; > - You get an exception; > - It hangs forever, never doing anythin

Re: python backup script

2013-05-06 Thread Peter Otten
2, 22:15:08) [GCC 4.6.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from ConfigParser import ConfigParser >>> p = ConfigParser() >>> p.read("~/tmp.config") [] >>> import os >>> p.read(os.path.expanduser("~/tmp.config")) ['/home/peter/tmp.config'] -- http://mail.python.org/mailman/listinfo/python-list

Re: formatted output

2013-05-07 Thread Peter Otten
Roy Smith wrote: > In article , > Sudheer Joseph wrote: > >> Dear members, >> I need to print few arrays in a tabular form for example >> below array IL has 25 elements, is there an easy way to print >> this as 5x5 comma separated table? in python >> >> IL=[

Re: Getting ASCII encoding where unicode wanted under Py3k

2013-05-13 Thread Peter Pearson
On Mon, 13 May 2013 10:59:33 -0500, Jonathan Hayward wrote: > --e89a8f3b9db145cbab04dc9b9a23 > Content-Type: text/plain; charset=windows-1252 > Content-Transfer-Encoding: quoted-printable > [snipped many lines of quoted-printable muck] > My code is below. What should I be doing differently to be,

Re: Diacretical incensitive search

2013-05-17 Thread Peter Otten
Olive wrote: > One feature that seems to be missing in the re module (or any tools that I > know for searching text) is "diacretical incensitive search". I would like > to have a match for something like this: > > re.match("franc", "français") > > in about the same whay we can have a case incens

Re: Please help with Threading

2013-05-18 Thread Peter Otten
Jurgens de Bruin wrote: > This is my first script where I want to use the python threading module. I > have a large dataset which is a list of dict this can be as much as 200 > dictionaries in the list. The final goal is a histogram for each dict 16 > histograms on a page ( 4x4 ) - this already w

Re: Please help with Threading

2013-05-18 Thread Peter Otten
Jurgens de Bruin wrote: > I will post code - the entire scripts is 1000 lines of code - can I post > the threading functions only? Try to condense it to the relevant parts, but make sure that it can be run by us. As a general note, when you add new stuff to an existing longish script it is alw

Re: TypeError: unbound method add() must be called with BinaryTree instance as first argument (got nothing instead)

2013-05-18 Thread Peter Otten
Dan Stromberg wrote: > I'm getting the error in the subject, from the following code: > def add(self, key): > """ > Adds a node containing I{key} to the subtree > rooted at I{self}, returning the added node. > """ > node = self.find(key) > if not

Re: TypeError: unbound method add() must be called with BinaryTree instance as first argument (got nothing instead)

2013-05-18 Thread Peter Otten
Dan Stromberg wrote: > python 2.x, python 3.x and pypy all give this same error, though jython > errors out at a different point in the same method. By the way, 3.x doesn't have unbound methods, so that should work. -- http://mail.python.org/mailman/listinfo/python-list

Re: mutable ints: I think I have painted myself into a corner

2013-05-19 Thread Peter Otten
Cameron Simpson wrote: > TL;DR: I think I want to modify an int value "in place". > > Yesterday I was thinking about various "flag set" objects I have > floating around which are essentially bare "object"s whose attributes > I access, for example: > > flags = object() > flags.this = True >

Re: Python Windows release and encoding

2013-05-22 Thread Peter Otten
Absalom K. wrote: > Hi, I am working on Linux; a friend of mine sends to me python files from > his Windows release. He uses the editor coming with the release; he runs > his code from the editor by using a menu (or some F5 key I think). > > He doesn't declare any encoding in his source file; whe

Re: newbie question about subprocess.Popen() arguments

2013-05-23 Thread Peter Otten
Alex Naumov wrote: > I'm trying to call new process with some parameters. The problem is that > the last parameter is a "string" that has a lot of spaces and different > symbols like slash and so on. I can save it in file and use name of this > file as parameter, but my question is: how to make it

Re: Scope of a class..help???

2013-05-23 Thread Peter Otten
lokeshkopp...@gmail.com wrote: > i had written the following code i am unable to create the instance of the > class "Node" in the method "number_to_LinkedList" can any one help me how > to do ?? and what is the error?? > > > class Node: > def __init__(self, value=None): > self.valu

Simple algorithm question - how to reorder a sequence economically

2013-05-24 Thread Peter Brooks
What is the easiest way to reorder a sequence pseudo-randomly? That is, for a sequence 1,2,3,4 to produce an arbitrary ordering (eg 2,1,4,3) that is different each time. I'm writing a simulation and would like to visit all the nodes in a different order at each iteration of the simulation to remo

Using ACLs in JSON

2013-05-24 Thread Peter Brooks
I'm designing a system that should allow different views to different audiences. I understand that I can use application logic to control the access security, but it seems to me that it'd make more sense to have this documented in the data-stream so that it's data-driven. I was wondering if there

Re: Simple algorithm question - how to reorder a sequence economically

2013-05-24 Thread Peter Brooks
Thank you all for those most helpful suggestions! random.shuffle does precisely the job that I need quickly. Thank you for introducing me to itertools, though, I should have remembered APL did this in a symbol or two and I'm sure that itertools will come in handy in future. Thanks for the warnings

Re: Simple algorithm question - how to reorder a sequence economically

2013-05-24 Thread Peter Brooks
On May 24, 5:00 pm, Carlos Nepomuceno wrote: > > > I don't know what "spurious evidence of correlation" is. Can you give a > mathematical definition? > If I run the simulation with the same sequence, then, because event E1 always comes before event E2, somebody might believe that there is a causa

Re: Using ACLs in JSON

2013-05-24 Thread Peter Brooks
On May 24, 6:42 pm, Michael Torrie wrote: > On 05/24/2013 02:18 AM, Peter Brooks wrote: > > > I'm designing a system that should allow different views to different > > audiences. I understand that I can use application logic to control > > the access security, but

Re: Using ACLs in JSON

2013-05-24 Thread Peter Brooks
On May 24, 6:13 pm, Carlos Nepomuceno wrote: > Not exactly what you want but you may consider Google ACL XML[1]. > > If there aren't any system integration restrictions you can do what you think > it's best... for now. > > [1]https://developers.google.com/storage/docs/accesscontrol#applyacls > Th

Re: Simple algorithm question - how to reorder a sequence economically

2013-05-24 Thread Peter Brooks
On May 24, 11:33 pm, Carlos Nepomuceno wrote: > > > > > > > > > > > > Date: Fri, 24 May 2013 12:01:35 -0700 > > Subject: Re: Simple algorithm question - how to reorder a sequence > > economically > > From: peter.h.m.bro...@gmail.com > > To: python-l...@pyt

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Peter Otten
Νίκος Γκρ33κ wrote: > Hello this is the following snippet that is causing me the error i mention > in the Subject: > print( " color=tomato size=5> %s " ) % (url, url) Hint (Python 3): >>> print("a=%s, b=%s") % (1, 2) a=%s, b=%s Traceback (most recent call last): File "", line 1, in TypeError

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

2013-05-26 Thread Peter Otten
Νίκος Γκρ33κ wrote: > Thank you very much Peter, so as it seems in Python 3.3.1 all > substitutuons must be nested in print(). Yes; in other words: In Python 3 print() is a function. -- http://mail.python.org/mailman/listinfo/python-list

Solving the problem of mutual recursion

2013-05-26 Thread Peter Brooks
I'm not sure if this'll interest anybody, but I expect that I'm going to get some mutual recursion in my simulation, so I needed to see how python handled it. Unfortunately, it falls over once it detects a certain level of recursion. This is reasonable as, otherwise, the stack eventually over-fills

Re: Error when trying to sort and presnt a dictionary in python 3.3.1

2013-05-26 Thread Peter Otten
Νίκος Γκρ33κ wrote: > python3 pelatologio.py gives me error in this line: > > Traceback (most recent call last): > File "pelatologio.py", line 283, in > ''' % (months[key], key) ) > KeyError: 1 > > The code is: > > #populating months into a dropdown menu > years = ( 2010, 2011,

Re: Solving the problem of mutual recursion

2013-05-26 Thread Peter Brooks
On May 26, 5:09 pm, Jussi Piitulainen wrote: > > A light-weighter way is to have each task end by assigning the next > task and returning, instead of calling the next task directly. When a > task returns, a driver loop will call the assigned task, which again > does a bounded amount of work, assig

Re: Solving the problem of mutual recursion

2013-05-26 Thread Peter Brooks
On 26 May, 20:09, Carlos Nepomuceno wrote: > > > > > > > > > > > > Date: Sun, 26 May 2013 10:21:05 -0700 > > Subject: Re: Solving the problem of mutual recursion > > From: peter.h.m.bro...@gmail.com > > To: python-l...@python.org > > > On May 26, 5:09 pm, J

Re: Solving the problem of mutual recursion

2013-05-26 Thread Peter Brooks
On 26 May, 20:22, Carlos Nepomuceno wrote: > > > > Date: Sun, 26 May 2013 11:13:12 -0700 > > Subject: Re: Solving the problem of mutual recursion > > From: peter.h.m.bro...@gmail.com > > To: python-l...@python.org > [...] > >> How can you get 140% of CPU? I

Re: Solving the problem of mutual recursion

2013-05-26 Thread Peter Brooks
On May 27, 12:16 am, Chris Angelico wrote: > On Mon, May 27, 2013 at 5:35 AM, Ian Kelly wrote: > > I'm pretty sure that CPython uses the GIL regardless of platform.  And > > yes you can have multiple OS-level threads, but because of the GIL > > only one will actually be running at a time.  Other

Re: IndentationError: expected an indented block but it's there

2013-05-28 Thread Peter Otten
JackM wrote: > Having a problem getting a py script to execute. Got this error: > > File "/scripts/blockIPv4.py", line 19 > ip = line.split(';')[0] > ^ > IndentationError: expected an indented block > > > I'm perplexed because the code that the error refers to *is* indented: > > >

Re: IndentationError: expected an indented block but it's there

2013-05-28 Thread Peter Otten
Chris Angelico wrote: > On Wed, May 29, 2013 at 2:19 AM, Peter Otten <__pete...@web.de> wrote: >> Solution: configure your editor to use four spaces for indentation. > > ITYM eight spaces. I meant: one hit of the Tab key should add spaces up to the next multiple of four.

Re: Piping processes works with 'shell = True' but not otherwise.

2013-05-31 Thread Peter Otten
Luca Cerone wrote: >> >> That's because stdin/stdout/stderr take file descriptors or file >> >> objects, not path strings. >> > > Thanks Chris, how do I set the file descriptor to /dev/null then? For example: with open(os.devnull, "wb") as stderr: p = subprocess.Popen(..., stderr=stderr)

Re: Surprising difference between StringIO.StringIO and io.StringIO

2013-05-31 Thread Peter Otten
Serhiy Storchaka wrote: > 30.05.13 23:46, Skip Montanaro написав(ла): >> Am I missing something about how io.StringIO works? I thought it was >> a more-or-less drop-in replacement for StringIO.StringIO. > > io.StringIO was backported from Python 3. It is a text (unicode) stream. > cStringIO.Stri

Re: Beginner question

2013-06-04 Thread Peter Otten
Chris Angelico wrote: > On Tue, Jun 4, 2013 at 5:57 PM, John Ladasky > wrote: >> On Tuesday, June 4, 2013 12:45:38 AM UTC-7, Anssi Saari wrote: >> >>> BTW, did I get the logic correctly, the end result is random? >> >> You're right! I'm guessing that's not what the OP wants? > > I'm guessing th

<    1   2   3   4   5   6   7   8   9   10   >