Re: English Idiom in Unix: Directory Recursively

2011-05-17 Thread Harrison Hill
On May 18, 7:06 am, rusi wrote: > On May 18, 9:51 am, Roland Hutchinson wrote: > > > Sorry to have to contradict you, but it really is a textbook example of > > recursion.  Try this psuedo-code on for size:   > > Well and so far this thread is a textbook example of myths and > misconceptions rega

Re: [Python-Dev] [RELEASED] Python 3.2.1 rc 1

2011-05-17 Thread Littlefield, Tyler
>For an extensive list of changes and features in the 3.2 line, see >http://docs.python.org/3.2/whatsnew/3.2.html Might I presume that clicking the link would show the required changes? -- http://mail.python.org/mailman/listinfo/python-list

Re: English Idiom in Unix: Directory Recursively

2011-05-17 Thread rusi
On May 18, 9:51 am, Roland Hutchinson wrote: > Sorry to have to contradict you, but it really is a textbook example of > recursion.  Try this psuedo-code on for size:   Well and so far this thread is a textbook example of myths and misconceptions regarding recursion :D 1. 'Recursive' is a meani

Re: [Python-Dev] [RELEASED] Python 3.2.1 rc 1

2011-05-17 Thread anatoly techtonik
That's great, but where is the list if changes? -- anatoly t. On Tue, May 17, 2011 at 9:50 PM, Georg Brandl wrote: > On behalf of the Python development team, I am pleased to announce the > first release candidate of Python 3.2.1. > > Python 3.2.1 will the first bugfix release for Python 3.2, f

Re: in search of graceful co-routines

2011-05-17 Thread Chris Withers
On 18/05/2011 03:10, Terry Reedy wrote: By default, Python iterators operate in pull mode -- consumers request a new item when they want one. I believe .send was mostly intended to reverse that, to operate in push mode where producers .send() a item to a consumer when they are ready to. That is c

Re: pyjamas 0.8alpha1 release

2011-05-17 Thread alex23
harrismh777 wrote: > If there is another major jump like  2.x --> 3.x  in the future, Python > will die. I hope you guys are aware of this. The user base might accept > this thing once, but they're not going do it again... The differences between major version releases of Python are far, far less

Re: in search of graceful co-routines

2011-05-17 Thread Ian Kelly
On Tue, May 17, 2011 at 11:27 PM, Chris Withers wrote: > Yes, but it's this kind of birds nest I'm trying to avoid... I was actually kind of hoping you might see it that way. That's about as simple as you're going to get using a generator for this, though. I'll second Terry's suggestion on this:

Re: [ann] pyjamas 0.8alpha1 release

2011-05-17 Thread harrismh777
Terry Reedy wrote: No, because I think you are exaggerating. That said, I think core Python is pretty close to 'complete' and I would not mind further syntax freezes like the one for 3.2. I am exaggerating only to the extent that someone can imagine folks becoming just annoyed with PEP progr

Re: in search of graceful co-routines

2011-05-17 Thread Chris Withers
On 17/05/2011 18:26, Ian Kelly wrote: You can use send the way you're wanting to. It will look something like this: def provider(): result = None while True: if result is None: if has_more_items(): next_item = get_next_item() else: break elif resu

Re: English Idiom in Unix: Directory Recursively

2011-05-17 Thread Pascal J. Bourguignon
Roland Hutchinson writes: > Sorry to have to contradict you, Don't be sorry. > but it really is a textbook example of > recursion. Try this psuedo-code on for size: > > FUNCTION DIR-DELETE (directory) > FOR EACH entry IN directory > IF entry IS-A-DIRECTORY THEN DIR-DELETE (entry).

Re: English Idiom in Unix: Directory Recursively

2011-05-17 Thread Roland Hutchinson
On Tue, 17 May 2011 15:26:42 -0700, Xah Lee wrote: > might be of interest. > > 〈English Idiom in Unix: Directory Recursively〉 > http://xahlee.org/comp/idiom_directory_recursively.html > > -- English Idiom in Unix: > Directory Recursively > > Xah Lee, 2011

Re: Faster Recursive Fibonacci Numbers

2011-05-17 Thread rusi
On May 18, 2:04 am, Wolfram Hinderer wrote: > On 17 Mai, 20:56, geremy condra wrote: > > > > > On Tue, May 17, 2011 at 10:19 AM, Jussi Piitulainen > > > wrote: > > > geremy condra writes: > > > >> or O(1): > > > >> ö = (1 + sqrt(5)) / 2 > > >> def fib(n): > > >>     numerator = (ö**n) - (1 - ö)*

Re: in search of graceful co-routines

