Re: execution speed increase after compile py code into exe?

2007-03-24 Thread Paul Rudin
Kelie <[EMAIL PROTECTED]> writes: > hello, > > would there be any speed increase in code execution after python code being > compiled into exe file with py2exe? AIUI that's not what p2yexe is about - it's essentially about packaging up your python program for ease of distribution and installation

Re: Idiom for running compiled python scripts?

2007-03-25 Thread Paul Rudin
Mark <[EMAIL PROTECTED]> writes: > Of course I realise the modern mantra that "premature optimisation is > the root of all evil" but I don't subscribe to it. Programmers have been > "encouraged" to not give a toss about efficiency and the outcome is all > too apparent - most software today looks

Re: Game programming for kids: looking for open source 2D game development kit

2007-03-30 Thread Paul Rudin
John Salerno <[EMAIL PROTECTED]> writes: > Laurent Pointal wrote: > >> With Python: >> * pygame + build your drag'n drop features >> * if you like 3D, vpython. >> >> >> http://www.pygame.org/ >> http://www.vpython.org/ > > Wow, vpython looks pretty need. I'm messing around with it right now > and

Re: how to join array of integers?

2007-09-16 Thread Paul Rudin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Sat, 15 Sep 2007 15:56:40 +0200, Arnau Sanchez wrote: > >> js escribió: >> On 9/15/07, Summercool <[EMAIL PROTECTED]> wrote: >> in Python... is the method to use ",".join() ? but then it must take a list of strings... not integers

Re: how to join array of integers?

2007-09-17 Thread Paul Rudin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Sun, 16 Sep 2007 19:25:22 +0100, Paul Rudin wrote: > >>> The generator expression takes about twice as long to run, and in my >>> opinion it is no more readable. So what's the advantage? >> >> If

Re: How to assign a function to another function

2007-09-17 Thread Paul Rudin
Stefano Esposito <[EMAIL PROTECTED]> writes: > Hi all > > what i'm trying to do is this: > def foo (): > ... return None > ... def bar (): > ... print "called bar" > ... def assigner (): > ... foo = bar > ... assigner() foo() > called bar > > This piece of code is no

Re: can Python be useful as functional?

2007-09-18 Thread Paul Rudin
Lorenzo Stella <[EMAIL PROTECTED]> writes: > Hi all, > I haven't experienced functional programming very much, but now I'm > trying to learn Haskell and I've learned that: 1) in functional > programming LISTS are fundmental; 2) any "cycle" in FP become > recursion. > I also know that Python got so

Re: can Python be useful as functional?

2007-09-18 Thread Paul Rudin
Robin Becker <[EMAIL PROTECTED]> writes: > Steve Holden wrote: >> Lorenzo Stella wrote: > .. >> So, which environment do you habitually use that provides an >> *unlimited* stack? >> >> You remind me of the conversation between the philosopher and an >> attractive lady whom he was seated next t

Re: super() doesn't get superclass

2007-09-18 Thread Paul Rudin
Ben Finney <[EMAIL PROTECTED]> writes: > Possibly the name 'next_in_mro', while ugly, would at least match the > actual behaviour of this function. In common lisp there's (call-next-method ...) -- http://mail.python.org/mailman/listinfo/python-list

Re: An Editor that Skips to the End of a Def

2007-09-20 Thread Paul Rudin
"W. Watson" <[EMAIL PROTECTED]> writes: > Is there an editor that allows one to position to put the cursor and > then by pushing some button goes to the end of the def? C-M-e in emacs/python-mode. -- http://mail.python.org/mailman/listinfo/python-list

Re: An Editor that Skips to the End of a Def

2007-09-20 Thread Paul Rudin
"W. Watson" <[EMAIL PROTECTED]> writes: > Thanks, but no thanks. The learning curve is way too steep. Up to you but, these days emacs comes with all sorts of pointing-clicky-menu-y type things - you don't really have to learn anything to get started. (It even gives useful advice on top-posting i

Re: acronym program

2007-09-21 Thread Paul Rudin
Shawn Minisall <[EMAIL PROTECTED]> writes: > I'm trying to write a program that gets the first letter of every word > of a phrase and prints it on screen. I'm having problems with it. > I'm thinking a for loop would be good since I don't know the exact > number of words the user is going to enter

Re: obtaining multiple values from a function.

