Re: file seek is slow

2010-03-10 Thread sjdevn...@yahoo.com
On Mar 10, 6:01 pm, Neil Hodgson wrote: > Metalone: > > > As it turns out each call is only > > 646 nanoseconds slower than 'C'. > > However, that is still 80% of the time to perform a file seek, > > which I would think is a relatively slow operation compared to just > > making a system call. > >

Re: Evaluate my first python script, please

2010-03-05 Thread sjdevn...@yahoo.com
On Mar 5, 10:53 am, Pete Emerson wrote: > Thanks for your response, further questions inline. > > On Mar 4, 11:07 am, Tim Wintle wrote: > > > On Thu, 2010-03-04 at 10:39 -0800, Pete Emerson wrote: > > > I am looking for advice along the lines of "an easier way to do this" > > > or "a more python

Re: Evaluate my first python script, please

2010-03-04 Thread sjdevn...@yahoo.com
On Mar 4, 1:39 pm, Pete Emerson wrote: > I've written my first python program, and would love suggestions for > improvement. > > I'm a perl programmer and used a perl version of this program to guide > me. So in that sense, the python is "perlesque" > > This script parses /etc/hosts for hostnames,

Re: When will Java go mainstream like Python?

2010-02-24 Thread sjdevn...@yahoo.com
On Feb 24, 8:05 pm, Lawrence D'Oliveiro wrote: > In message , Wanja Gayk wrote: > > > Reference counting is about the worst technique for garbage collection. > > It avoids the need for garbage collection. That's like saying that driving a VW Beetle avoids the need for an automobile. Reference co

Re: The future of "frozen" types as the number of CPU cores increases

2010-02-23 Thread sjdevn...@yahoo.com
On Feb 23, 8:03 pm, Nobody wrote: > On Mon, 22 Feb 2010 22:27:54 -0800, sjdevn...@yahoo.com wrote: > > Basically, multiprocessing is always hard--but it's less hard to start > > without shared everything.  Going with the special case (sharing > > everything, aka threadi

Re: The future of "frozen" types as the number of CPU cores increases

2010-02-22 Thread sjdevn...@yahoo.com
On Feb 22, 9:24 pm, John Nagle wrote: > sjdevn...@yahoo.com wrote: > > On Feb 20, 9:58 pm, John Nagle wrote: > >> sjdevn...@yahoo.com wrote: > >>> On Feb 18, 2:58 pm, John Nagle wrote: > >>>>     Multiple processes are not the answer.  That means lo

Re: The future of "frozen" types as the number of CPU cores increases

2010-02-22 Thread sjdevn...@yahoo.com
On Feb 22, 9:24 pm, John Nagle wrote: > sjdevn...@yahoo.com wrote: > > On Feb 20, 9:58 pm, John Nagle wrote: > >> sjdevn...@yahoo.com wrote: > >>> On Feb 18, 2:58 pm, John Nagle wrote: > >>>>     Multiple processes are not the answer.  That means lo

Re: The future of "frozen" types as the number of CPU cores increases

2010-02-20 Thread sjdevn...@yahoo.com
On Feb 20, 9:58 pm, John Nagle wrote: > sjdevn...@yahoo.com wrote: > > On Feb 18, 2:58 pm, John Nagle wrote: > >>     Multiple processes are not the answer.  That means loading multiple > >> copies of the same code into different areas of memory.  The cache > &g

Re: The future of "frozen" types as the number of CPU cores increases