2011-05-17 Thread Chris Angelico
On Wed, May 18, 2011 at 3:04 AM, Chris Withers wrote: > Hi All, > > I'm looking for a graceful pattern for the situation where I have a provider > of a sequence, the consumer of a sequence and code to moderate the two, and > where I'd like to consumer to be able to signal to the provider that it >

Re: Python 3.x and bytes

2011-05-17 Thread Terry Reedy
On 5/17/2011 5:27 PM, Corey Richardson wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/17/2011 04:55 PM, Ethan Furman wrote: Apparently, it's not well documented. If you check PEP 358 you'll find it. ~Ethan~ Agreed, it looks like it should be mentioned in bytes.__doc__ about the

Re: Python 3.x and bytes

2011-05-17 Thread Terry Reedy
On 5/17/2011 3:39 PM, MRAB wrote: On 17/05/2011 19:47, Ethan Furman wrote: In Python 3 one can say --> huh = bytes(5) BTW, help(bytes) doesn't seem to mention it! I believe I mentioned that on some tracker issue. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: in search of graceful co-routines

2011-05-17 Thread Terry Reedy
On 5/17/2011 1:04 PM, Chris Withers wrote: Hi All, I'm looking for a graceful pattern for the situation where I have a provider of a sequence, the consumer of a sequence and code to moderate the two, and where I'd like to consumer to be able to signal to the provider that it hasn't succeeded in

Re: Finding the local directory of a file in the python path

2011-05-17 Thread are Dogue
Nevermind... os.path.dirname (__file__) On May 17, 9:44 pm, are Dogue wrote: > Hi there, > > I have a problem that I can't seem to solve after quite a bit of > searching, probably because I can't find the right terms to search > for. > > Basically, here's the situation. Let's say I have a file a

Re: [ann] pyjamas 0.8alpha1 release

2011-05-17 Thread Terry Reedy
On 5/17/2011 12:38 PM, harrismh777 wrote: Terry Reedy wrote: Like it or not, Python 3 is the future of Python. It is the Python that many Python newcomers learn first, and perhaps ever will. Yes, no doubt, and I'm genuine about that... ... but there is something else to consider, as I'm sure

Finding the local directory of a file in the python path

2011-05-17 Thread are Dogue
Hi there, I have a problem that I can't seem to solve after quite a bit of searching, probably because I can't find the right terms to search for. Basically, here's the situation. Let's say I have a file at ~/foo/bin/ foo.py that imports a script that at ~/bar/bin/bar.py. The imported file needs

Re: pyjamas 0.8alpha1 release

2011-05-17 Thread Terry Reedy
On 5/17/2011 12:07 PM, lkcl wrote: On May 4, 7:37 pm, Terry Reedy wrote: On 5/4/2011 10:06 AM, Luke Kenneth Casson Leighton wrote: pyjamasis a suite of projects, including a python-to-javascript compiler As you well know, there is no such thing as 'python' when it comes to compiling actual

Re: English Idiom in Unix: Directory Recursively

2011-05-17 Thread Steven W. Orr
On 5/17/2011 6:26 PM, Xah Lee wrote: might be of interest. 〈English Idiom in Unix: Directory Recursively〉 http://xahlee.org/comp/idiom_directory_recursively.html The answer is from compute science 101. From any standard data structures course, you learn the algorithm for how to walk a tree. T

Re: python logging

2011-05-17 Thread Fei
On May 17, 6:55 pm, Ian Kelly wrote: > On Tue, May 17, 2011 at 2:55 PM, Fei wrote: > > where is default logging file on Mac? I saw lots of app just import > > logging, and begins to logging.info(...) etc.  I'm not sure where to > > look at the logging configuration to figure out the log location.

basic bytecode to machine code compiler (part 2)

2011-05-17 Thread Rouslan Korneychuk
I mentioned before that I had a proof of concept to convert Python bytecode to native machine code. It's available at https://github.com/Rouslan/nativecompile Now that I have a substantial number of the bytecode instructions implemented, I thought I would share some benchmark results. The f

Re: cPickle -> invalid signature

2011-05-17 Thread Gabriel Genellina
En Tue, 17 May 2011 15:26:53 -0300, Neal Becker escribió: Gabriel Genellina wrote: En Tue, 17 May 2011 08:41:41 -0300, Neal Becker escribió: What does it mean when cPickle.load says: RuntimeError: invalid signature Is binary format not portable? Are you sure that's the actual error mess

Ed hardy, (tshirt$13, swim strunk$25, jean$30, handbag$34, cap$13, sunglass$12, shoes$25), Nike shoes:$32, Handbag:$35, NFL:$20, jean:$30, air force one shoes, lv, gucci, D&G, bbc, coachUGG boot:$50