2007-09-25 Thread Paul Rudin
Ben Finney <[EMAIL PROTECTED]> writes: > > If, instead, it makes sense for the results to be iterated over, you > can write a function that yields results one at a time, without > necessarily knowing in advance what the entire set will be:: > > >>> def fib(max_result): Going off on a tangent

Re: obtaining multiple values from a function.

2007-09-25 Thread Paul Rudin
Carsten Haese <[EMAIL PROTECTED]> writes: > ... > That's not the Fibonacci sequence. Bah, you're right of course, I should be more more careful before posting these things. -- http://mail.python.org/mailman/listinfo/python-list

Re: novice list

2007-10-05 Thread Paul Rudin
István <[EMAIL PROTECTED]> writes: > Could somebody suggest me a novice Python list, please? Here you go: ['novice'] (Sorry, couldn't resist.) -- http://mail.python.org/mailman/listinfo/python-list

logging module - restricted mode error

2007-10-15 Thread Paul Rudin
I'm occasionally seeing tracebacks like this: Traceback (most recent call last): File "logging/__init__.py", line 744, in emit File "logging/__init__.py", line 630, in format File "logging/__init__.py", line 421, in format RuntimeError: instance.__dict__ not accessible in restricted mode I

Re: logging module - restricted mode error

2007-10-21 Thread Paul Rudin
Vinay Sajip <[EMAIL PROTECTED]> writes: > On 16 Oct, 04:14, Paul Rudin <[EMAIL PROTECTED]> wrote: >> I'm occasionally seeing tracebacks like this: >> >> Traceback (most recent call last): >> File "logging/__init__.py", line 744, in emi

Re: Check File Change Every 10 Seconds

2007-10-22 Thread Paul Rudin
Marco Mariani <[EMAIL PROTECTED]> writes: > Robert Rawlins - Think Blue wrote: > >> That certainly looks to be the type of thing that I'm looking to achieve, >> however, I forgot to mention I'm running this on a Linux platform and not a >> Win32 one :-( Sorry. > > Did you try python-gamin? > > "

Re: Iteration for Factorials

2007-10-22 Thread Paul Rudin
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > On Oct 22, 7:50 am, Duncan Booth <[EMAIL PROTECTED]> wrote: >> Py-Fun <[EMAIL PROTECTED]> wrote: >> > I'm stuck trying to write a function that generates a factorial of a >> > number using iteration and not recursion. Any simple ideas would be >>

Re: Iteration for Factorials

2007-10-22 Thread Paul Rudin
[EMAIL PROTECTED] writes: > On 22 oct, 20:35, Paul Rudin <[EMAIL PROTECTED]> wrote: > >> import operator >> def fact(x): >> return reduce(operator.mul, xrange(1,x)) > > Maybe: > > import operator > def fact(x): > return reduce(op

mod_python and Content-Type

2007-01-13 Thread Paul Rudin
I'm have a little experiment with mod_python. I'm trying to figure out how to get hold of the original Content-Type header. In my config file I have: AddHandler mod_python .py PythonHandler atomserv PythonDebug On PythonAutoReload On The file atomserv.py in that

Re: mod_python and Content-Type

2007-01-13 Thread Paul Rudin
"Graham Dumpleton" <[EMAIL PROTECTED]> writes: > All headers which come from the client are available through the > 'headers_in' > attribute of the request object. Eg. > > def handler(req): > ct = req.headers_in.get('Content-Type') > ... Thanks - it's even mentioned in the mod_python m

Re: Python good for data mining?

2007-11-05 Thread Paul Rudin
Maarten <[EMAIL PROTECTED]> writes: > > "Premature optimization is the root of all evil", to quote a famous > person. And he's right, as most people working larger codes will > confirm. > But note that it's "premature optimization...", not "optimization..." :) -- http://mail.python.org/mailman/

Re: Looking for a good Python environment

2007-11-10 Thread Paul Rudin
jwelby <[EMAIL PROTECTED]> writes: > This is a fair question. I didn't phrase my post too well. > > I find PyScripter does pretty much everything I need in terms of doing > actual development for Python. My use of 'lightweight' is by no means > a criticism of PyScripter - it's more of a complimen

Re: logging and propagation

2007-11-21 Thread Paul Rudin
oj <[EMAIL PROTECTED]> writes: > Hi, > > I want to setup logging with two loggers: > > The child logger is used when something different needs to be done > with the log record, and the log record will propagate and be logged > by the root logger as usual. > > However, there are certain times when

Re: logging and propagation

2007-11-21 Thread Paul Rudin
oj <[EMAIL PROTECTED]> writes: > On Nov 21, 11:48 am, Paul Rudin <[EMAIL PROTECTED]> wrote: >> Loggers have a "propagate" attribute. If you set this to False in the >> child then you should get what you want I think. > > No, because I want message to p

Re: better way to write this function

2007-11-26 Thread Paul Rudin
Kelie <[EMAIL PROTECTED]> writes: > Hello, > > This function does I what I want. But I'm wondering if there is an > easier/better way. To be honest, I don't have a good understanding of > what "pythonic" means yet. > > def divide_list(lst, n): > """Divide a list into a number of lists, each wi

Re: How to Teach Python "Variables"

2007-11-28 Thread Paul Rudin
none <""atavory\"@(none)"> writes: > IIRC, I once saw an explanation how Python doesn't have > "variables" in the sense that, say, C does, and instead has bindings > from names to objects. Does anyone have a link? "Variable" is an abstract concept, and it's a slightly different concept for

Re: Unexpected behavior when initializing class

2007-11-28 Thread Paul Rudin
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Hello everybody, > > I've banged my ahead around for a while trying to figure out why > multiple instances of a class share the same instance variable. I've > stripped down my code to the following, which reproduces my problem. > > class Test(

Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Paul Rudin
"J. Clifford Dyer" <[EMAIL PROTECTED]> writes: > ...Perl is named for a knitting technique, Lisp is named for a > speech impediment... I can't figure out whether you're being serious or not but, for the record, those are not where the names of those two languages come from. http://en.wikipedia.

Re: Python surpasses Perl in TIOBE index

2007-12-04 Thread Paul Rudin
George Sakkis <[EMAIL PROTECTED]> writes: > Even more amazing is the rate C++ is losing ground: > http://www.tiobe.com/tiobe_index/C__.html I don't really find surprising that low level languages lose ground at the expense of higher level ones. The developer-time/run-time trade-off tends to move

Re: Python surpasses Perl in TIOBE index

2007-12-04 Thread Paul Rudin
George Sakkis <[EMAIL PROTECTED]> writes: > On Dec 4, 11:07 am, Paul Rudin <[EMAIL PROTECTED]> wrote: >> George Sakkis <[EMAIL PROTECTED]> writes: >> > Even more amazing is the rate C++ is losing ground: >> >http://www.tiobe.com/tiobe_index/C__.html

Re: Is a "real" C-Python possible?

2007-12-11 Thread Paul Rudin
sturlamolden <[EMAIL PROTECTED]> writes: > On 10 Des, 23:49, [EMAIL PROTECTED] (Aahz) wrote: > >> "Premature optimization is the root of all evil in programming." >> --C.A.R. Hoare (often misattributed to Knuth, who was himself quoting >> Hoare) > > Oh, I was Hoare? Thanks. Anyway, it doesn't chan

Re: Newbie NameError problem

2007-12-12 Thread Paul Rudin
[EMAIL PROTECTED] writes: > I don't understand what I don't understand in the following: I haven't tried to understand what your code is doing - but the NameError arises because you try to use Loc before its definition. Put the definition first and the error should go away. -- http://mail.pyth

Re: Newbie NameError problem

2007-12-12 Thread Paul Rudin
[EMAIL PROTECTED] writes: > On Dec 12, 5:51 pm, Paul Rudin <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] writes: >> > I don't understand what I don't understand in the following: >> >> I haven't tried to understand what your code is doing - but

Re: Improvements to the Python core

2007-12-12 Thread Paul Rudin
Christian Heimes <[EMAIL PROTECTED]> writes: > > We are happy and glad for every improvement regarding speed, memory > usage or features if and only if: ... > ... platform independent / supported on all platforms. Python runs > on machines from mobile phones to large main frames. JOOI - there ar

Re: Is Python really a scripting language?

2007-12-13 Thread Paul Rudin
Neil Cerutti <[EMAIL PROTECTED]> writes: > On 2007-12-13, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> I have repeatedly argued in the past that we do ourselves a >> disservice by describing Python as an interpreted language. >> >> Python is compiled. It has a compiler. It even has a built-in >>

Re: Python too slow?

2008-01-15 Thread Paul Rudin
[EMAIL PROTECTED] writes: > A lecturer gave me the perfect answer to the question of speed. > > "You have two choices when it comes to programming. Fast code, or fast > coders." Yes, although it's more a continuum than that suggests. The tricky bit is deciding in each situation where you should b

Re: Return value of an assignment statement?

2008-02-23 Thread Paul Rudin
Dennis Lee Bieber wrote: > On Fri, 22 Feb 2008 11:23:27 -0800, Jeff Schwab <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > >> I'm about through with this discussion, but FWIW, this is a real gotcha >> for me and many others. This is a case where Python does not do what >

Re: Official IRC channel for Python?

2008-02-23 Thread Paul Rudin
Paul Rubin writes: > "Manu Hack" <[EMAIL PROTECTED]> writes: >> > Really? maybe I'm been blocked from it... >> > thanks. >> >> Maybe you need your nick name to be recognized. You need to register >> your nickname somewhere. > > On freenode, you need to register your n

Re: Function Overloading and Python

2008-02-24 Thread Paul Rudin
Allen Peloquin <[EMAIL PROTECTED]> writes: > I have a personal project that has an elegant solution that requires > both true multiple inheritance of classes (which pretty much limits my > language choices to C++ and Python) and type-based function > overloading. > Common Lisp :/ -- http://mail

Re: call by reference howto????

2008-03-13 Thread Paul Rudin
Antoon Pardon <[EMAIL PROTECTED]> writes: > On 2008-02-28, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> On Thu, 28 Feb 2008 02:02:19 +0200, Tamer Higazi wrote: >> >>> Hi! >>> Can somebody of you make me a sample how to define a function based on >>> "call by reference" ??? >> >> Python doesn't do

Re: Emacs vs. Eclipse vs. Vim

2008-11-30 Thread Paul Rudin
Clay Hobbs <[EMAIL PROTECTED]> writes: > It has key commands with key modifiers to do simple tasks (such as > moving the cursor to the left). Err - you move the cursor to the left by pressing the left arrow key (as you do with virtually every other editor), unless you've made some strange key bi

Re: Mathematica 7 compares to other languages

2008-12-10 Thread Paul Rudin
"Dotan Cohen" <[EMAIL PROTECTED]> writes: > 2008/12/10 <[EMAIL PROTECTED]>: >> On Dec 5, 9:51 am, Xah Lee <[EMAIL PROTECTED]> wrote: >>> >>> For those of you who don't know linear algebra but knows coding, this >>> means, we want a function whose input is a list of 3 elements say >>> {x,y,z}, and

Re: ANN: New Book: Programming in Python 3

2008-12-19 Thread Paul Rudin
Thomas Heller writes: > Steve Holden schrieb: >> Thomas Heller wrote: >>> Question from a non-native english speaker: is this now valid english? >>> >>> "One of Python’s great strengths" >>> ^ >>> "and also teaches Python’s functional programming features" >>>

Re: Problem with shelve

2008-11-06 Thread Paul Rudin
[EMAIL PROTECTED] writes: > Hi all, > > I am trying to use the shelve module to save an object of a 'Electron' > class I made into a file. The writing goes well but the reading goes : > e=f['0'] > Traceback (most recent call last): > File "", line 1, in > File "shelve.py", line 113, in _

Re: Python COM: Automatic wrap/unwrap?

2008-11-10 Thread Paul Rudin
Tim Golden <[EMAIL PROTECTED]> writes: > greg wrote: >> Larry Bates wrote: >> >>> You should post this on comp.python.windows as Mark and the other >>> Windows/COM gurus hang around there a lot. >> >> I can't find any such newsgroup -- are you sure >> that's what it's called? > > I think that's wh

Re: Openings for Python Programmer at CA

2009-03-18 Thread Paul Rudin
Aniket M writes: > Note: Communication MUST be perfect!, Plus submit with 3 professional > references Irony :) -- http://mail.python.org/mailman/listinfo/python-list

Re: any(), all() and empty iterable

2009-04-16 Thread Paul Rudin
Tim Chase writes: > Changing the implementation of all() would break wy too much > stuff... Not to mention it clearly works correctly as is. *If* there is an issue it is a documentation one... not an implementation one. -- http://mail.python.org/mailman/listinfo/python-list

Re: Create standalone Windows program with simple graphics?

2009-04-17 Thread Paul Rudin
Poster28 writes: > I'd like to program and compile a simple graphics program (showing something > like a chess board, some numbers and buttons, mouse support) ... 2d or 3d graphics? You could start by looking at pygame and pyopengl. > ... and provide it as a standalone binary for Windows users

Re: Which one is best Python or Java for developing GUI applications?

2009-05-05 Thread Paul Rudin
Paul Rubin writes: > srinivasan srinivas writes: >> Could you tell me does Python have any advantages over Java for the >> development of GUI applications? > > Yes. Clearly c.l.p needs to adopt the SNB convention :) -- http://mail.pyth

Re: How to create a list of functions depending on a parameter?

2009-05-26 Thread Paul Rudin
enzo michelangeli writes: > Let's suppose I want to create a list of n functions of a single > argument, returning the sum between argument and index in the list, so > that e.g.: > > f[0](10) will return 10 > f[3](12) will return 15 > > ...and so on. I had naively though of coding: > > f = [lamb

Re: What text editor is everyone using for Python

2009-05-26 Thread Paul Rudin
Steven D'Aprano writes: > e.g. I can instantly tell if I neglected to close a string, because > my code displays in red. I like syntax hightlighting for whitespace related things in python. e.g to highlight tabs, or whitespace at the end of a line. -- http://mail.python.org/mailman/listinfo/py

Re: How to create a list of functions depending on a parameter?

2009-05-26 Thread Paul Rudin
"Diez B. Roggisch" writes: > enzo michelangeli schrieb: >> Let's suppose I want to create a list of n functions of a single >> argument, returning the sum between argument and index in the list, so >> that e.g.: >> >> f[0](10) will return 10 >> f[3](12) will return 15 >> >> ...and so on. I had na

Re: What text editor is everyone using for Python

2009-05-26 Thread Paul Rudin
Lawrence D'Oliveiro writes: > In message , Jean-Michel > Pichavant wrote: > >> Why buy an IDE when you just need a text editor ? > > Because all the cool kids have one. If you want to be different and > individual like them, you have to have what they have. Of course it's not always clear what

Re: What text editor is everyone using for Python

2009-05-27 Thread Paul Rudin
"Rhodri James" writes: > The feature that caused me to uninstall python-mode.el was its > bloody-minded determination to regard '_' as a word character, > something which caused me more typing that it ever saved. Probably you could have changed this in a few minutes. Or does fiddling with emacs

Re: What text editor is everyone using for Python

2009-05-28 Thread Paul Rudin
Steven D'Aprano writes: > * if possible, all functionality should be capable of being performed by > either the mouse or keyboard. I'd imagine that the requirement that *all* functionality can be performed with the mouse rules out many text editors. Almost the defining feature of a text editor

Ploneboard - grouping forums and setting up on disk

2008-05-23 Thread Paul Rudin
I'm investigating using ploneboard and have a couple of questions. First of all I don't quite get what the global view/local view distinction is - perhaps someone could be good enough to explain what it's for. If it possible to group forums so that permissions can be applied to each set so - for

Re: Python Written in C?

2008-07-22 Thread Paul Rudin
DaveM <[EMAIL PROTECTED]> writes: > On Mon, 21 Jul 2008 03:18:01 +0200, Michiel Overtoom <[EMAIL PROTECTED]> > wrote: > > >>Many major text/word processing programs (Emacs, vi, MS-Word) are also >>written in C. > > I thought Emacs was written in Lisp. The core - including the lisp interpreter - i

Re: Fastest way to store ints and floats on disk

2008-08-08 Thread Paul Rudin
Laszlo Nagy <[EMAIL PROTECTED]> writes: > Permature optimalization is the root of all evil. (Who said that?) Knuth I think. But note the "premature" bit - around here people sometimes give the impression that it goes "optimisation is the root of all evil". -- http://mail.python.org/mailman/li

Re: Date Comparison and Manipulation Functions?

2008-08-24 Thread Paul Rudin
"W. eWatson" <[EMAIL PROTECTED]> writes: > Are there some date and time comparison functions that would compare, say, > > Is 10/05/05 later than 09/22/02? (or 02/09/22 format, yy/mm/dd) > Is 02/11/07 the same as 02/11/07? > > Is 14:05:18 after 22:02:51? (24 hour day is fine) > > How about the dat

Re: Python Programming Challenges for beginners?

2009-11-27 Thread Paul Rudin
n00m writes: > On Nov 27, 1:22 pm, Jon Clements wrote: >> Of course, if you take '~' literally (len(s) <= -10001) I reckon >> you've got way too many :) >> >> Jon. > > Then better: len(s) < abs(~1) > > PS It's a hard problem; so let's leave it alone what's hard? substrings of a string? If y

Re: why do I get this behavior from a while loop?

2009-11-27 Thread Paul Rudin
"S. Chris Colbert" writes: >: print t Try replacing with: print "%0.20f" % t The thing you're missing is that floating point arithmetic isn't (in general) exact - but when it's printed it's rounded. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python & OpenOffice Spreadsheets

2009-11-28 Thread Paul Rudin
r writes: > On Nov 23, 4:49 am, Gerhard Häring wrote: >> Is there a *simple* way to read OpenOffice spreadsheets? >> >> Bonus: write them, too? >> >> I mean something like: >> >> doc.cells[0][0] = "foo" >> doc.save("xyz.ods") >> >> >From a quick look, pyodf offers little more than just using a X

Re: iterators and views of lists

2009-12-16 Thread Paul Rudin
Steven D'Aprano writes: > I'm sympathetic to your request for list views. I've often wanted some > way to cleanly and neatly do this: > > for item in seq[1:]: > process(item) > > without making an unnecessary copy of almost all of seq. > I don't know how it's implemented - but presumably i

Re: Exception as the primary error handling mechanism?

2010-01-05 Thread Paul Rudin
r0g writes: > Steven D'Aprano wrote: >> On Tue, 05 Jan 2010 02:31:34 +, r0g wrote: >> >>> A pattern I have used a few times is that of returning an explicit >>> success/failure code alongside whatever the function normally returns. >> >> That doesn't work for languages that can only return

Re: how to duplicate array entries

2010-01-10 Thread Paul Rudin
Sebastian writes: > Hi there, > > I have an array x=[1,2,3] In python such an object is called a "list". (In cpython it's implemented as an automatically resizable array.) > > Is there an operator which I can use to get the result > [1,1,1,2,2,2,3,3,3] ? There's no operator that will give yo

Re: how to use WSGI applications with apache

2009-10-07 Thread Paul Rudin
travis+ml-pyt...@subspacefield.org writes: > Hi folks, > > I'm not quite sure where to ask this, but this is my closest guess. > > I've written a web service based on the newf micro-framework and it uses > wsgiref.simple_server. I'm noticing that it's not returning response > codes properly (afte

Re: best vi / emacs python features

2009-10-07 Thread Paul Rudin
Carl Banks writes: > On Oct 7, 8:29 pm, Chris Jones wrote: >> Always felt that syntax highlighting for instance is way >> overrated. > > I have all syntax colors turned off except for strings and comments. > I highly recommend this low-key syntax coloring for those who don't > care for the norma

Re: When to derive from object?

2009-10-13 Thread Paul Rudin
Benjamin Kaplan writes: > > It's redundant. Python 3 cleaned up a lot of the warts that appeared > in Python over the years. Old-style classes (classes that didn't > inherit from object) were one of them. Every class in Python 3 is > derived from object whether you specify it or not. ... it coul

Re: the usage of 'yield' keyword

2009-10-15 Thread Paul Rudin
Peng Yu writes: > http://docs.python.org/reference/simple_stmts.html#grammar-token-yield_stmt > > The explanation of yield is not clear to me, as I don't know what a > generator is. I see the following example using 'yield'. Could > somebody explain how 'yield' works in this example? Thank you! >

Re: help to convert c++ fonction in python

2009-10-20 Thread Paul Rudin
Gary Herron writes: > geremy condra wrote: >> And always apply ROT13 twice for extra security. >> > +1 for "quote of the week" Even if it's at least 30 years old :) -- http://mail.python.org/mailman/listinfo/python-list

Re: a splitting headache

2009-10-23 Thread Paul Rudin
Mensanator writes: > No one ever considers making life easy for the user. That's a bizarre assertion. -- http://mail.python.org/mailman/listinfo/python-list

Re: substituting list comprehensions for map()

2009-11-02 Thread Paul Rudin
"Jon P." writes: > I'd like to do: > > resultlist = operandlist1 + operandlist2 > > where for example > > operandlist1=[1,2,3,4,5] > operandlist2=[5,4,3,2,1] > > and resultlist will become [6,6,6,6,6]. Using map(), I > can do: > > map(lambda op1,op2: op1 + op2, operandlist1, operandlist2) > > Is

Re: list comprehension problem

2009-11-02 Thread Paul Rudin
Falcolas writes: > [s.strip() for s in hosts if s.strip()] There's something in me that rebels against seeing the same call twice. I'd probably write: filter(None, (s.strip() for s in hosts)) -- http://mail.python.org/mailman/listinfo/python-list

Re: Most efficient way to "pre-grow" a list?

2009-11-07 Thread Paul Rudin
kj writes: > The best I can come up with is this: > > arr = [None] * 100 > > Is this the most efficient way to achieve this result? > Depends on what you take as given. You can do it with ctypes more efficiently, but you can also shoot yourself in the foot. Another possibility is to use a n

python-daemonize and upstart

2009-11-13 Thread Paul Rudin
I'm experimenting with the daemon module and upstart . There's something I don't understand, which may be more of an upstart issue than a python issue, but I thought I'd start by posting here. Here's a test script: #!/usr/bi

Re: python-daemon and upstart

2009-11-14 Thread Paul Rudin
Ben Finney writes: > Paul Rudin writes: > >> I'm experimenting with the daemon module >> <http://pypi.python.org/pypi/python-daemon/> and upstart >> <http://upstart.ubuntu.com/>. > > First: Thank you for using ‘python-daemon’; it's getting

Re: python-daemon and upstart

2009-11-14 Thread Paul Rudin
Paul Rudin writes: > Ben Finney writes: > >> Paul Rudin writes: >>> description "test daemon" >>> expect daemon >>> chdir /tmp >>> exec /tmp/testdaemon.py Further experimentation reveals that by omitting the "expect daemon"

Re: python-daemon and upstart

2009-11-14 Thread Paul Rudin
Paul Rudin writes: > > So I would have expected it to be necessary in this case. Maybe this is > more an upstart issue than a python-daemon one - not sure. Aha - so I discover that if detach_process is not explicitly passed to the DaemonContext initialiser it tries to guess w

Re: getting properly one subprocess output

2009-11-20 Thread Paul Rudin
Jean-Michel Pichavant writes: > Hi python fellows, > > I'm currently inspecting my Linux process list, trying to parse it in > order to get one particular process (and kill it). > I ran into an annoying issue: > The stdout display is somehow truncated (maybe a terminal length > issue, I don't kno

Re: Is there something similar to list comprehension in dict?

2009-11-20 Thread Paul Rudin
Patrick Sabin writes: > Peng Yu wrote: >> I'm wondering if there is something similar to list comprehension for >> dict (please see the example code below). > > Do you mean something like this: > {i:i+1 for i in [1,2,3,4]} > {1: 2, 2: 3, 3: 4, 4: 5} > > This works in python3, but not in pyth

Re: Imitating "tail -f"

2009-11-22 Thread Paul Rudin
Matt Nordhoff writes: > Jason Sewall wrote: >> FWIW, GNU tail on Linux uses inotify for tail -f: >> >> http://git.savannah.gnu.org/cgit/coreutils.git/tree/src/tail.c >> >> The wikipedia page for inotify lists several python bindings: >> >> http://en.wikipedia.org/wiki/Inotify >> >> Not much h

Re: creating pipelines in python

2009-11-23 Thread Paul Rudin
per writes: > hi all, > > i am looking for a python package to make it easier to create a > "pipeline" of scripts (all in python). what i do right now is have a > set of scripts that produce certain files as output, and i simply have > a "master" script that checks at each stage whether the outpu

Re: Python & OpenOffice Spreadsheets

2009-11-23 Thread Paul Rudin
Gerhard Häring writes: > Is there a *simple* way to read OpenOffice spreadsheets? > > Bonus: write them, too? > > I mean something like: > > doc.cells[0][0] = "foo" > doc.save("xyz.ods") > >>From a quick look, pyodf offers little more than just using a XML parser > directly. Depends on exactly

Re: use strings to call functions

2010-02-08 Thread Paul Rudin
Steven D'Aprano writes: > On Mon, 08 Feb 2010 14:43:46 -0800, Aahz wrote: > WARNING: eval() is almost always the wrong answer to any question >>> >>>warning : it works ! >> >> Works for what? > > Code injection security bugs, of course. > > http://en.wikipedia.org/wiki/Code_injection > > It

Re: How to get memory and CPU status of a particular process

2010-02-22 Thread Paul Rudin
Chris Rebert writes: >> On Tue, Feb 23, 2010 at 9:18 AM, R. P. Janaka wrote: >>> Hi all, >>> >>> Is there a way to get system memory consumption and CPU consumption in a >>> platform independent way, using python...? >>> >>> Basically my requirement is, get the memory status and CPU status of a

Re: Artificial Neural Networks recommendation

2010-02-24 Thread Paul Rudin
Gereon Kaiping writes: > Are there other modules for simulating ANNs? Fann has python bindings. -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the word on using """ to comment-out?

2010-02-25 Thread Paul Rudin
kj writes: > I think I remember, early in my learning of Python, coming across > the commandment "THOU SHALT NOT USE TRIPLE-QUOTES TO COMMENT-OUT > LINES OF CODE", or something to that effect. But now I can't find > it! No idea, but it would be nice to have some multiline comment syntax (other

Re: Easy function, please help.

2011-02-08 Thread Paul Rudin
Nanderson writes: > loop would be infinite. I get what is happening in the function, and I > understand why this would work, but for some reason it's confusing me > as to how it is exiting the loop after a certain number of times. Help > is appreciated, thanks. It works because 0 tests false an

Re: rfind bug ?

2010-04-21 Thread Paul Rudin
Peter Otten <__pete...@web.de> writes: > OP: you may be looking for > a = "a bb ccc" a[::-1].find(" ") > 3 But you should be aware of the effeciency implications of doing this. a[::-1] constructs a new list. It's probably faster to do e.g.: len(a) - a.rfind(..) - 1 -- http://mail.pyt

Re: Some objects missing from tkinter

2010-04-27 Thread Paul Rudin
Peter Otten <__pete...@web.de> writes: > Some people, when confronted with a problem, think "I know, I'll use emacs." > Now they have two problems. Probably you know this ... but the original form of this saying had "regular expressions" in place of "emacs". Since Jamie Zawinski coined this sa

Re: Download Visual Studio Express 2008 now

2010-04-27 Thread Paul Rudin
"Martin v. Loewis" writes: > Microsoft has just released Visual Studio 2010, along with its free (of > charge) Express edition. Following a tradition, they are likely to > withdraw support and availability for VS 2008 Express some time in the > future. > > Python 2.6, 2.7, and 3.1 are all built w

Re: matching strings in a large set of strings

2010-04-30 Thread Paul Rudin
"Karin Lagesen" writes: > Hello. > > I have approx 83 million strings, all 14 characters long. I need to be > able to take another string and find out whether this one is present > within the 83 million strings. > > Now, I have tried storing these strings as a list, a set and a dictionary. > I kn

Re: matching strings in a large set of strings

2010-04-30 Thread Paul Rudin
Duncan Booth writes: > Paul Rudin wrote: > >> Shouldn't a set with 83 million 14 character strings be fine in memory >> on a stock PC these days? I suppose if it's low on ram you might start >> swapping which will kill performance. Perhaps the method you'r

Re: Recursive functions not returning lists as expected

2010-05-03 Thread Paul Rudin
rickhg12hs writes: > Would a kind soul explain something basic to a python noob? > > Why doesn't this function always return a list? > > def recur_trace(x,y): > print x,y > if not x: > return y > recur_trace(x[1:], y + [x[0]]) > > Here are a couple sample runs. > print(recur_trace(

Re: Python Forum

2010-06-03 Thread Paul Rudin
Adam Tauno Williams writes: > Most people use this list via e-mail... Do you know this to be the case, or is that a guess? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Forum

2010-06-03 Thread Paul Rudin
Michele Simionato writes: > On Jun 3, 12:28 pm, "Martin P. Hellwig" > wrote: >> On the other hand it might not be so bad that you don't get questions >> from users here who are unable to use a nntp reader or news to mail service. > > I am unable to use a nntp reader or news to mail service. I us

Re: Python Forum

2010-06-03 Thread Paul Rudin
Adam Tauno Williams writes: > On Thu, 2010-06-03 at 12:35 +0100, Paul Rudin wrote: >> Adam Tauno Williams writes: >> > Most people use this list via e-mail... >> Do you know this to be the case, or is that a guess? > > Scan through a bunch of threads with show-

Re: Is there any module/utility like 'rsync' in python

2010-06-15 Thread Paul Rudin
Jonathan Fine writes: > hiral wrote: >> Hi, >> >> Is there any module/utility like 'rsync' in python. >> >> Thank you in advance. > > Not exactly what you asked for, but Mercurial provides a Python > interface. You might find this URL a good starting point: >http://mercurial.selenic.com/wiki

<    1   2   3   >