2010-02-20 Thread sjdevn...@yahoo.com
On Feb 18, 2:58 pm, John Nagle wrote: >     Multiple processes are not the answer.  That means loading multiple > copies of the same code into different areas of memory.  The cache > miss rate goes up accordingly. A decent OS will use copy-on-write with forked processes, which should carry throug

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread sjdevn...@yahoo.com
On Feb 20, 1:30 am, Lawrence D'Oliveiro wrote: > In message , Rhodri James wrote: > > > In classic Pascal, a procedure was distinct from a function in that it had > > no return value.  The concept doesn't really apply in Python; there are no > > procedures in that sense, since if a function termin

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread sjdevn...@yahoo.com
On Feb 20, 1:28 am, Lawrence D'Oliveiro wrote: > In message <87eikjcuzk@benfinney.id.au>, Ben Finney wrote: > > > > > Lawrence D'Oliveiro writes: > > >> In message , cjw wrote: > > >> > Aren't lambda forms better described as function? > > >> Is this a function? > > >>     lambda : None > > >

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread sjdevn...@yahoo.com
On Feb 18, 10:58 pm, Paul Rubin wrote: > Steve Howell writes: > >> But frankly, although there's no reason that you _have_ to name the > >> content at each step, I find it a lot more readable if you do: > > >> def print_numbers(): > >>     tuples = [(n*n, n*n*n) for n in (1,2,3,4,5,6)] > >>     f

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread sjdevn...@yahoo.com
On Feb 18, 11:15 am, Steve Howell wrote: >     def print_numbers() >         [1, 2, 3, 4, 5, 6].map { |n| >             [n * n, n * n * n] >         }.reject { |square, cube| >             square == 25 || cube == 64 >         }.map { |square, cube| >             cube >         }.each { |n| >      

Re: The future of "frozen" types as the number of CPU cores increases

2010-02-17 Thread sjdevn...@yahoo.com
On Feb 17, 2:35 am, Steven D'Aprano wrote: > On Tue, 16 Feb 2010 21:09:27 -0800, John Nagle wrote: > >     Yes, we're now at the point where all the built-in mutable types > > have "frozen" versions.  But we don't have that for objects.  It's > > generally considered a good thing in language desig

Re: To (monkey)patch or not to (monkey)patch, that is the question

2010-02-09 Thread sjdevn...@yahoo.com
On Feb 9, 3:54 am, George Sakkis wrote: > I was talking to a colleague about one rather unexpected/undesired > (though not buggy) behavior of some package we use. Although there is > an easy fix (or at least workaround) on our end without any apparent > side effect, he strongly suggested extending

Re: how to run part of my python code as root

2010-02-04 Thread sjdevn...@yahoo.com
On Feb 4, 2:05 pm, Tomas Pelka wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hey, > > is there possibility how to run part of my code (function for example) > as superuser. > > Or only way how to do this is create a wrapper and run is with Popen > through sudo (but I have to configu

Re: Python and Ruby

2010-02-02 Thread sjdevn...@yahoo.com
On Feb 2, 5:01 pm, Jonathan Gardner wrote: > On Feb 1, 6:36 pm, John Bokma wrote: > > > > > > > Jonathan Gardner writes: > > > One of the bad things with languages like perl > > > FYI: the language is called Perl, the program that executes a Perl > > program is called perl. > > > > without paren

Re: myths about python 3

2010-01-27 Thread sjdevn...@yahoo.com
On Jan 27, 9:22 am, Daniel Fetchinson wrote: > >> Hi folks, > > >> I was going to write this post for a while because all sorts of myths > >> periodically come up on this list about python 3. I don't think the > >> posters mean to spread false information on purpose, they simply are > >> not aware

Re: Library support for Python 3.x

2010-01-27 Thread sjdevn...@yahoo.com
On Jan 27, 2:03 pm, Paul Rubin wrote: > a...@pythoncraft.com (Aahz) writes: > > From my POV, your question would be precisely identical if you had > > started your project when Python 2.3 was just released and wanted to > > know if the libraries you selected would be available for Python 2.6. > >

Re: Bare Excepts

2010-01-14 Thread sjdevn...@yahoo.com
On Jan 2, 9:35 pm, Dave Angel wrote: > Steven D'Aprano wrote: > > On Sat, 02 Jan 2010 09:40:44 -0800, Aahz wrote: > > >> OTOH, if you want to do something different depending on whether the > >> file exists, you need to use both approaches: > > >> if os.path.exists(fname): > >>     try: > >>      

Re: read text file byte by byte

2009-12-15 Thread sjdevn...@yahoo.com
On Dec 14, 11:44 pm, Terry Reedy wrote: > On 12/14/2009 7:37 PM, Gabriel Genellina wrote: > > > > > En Mon, 14 Dec 2009 18:09:52 -0300, Nobody escribió: > >> On Sun, 13 Dec 2009 22:56:55 -0800, sjdevn...@yahoo.com wrote: > > >>> The 3.1 documentat

Re: read text file byte by byte

2009-12-14 Thread sjdevn...@yahoo.com
On Dec 14, 4:09 pm, Nobody wrote: > On Sun, 13 Dec 2009 22:56:55 -0800, sjdevn...@yahoo.com wrote: > > The 3.1 documentation specifies that file.read returns bytes: > > Does it need fixing? > > There are no file objects in 3.x. Then the documentation definitely needs fixing;

Re: read text file byte by byte

2009-12-14 Thread sjdevn...@yahoo.com
On Dec 14, 1:57 pm, Dennis Lee Bieber wrote: > On Sun, 13 Dec 2009 22:56:55 -0800 (PST), "sjdevn...@yahoo.com" > declaimed the following in > gmane.comp.python.general: > > > > > > > > > The 3.1 documentation specifies that file.read returns bytes

Re: read text file byte by byte

2009-12-13 Thread sjdevn...@yahoo.com
On Dec 13, 5:56 pm, "Rhodri James" wrote: > On Sun, 13 Dec 2009 06:44:54 -, Steven D'Aprano   > > wrote: > > On Sat, 12 Dec 2009 22:15:50 -0800, daved170 wrote: > > >> Thank you all. > >> Dennis I really liked you solution for the issue but I have two question > >> about it: > >> 1) My origin