2011-05-17 Thread john kode
Get Nike Shoes at Super Cheap Prices Discount Ed hardy tshirt (www.dmuch.com) Discount Ed hardy swimming suit (www.dmuch.com) Discount Ed hardy jean (www.dmuch.com) Discount Ed hardy shoes (www.dmuch.com) Discount Ed hardy handbag (www.dmuch.com) Discount Ed hardy other porduct (www.dmuch.com)

Re: FW: help please

2011-05-17 Thread Littlefield, Tyler
>I can't remember exactly in which release 'perfect English skills' were >added to Python runtime requirements, could you please refresh my memory? the one that requires people use the space key and check over their messages before they hit the enter key. Not so bad a request, I don't think. I a

Re: cPickle -> invalid signature

2011-05-17 Thread Gabriel Genellina
En Tue, 17 May 2011 15:26:53 -0300, Neal Becker escribió: Gabriel Genellina wrote: En Tue, 17 May 2011 08:41:41 -0300, Neal Becker escribió: What does it mean when cPickle.load says: RuntimeError: invalid signature Is binary format not portable? Are you sure that's the actual error mess

Re: FW: help please

2011-05-17 Thread Gabriel Genellina
En Tue, 17 May 2011 16:48:29 -0300, Albert Hopkins escribió: On Tue, 2011-05-17 at 10:18 -0600, Littlefield, Tyler wrote: Not to be pedantic or anything, and I may not be able to help regardless, but it looks like your space key is fixed, and I don't really care to pick through and try to pla

Re: English Idiom in Unix: Directory Recursively

2011-05-17 Thread Chris Angelico
On Wed, May 18, 2011 at 8:26 AM, Xah Lee wrote: >      Apply changes to this folder only. >        Apply changes to this folder, subfolders and files. > > Note the second choice. In unix, it would say “Apply changes to this > folder recursively.” I think this is more about the Windows and Mac phi

Re: best way to extract sentence from txt file

2011-05-17 Thread Chris Angelico
On Wed, May 18, 2011 at 4:40 AM, Michiel Overtoom wrote: > Until then we have to guess, and my E.S.P. is notoriously bad. Roll d20 and add your ESP skill and your Wisdom modifier. The DC for this test is 20 if you're familiar with D&D, or 25 if you are not. Chris Angelico Dungeon Master -- http

Re: English Idiom in Unix: Directory Recursively

2011-05-17 Thread Ian Kelly
On Tue, May 17, 2011 at 4:26 PM, Xah Lee wrote: > Though, if you think about it, it's not exactly a correct description. > “Recursive”, or “recursion”, refers to a particular type of algorithm, > or a implementation using that algorithm. Only when used as programming jargon. In mathematics, "rec

Re: python logging

2011-05-17 Thread Ian Kelly
On Tue, May 17, 2011 at 2:55 PM, Fei wrote: > where is default logging file on Mac? I saw lots of app just import > logging, and begins to logging.info(...) etc.  I'm not sure where to > look at the logging configuration to figure out the log location. There is no default log file. You're seeing

Re: ipython prompt does not appear in windows

2011-05-17 Thread Ori L.
See here for a workaround: https://bugs.launchpad.net/ipython/+bug/290228 First result on Google for the query "ipython emacs windows", BTW. On May 17, 3:00 am, rusi wrote: > If I use ipython under emacs on linux it works (at least basic REPL) > ie I can type an expression and I get a result fol

English Idiom in Unix: Directory Recursively

2011-05-17 Thread Xah Lee
might be of interest. 〈English Idiom in Unix: Directory Recursively〉 http://xahlee.org/comp/idiom_directory_recursively.html -- English Idiom in Unix: Directory Recursively Xah Lee, 2011-05-17 Today, let's discuss something in the category of lingustics.

Re: Python 3.x and bytes

2011-05-17 Thread Ethan Furman
Ian Kelly wrote: On Tue, May 17, 2011 at 2:20 PM, Ethan Furman wrote: The big question, though, is would you do it this way: some_var = bytes(23).replace(b'\x00', b'a') or this way? some_var = bytes(b'a' * 23) Actually, I would just do it this way: some_var = b'a' * 23 That's already a b

Re: python logging

2011-05-17 Thread Rafael Durán Castañeda
On 17/05/11 22:55, Fei wrote: where is default logging file on Mac? I saw lots of app just import logging, and begins to logging.info(...) etc. I'm not sure where to look at the logging configuration to figure out the log location. I just get in touch of python about 1month ago, and I appreciat

Re: Faster Recursive Fibonacci Numbers

2011-05-17 Thread geremy condra
On Tue, May 17, 2011 at 2:04 PM, Wolfram Hinderer wrote: > On 17 Mai, 20:56, geremy condra wrote: >> On Tue, May 17, 2011 at 10:19 AM, Jussi Piitulainen >> >> wrote: >> > geremy condra writes: >> >> >> or O(1): >> >> >> ö = (1 + sqrt(5)) / 2 >> >> def fib(n): >> >>     numerator = (ö**n) - (1 -

Re: Having a problem getting python working...

2011-05-17 Thread Ned Deily
In article <6e09a0f4-b9a6-4c9f-874b-cb6e21ef7...@gmail.com>, Chris Paton wrote: > Not sure if this is the right place to put this (forgive me for my ignorance, > I'm looking everywhere!). I'm having a problem getting IDLE working. I'm > working off Mac OSX 10.6.7 with Python 3.2 installed and I

Re: Python 3.x and bytes

2011-05-17 Thread Corey Richardson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/17/2011 04:55 PM, Ethan Furman wrote: > Apparently, it's not well documented. If you check PEP 358 > you'll find it. > > ~Ethan~ Agreed, it looks like it should be mentioned in bytes.__doc__ about the single-integer argument. - -- Corey Ric

smtplib is broken when using TLS

2011-05-17 Thread nirinA raseliarison
i think this has the same origin as the ftplib test failure. Python 3.2.1rc1 (default, May 17 2011, 22:01:34) [GCC 4.6.0] on linux2 Type "copyright", "credits" or "license()" for more information. RESTART send: 'ehlo [127.0.0

test_ftplib.py failed with segmentation fault,gcc4.6.0,glibc-2.13

2011-05-17 Thread nirinA raseliarison
hi all, i can't get connected to bugs.python.org so here my make test results. make test aborted when running test_ftplib. and running # ./python Lib/test/test_ftplib.py Segmentation fault with this kernel message: [ 2166.927138] python[12142]: segfault at

test_argparse.py FAILED (failures=6)

2011-05-17 Thread nirinA raseliarison
== FAIL: test_failures_many_groups_listargs (__main__.TestFileTypeW) -- Traceback (most recent call last): File "Lib/test/test_argparse.py", line 216, in wrapp

Re: portable multiprocessing code

2011-05-17 Thread Ian Kelly
On Tue, May 17, 2011 at 9:14 AM, Eric Frederich wrote: > I have written some code using Python 2.7 but I'd like these scripts > to be able to run on Red Hat 5's 2.4.3 version of Python which doesn't > have multiprocessing. > I can try to import multiprocessing and set a flag as to whether it is >

Re: Faster Recursive Fibonacci Numbers

2011-05-17 Thread Wolfram Hinderer
On 17 Mai, 20:56, geremy condra wrote: > On Tue, May 17, 2011 at 10:19 AM, Jussi Piitulainen > > wrote: > > geremy condra writes: > > >> or O(1): > > >> ö = (1 + sqrt(5)) / 2 > >> def fib(n): > >>     numerator = (ö**n) - (1 - ö)**n > >>     denominator = sqrt(5) > >>     return round(numerator/d

python logging

2011-05-17 Thread Fei
where is default logging file on Mac? I saw lots of app just import logging, and begins to logging.info(...) etc. I'm not sure where to look at the logging configuration to figure out the log location. I just get in touch of python about 1month ago, and I appreciate your help. -- http://mail.pyt

Re: Python 3.x and bytes

2011-05-17 Thread Ian Kelly
On Tue, May 17, 2011 at 2:20 PM, Ethan Furman wrote: > The big question, though, is would you do it this way: > > some_var = bytes(23).replace(b'\x00', b'a') > > or this way? > > some_var = bytes(b'a' * 23) Actually, I would just do it this way: some_var = b'a' * 23 That's already a bytes objec

Re: Python enabled gdb on Windows and relocation

2011-05-17 Thread Doug Evans
On Sun, May 15, 2011 at 9:11 AM, Ruben Van Boxem wrote: > I am sorry for the repeated messages that no one cares about, but I > may have discovered GDB in its current form already allows what I > want: I tried to figure out what exact paths the snake in gdb was > using to search for its modules, a

Re: Python 3.x and bytes

2011-05-17 Thread Ian Kelly
On Tue, May 17, 2011 at 1:50 PM, Corey Richardson wrote: > - From help(bytes): >  |  bytes(iterable_of_ints) -> bytes >  |  bytes(string, encoding[, errors]) -> bytes >  |  bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer >  |  bytes(memory_view) -> bytes > > Looks like you're using the

Re: Python 3.x and bytes

2011-05-17 Thread Felipe Bastos Nunes
Mine bytes constructor when useing Corey's advice give's me a string instead of a b''... 2011/5/17 Corey Richardson > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 05/17/2011 02:47 PM, Ethan Furman wrote: > > In Python 3 one can say > > > > --> huh = bytes(5) > > > > Since the bytes typ

Re: Python 3.x and bytes

2011-05-17 Thread Ethan Furman
Corey Richardson wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/17/2011 02:47 PM, Ethan Furman wrote: In Python 3 one can say --> huh = bytes(5) Since the bytes type is actually a list of integers, I would have expected this to have huh being a bytestring with one element -- the

Re: Python enabled gdb on Windows and relocation

2011-05-17 Thread Doug Evans
On Sun, May 15, 2011 at 6:26 AM, Ruben Van Boxem wrote: > Wow, I think I have a partial solution. Delving into the Python docs, > for example here: > http://docs.python.org/using/windows.html#finding-modules, you can see > that PYTHONPATH is used first, then the Windows registry, then > PYTHONHOME

Re: Trying to understand html.parser.HTMLParser

2011-05-17 Thread Karim
On 05/17/2011 03:05 AM, Andrew Berg wrote: On 2011.05.16 02:26 AM, Karim wrote: Use regular expression for bad HTLM or beautifulSoup (google it), below a exemple to extract all html links: linksList = re.findall('.*?',htmlSource) for link in linksList: print link I was afraid I might hav

Re: Cartoonify Myself

2011-05-17 Thread andy baxter
On 17/05/11 20:26, Chris M. Bartos wrote: Hi, Is there a Python module that can "cartoonify" a picture of myself? There's got to be an algorithm out there somewhere, right? If there is a way to cartoon a single picture, could you cartoonify a video, too? Thanks for your help. Chris You

Re: Python 3.x and bytes

2011-05-17 Thread Felipe Bastos Nunes
This piece of code works fine for me: > >>> somevar = bytes() > >>> somevar > '' > >>> somevar.replace(b'', b'10') > '10' > >>> somevar > '' > >>> somevar = somevar.replace(b'', b'10') > >>> somevar > '10' > >>> somevar2 = bytes(b'10'*2) > >>> somevar2 > '1010' > >>> somevar2 = somevar2.replace(b'

Re: portable multiprocessing code

2011-05-17 Thread Michael Kent
You could also install Python 2.7 on that RedHat machine. It can be done without interfering with the 2.5 that RedHat depends on. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3.x and bytes

2011-05-17 Thread Ethan Furman
Felipe Bastos Nunes wrote: 2011/5/17 Ethan Furman wrote: In Python 3 one can say --> huh = bytes(5) Since the bytes type is actually a list of integers, I would have expected this to have huh being a bytestring with one element -- the integer 5. Actually, what you get is: --> huh b'\x00

Re: ipython prompt does not appear in windows

2011-05-17 Thread Dan Stromberg
Try running ipython in a cmd.exe. If that works, it almost certainly means that the I/O is going directly to video RAM instead of through a disciplined API. On Tue, May 17, 2011 at 12:00 AM, rusi wrote: > If I use ipython under emacs on linux it works (at least basic REPL) > ie I can type an ex

Re: Python 3.x and bytes

2011-05-17 Thread Corey Richardson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/17/2011 02:47 PM, Ethan Furman wrote: > In Python 3 one can say > > --> huh = bytes(5) > > Since the bytes type is actually a list of integers, I would have > expected this to have huh being a bytestring with one element -- the > integer 5.

Re: FW: help please

2011-05-17 Thread Albert Hopkins
On Tue, 2011-05-17 at 10:18 -0600, Littlefield, Tyler wrote: > Not to be pedantic or anything, and I may not be able to help > regardless, but it looks like your space key is fixed, and I don't > really care to pick through and try to play hangman with your message. I actually, at first glance,

Re: Python 3.x and bytes

2011-05-17 Thread MRAB
On 17/05/2011 19:47, Ethan Furman wrote: In Python 3 one can say --> huh = bytes(5) Since the bytes type is actually a list of integers, I would have expected this to have huh being a bytestring with one element -- the integer 5. Actually, what you get is: --> huh b'\x00\x00\x00\x00\x00' or f

Re: problem with GKT module?

2011-05-17 Thread Alister Ware
On Mon, 16 May 2011 14:56:38 -0500, harrismh777 wrote: > alister ware wrote: >> def callback(self,widget,data=None): >> print widget #gives reference to radio button ok print >> widget.name #widget name on windoze, None on linux > > We

Cartoonify Myself

2011-05-17 Thread Chris M. Bartos
Hi, Is there a Python module that can "cartoonify" a picture of myself? There's got to be an algorithm out there somewhere, right? If there is a way to cartoon a single picture, could you cartoonify a video, too? Thanks for your help. Chris -- Christopher M. Bartos bartos...@osu.edu 330-32

Re: Python 3.x and bytes

2011-05-17 Thread Ian Kelly
On Tue, May 17, 2011 at 1:20 PM, Ian Kelly wrote: > I suppose it's for interoperability with the mutable bytearray type, > which takes the same parameters in the constructor. http://www.python.org/dev/peps/pep-3137/#constructors -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3.x and bytes

2011-05-17 Thread Felipe Bastos Nunes
They accept .replace(b"00", b"12") for example. Documentation about it. 2011/5/17 Ethan Furman > In Python 3 one can say > > --> huh = bytes(5) > > Since the bytes type is actually a list of integers, I would have expected > this t

Re: Python 3.x and bytes

2011-05-17 Thread Ian Kelly
On Tue, May 17, 2011 at 12:47 PM, Ethan Furman wrote: > In Python 3 one can say > > --> huh = bytes(5) > > Since the bytes type is actually a list of integers, I would have expected > this to have huh being a bytestring with one element -- the integer 5. >  Actually, what you get is: > > --> huh >

Re: best way to extract sentence from txt file

2011-05-17 Thread Miki Tebeka
http://nltk.googlecode.com/svn/trunk/doc/api/nltk.tokenize-module.html ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Faster Recursive Fibonacci Numbers

2011-05-17 Thread geremy condra
On Tue, May 17, 2011 at 10:19 AM, Jussi Piitulainen wrote: > geremy condra writes: > >> or O(1): >> >> φ = (1 + sqrt(5)) / 2 >> def fib(n): >>     numerator = (φ**n) - (1 - φ)**n >>     denominator = sqrt(5) >>     return round(numerator/denominator) >> >> Testing indicates that it's faster somewh

Re: if statement on lenght of a list

2011-05-17 Thread Ethan Furman
Joe Leonardo wrote: Totally baffled by this…maybe I need a nap. Writing a small function to reject input that is not a list of 19 fields. def breakLine(value): if value.__class__() != [] and value.__len__() != 19: print 'You must pass a list that contains 19 fields.' else:

Re: best way to extract sentence from txt file

2011-05-17 Thread Michiel Overtoom
On May 17, 2011, at 20:22, Robert Pazur wrote: > my question is maybe quite simple: > What is the best (and shortest) way to extract sentence from .txt file? Well, open("filename.txt").readlines() gives you a list of all the lines in a txt file, which might not be sentences, depending on the te

[RELEASED] Python 3.2.1 rc 1

2011-05-17 Thread Georg Brandl
On behalf of the Python development team, I am pleased to announce the first release candidate of Python 3.2.1. Python 3.2.1 will the first bugfix release for Python 3.2, fixing over 120 bugs and regressions in Python 3.2. For an extensive list of changes and features in the 3.2 line, see ht

Python 3.x and bytes

2011-05-17 Thread Ethan Furman
In Python 3 one can say --> huh = bytes(5) Since the bytes type is actually a list of integers, I would have expected this to have huh being a bytestring with one element -- the integer 5. Actually, what you get is: --> huh b'\x00\x00\x00\x00\x00' or five null bytes. Note that this is an

Re: if statement on lenght of a list

2011-05-17 Thread Ian Kelly
On Tue, May 17, 2011 at 12:02 PM, Joe Leonardo wrote: > Hey all, > > > > Totally baffled by this…maybe I need a nap. Writing a small function to > reject input that is not a list of 19 fields. > > > > def breakLine(value): > > if value.__class__() != [] and value.__len__() != 19: > > p

Re: if statement on lenght of a list

2011-05-17 Thread MRAB
On 17/05/2011 19:02, Joe Leonardo wrote: Hey all, Totally baffled by this…maybe I need a nap. Writing a small function to reject input that is not a list of 19 fields. def breakLine(value): if value.__class__() != [] and value.__len__() != 19: print 'You must pass a list that contai

Re: if statement on lenght of a list

2011-05-17 Thread Chris Rebert
On Tue, May 17, 2011 at 11:02 AM, Joe Leonardo wrote: > > Hey all, > > Totally baffled by this…maybe I need a nap. Writing a small function to > reject input that is not a list of 19 fields. > > def breakLine(value): >     if value.__class__() != [] and value.__len__() != 19: >     print 'You

Re: if statement on lenght of a list

2011-05-17 Thread Jerry Hill
On Tue, May 17, 2011 at 2:02 PM, Joe Leonardo wrote: > Hey all, > > > > Totally baffled by this…maybe I need a nap. Writing a small function to > reject input that is not a list of 19 fields. > > > > def breakLine(value): > > if value.__class__() != [] and value.__len__() != 19: > > This shoul

Re: cPickle -> invalid signature

2011-05-17 Thread Neal Becker
Gabriel Genellina wrote: > En Tue, 17 May 2011 08:41:41 -0300, Neal Becker > escribió: > >> What does it mean when cPickle.load says: >> RuntimeError: invalid signature >> >> Is binary format not portable? > > Are you sure that's the actual error message? > I cannot find such message anywhere i

Re: groupby - summing multiple columns in a list of lists

2011-05-17 Thread Peter Otten
Jackson wrote: > I'm currently using a function pasted in below. This allows me to sum > a column (index) in a list of lists. > > So if mylist = [[1, 2, 3], [1, 3, 4], [2, 3, 4], [2, 4, 5]] > group_results(mylist,[0],1) > > Returns: > [(1, 5), (2, 7)] > > What I would like to do is allow a tupl

best way to extract sentence from txt file

2011-05-17 Thread Robert Pazur
Hi all, my question is maybe quite simple: What is the best (and shortest) way to extract sentence from .txt file? Thanks in advance, Robert Pazur -- http://mail.python.org/mailman/listinfo/python-list

if statement on lenght of a list

2011-05-17 Thread Joe Leonardo
Hey all, Totally baffled by this...maybe I need a nap. Writing a small function to reject input that is not a list of 19 fields. def breakLine(value): if value.__class__() != [] and value.__len__() != 19: print 'You must pass a list that contains 19 fields.' else: print '

Re: in search of graceful co-routines

2011-05-17 Thread Carl Banks
On Tuesday, May 17, 2011 10:04:25 AM UTC-7, Chris Withers wrote: > Now, since the sequence is long, and comes from a file, I wanted the > provider to be an iterator, so it occurred to me I could try and use the > new 2-way generator communication to solve the "communicate back with > the provide

Re: in search of graceful co-routines

2011-05-17 Thread Ian Kelly
On Tue, May 17, 2011 at 11:04 AM, Chris Withers wrote: > Now, since the sequence is long, and comes from a file, I wanted the > provider to be an iterator, so it occurred to me I could try and use the new > 2-way generator communication to solve the "communicate back with the > provider", with som

Re: Faster Recursive Fibonacci Numbers

2011-05-17 Thread Jussi Piitulainen
geremy condra writes: > or O(1): > > φ = (1 + sqrt(5)) / 2 > def fib(n): > numerator = (φ**n) - (1 - φ)**n > denominator = sqrt(5) > return round(numerator/denominator) > > Testing indicates that it's faster somewhere around 7 or so. And increasingly inaccurate from 71 on. -- http:

groupby - summing multiple columns in a list of lists

2011-05-17 Thread Jackson
I'm currently using a function pasted in below. This allows me to sum a column (index) in a list of lists. So if mylist = [[1, 2, 3], [1, 3, 4], [2, 3, 4], [2, 4, 5]] group_results(mylist,[0],1) Returns: [(1, 5), (2, 7)] What I would like to do is allow a tuple/list of index values, rather than

in search of graceful co-routines

2011-05-17 Thread Chris Withers
Hi All, I'm looking for a graceful pattern for the situation where I have a provider of a sequence, the consumer of a sequence and code to moderate the two, and where I'd like to consumer to be able to signal to the provider that it hasn't succeeded in processing one element in the queue. So

Re: Faster Recursive Fibonacci Numbers

2011-05-17 Thread geremy condra
On Tue, May 17, 2011 at 9:36 AM, rusi wrote: > On May 17, 8:50 pm, RJB wrote: >> I noticed some discussion of recursion. the trick is to find a >> formula where the arguments are divided, not decremented. >> I've had a "divide-and-conquer" recursion for the Fibonacci numbers >> for a couple o

Re: [ann] pyjamas 0.8alpha1 release

2011-05-17 Thread harrismh777
Terry Reedy wrote: Like it or not, Python 3 is the future of Python. It is the Python that many Python newcomers learn first, and perhaps ever will. Yes, no doubt, and I'm genuine about that... ... but there is something else to consider, as I'm sure you are aware. At some point Python is goi

Re: Faster Recursive Fibonacci Numbers

2011-05-17 Thread rusi
On May 17, 8:50 pm, RJB wrote: > I noticed some discussion of recursion. the trick is to find a > formula where the arguments are divided, not decremented. > I've had a "divide-and-conquer" recursion for the Fibonacci numbers > for a couple of years in C++ but just for fun rewrote it > in Pyth

Re: Python enabled gdb on Windows and relocation

2011-05-17 Thread Ruben Van Boxem
2011/5/15 Ruben Van Boxem : > 2011/5/15 Ruben Van Boxem : >> 2011/5/15 Ruben Van Boxem : >>> 2011/5/14 Doug Evans : On Sat, May 14, 2011 at 2:09 AM, Ruben Van Boxem wrote: > 2011/5/14 Doug Evans : >> On Thu, May 12, 2011 at 9:19 AM, Ruben Van Boxem >> wrote: >>> (now in

Re: Faster Recursive Fibonacci Numbers

2011-05-17 Thread rusi
On May 17, 8:50 pm, RJB wrote: > I noticed some discussion of recursion. the trick is to find a > formula where the arguments are divided, not decremented. > I've had a "divide-and-conquer" recursion for the Fibonacci numbers > for a couple of years in C++ but just for fun rewrote it > in Pyth

Re: Faster Recursive Fibonacci Numbers

2011-05-17 Thread Ian Kelly
On Tue, May 17, 2011 at 9:50 AM, RJB wrote: > I noticed some discussion of recursion. the trick is to find a > formula where the arguments are divided, not decremented. > I've had a "divide-and-conquer" recursion for the Fibonacci numbers > for a couple of years in C++ but just for fun rewrote

Re: FW: help please

2011-05-17 Thread Littlefield, Tyler
Not to be pedantic or anything, and I may not be able to help regardless, but it looks like your space key is fixed, and I don't really care to pick through and try to play hangman with your message. On 5/17/2011 3:43 AM, hamed azarkeshb wrote: From: hamed3...@hotmail.com To: webmas...@python

Re: pyjamas 0.8alpha1 release

2011-05-17 Thread lkcl
On May 4, 7:37 pm, Terry Reedy wrote: > On 5/4/2011 10:06 AM, Luke Kenneth Casson Leighton wrote: > > > after a long delay thepyjamasproject -http://pyjs.org- has begun the > > 0.8 series of releases, beginning with alpha1: > > >https://sourceforge.net/projects/pyjamas/files/pyjamas/0.8/ > > >pyja

Re: Python 3 vs Python 2.7 dilemma

2011-05-17 Thread Eric Snow
On Mon, May 16, 2011 at 10:48 PM, Navkirat Singh wrote: > Hi Guys, > > I have been trying to fight this issue for sometime now. I know that a > large part of the python 3rd party software base has not been ported to > python 3 yet. I am trying to build a web-based enterprise solution for my > clie

Faster Recursive Fibonacci Numbers

2011-05-17 Thread RJB
I noticed some discussion of recursion. the trick is to find a formula where the arguments are divided, not decremented. I've had a "divide-and-conquer" recursion for the Fibonacci numbers for a couple of years in C++ but just for fun rewrote it in Python. It was easy. Enjoy. And tell me how

Re: portable multiprocessing code

2011-05-17 Thread Benjamin Kaplan
On Tue, May 17, 2011 at 8:14 AM, Eric Frederich wrote: > I have written some code using Python 2.7 but I'd like these scripts > to be able to run on Red Hat 5's 2.4.3 version of Python which doesn't > have multiprocessing. > I can try to import multiprocessing and set a flag as to whether it is >

portable multiprocessing code

2011-05-17 Thread Eric Frederich
I have written some code using Python 2.7 but I'd like these scripts to be able to run on Red Hat 5's 2.4.3 version of Python which doesn't have multiprocessing. I can try to import multiprocessing and set a flag as to whether it is available. Then I can create a Queue.Queue instead of a multiproc

Re: Deleting a file?

2011-05-17 Thread garyr
Jerry, There was an error during the install but only required a minor change to an __init__.py file to correct. Works great. Just what I was looking for. Many thanks! Gary "Jerry Hill" wrote in message news:mailman.1654.1305601607.9059.python-l...@python.org... > On Mon, May 16, 2011 at 5:23

Newbie: Python 3.2, search for module dBase + Excel

2011-05-17 Thread Andreas Mosmann
Hi, I am new to python and so I decided to use python 3.2 But, if I found out correctly, the are no working modules concerning Excel and dBase for this python version. Did I only misunderstand anything or is this right? I tried to download and use pydbf and pyexcelerator but both gave me an syn

Re: Python 3 vs Python 2.7 dilemma

2011-05-17 Thread Jorge Romero
I would recommend you going on the Python 2.x path. Python 2.x is far from being deprecated. According to Wesley Chun (active member of Python community and author of Core Python Programming) on a Google I/O talk, everybody will be using Python 3 by 2018, so there's still plenty of time. Besides,

Re: Convert AWK regex to Python

2011-05-17 Thread harrismh777
J wrote: Hello, Hello, J, This is totally off-topic, but I was wondering why you are posting with double messages (triple) all over the place? Your reply-to is set to comp.lang.pyt...@googlegroups.com, and you cc to python-list@python.org... and you're stuff is showing up in newsgr

  1   2   >