Re: python for loop

2009-04-01 Thread Aaron Brady
On Apr 2, 1:29 am, Steven D'Aprano wrote: > On Wed, 01 Apr 2009 21:58:47 -0700, Lie wrote: > > On Apr 1, 7:06 pm, Steven D'Aprano > > wrote: > > >> There is a major clash between the names of ordinals in human languages > >> and zero-based counting. In human languages, the Nth-ordinal item comes

Re: python for loop

2009-04-01 Thread Carl Banks
On Apr 1, 9:23 pm, John O'Hagan wrote: > Despite being thoroughly acclimatised to zero-based indexing and having no > wish to change it, I'm starting to see the OP's point. > > Many of the arguments presented in this thread in favour of zero-based > indexing have rather been arguments for half-ope

Re: Regex trouble

2009-04-01 Thread akshat agarwal
Thanks Andrew. I was also of the same view that perl handled this via some special cases. On Wed, Apr 1, 2009 at 8:32 PM, andrew cooke wrote: > > more exactly, my guess is perl has a special case for this that avoids > doing a search over all possible matchers via the pushdown stack. > > andrew

Re: python for loop

2009-04-01 Thread Steven D'Aprano
On Wed, 01 Apr 2009 21:58:47 -0700, Lie wrote: > On Apr 1, 7:06 pm, Steven D'Aprano > wrote: > >> There is a major clash between the names of ordinals in human languages >> and zero-based counting. In human languages, the Nth-ordinal item comes >> in position N. You can keep that useful conventi

Re: python for loop

2009-04-01 Thread Steven D'Aprano
On Thu, 02 Apr 2009 04:23:32 +, John O'Hagan wrote: > Beyond being part of a conventionally-ordered set of keys, what can an > ordinality of zero actually mean? (That's a sincere question.) In set theory, you start by defining the integers like this: 0 is the cardinality (size) of the empty

Re: A design problem I met again and again.

2009-04-01 Thread Steven D'Aprano
On Thu, 02 Apr 2009 18:47:29 +1300, Lawrence D'Oliveiro wrote: >>> The question is not how many lines or how many methods, but whether it >>> makes sense to remain as one piece or not. In one previous project, I >>> had one source file with nearly 15,000 lines in it. Did it make sense >>> to split

Re: python for loop

2009-04-01 Thread Lie
On Apr 2, 4:05 pm, Aaron Brady wrote: > On Apr 1, 11:58 pm, Lie wrote: > > > On Apr 1, 7:06 pm, Steven D'Aprano > > > wrote: > > > There is a major clash between the names of ordinals in human languages > > > and zero-based counting. In human languages, the Nth-ordinal item comes > > > in positi

Re: Display directory pyqt4 and Python

2009-04-01 Thread Wolfgang Rohdewald
On Donnerstag, 2. April 2009, Dunwitch wrote: > for x in (fileList): > self.ui.displayVideo.setText(x) # This only shows the last self.ui.displayVideo.setText('\n'.join(fileList)) but I would go for a solution with QDirModel / QListView http://doc.trolltech.com/4.5/itemview

Re: A design problem I met again and again.

2009-04-01 Thread Lawrence D'Oliveiro
In message <158986a9-b2d2-413e-9ca0- c584299f1...@f1g2000prb.googlegroups.com>, 一首诗 wrote: > On Apr 1, 4:55 pm, Lawrence D'Oliveiro central.gen.new_zealand> wrote: > >> In message <48506803-a6b9-432b-acef- >> >> b75f76e90...@v23g2000pro.googlegroups.com>, 一首诗 wrote: >> > Until one day I find serv

Re: python for loop

2009-04-01 Thread Aaron Brady
On Apr 1, 11:58 pm, Lie wrote: > On Apr 1, 7:06 pm, Steven D'Aprano > > wrote: > > There is a major clash between the names of ordinals in human languages > > and zero-based counting. In human languages, the Nth-ordinal item comes > > in position N. You can keep that useful convention with zero-b

Re: pygame and socket.recv

2009-04-01 Thread Aaron Brady
On Apr 1, 10:38 pm, Terry Reedy wrote: > Aaron Brady wrote: > > > My game loop looks like this: > > > poll events, get 1 at most > > send to server > > wait for server reply > > render entire frame > > I am very sure that commercial 'real-time' (versus turn-based) > multiplayer games do not operat

Re: python for loop

2009-04-01 Thread Lie
On Apr 1, 7:06 pm, Steven D'Aprano wrote: > There is a major clash between the names of ordinals in human languages > and zero-based counting. In human languages, the Nth-ordinal item comes > in position N. You can keep that useful convention with zero-based > counting by inventing the ugly word

Re: Creating huge data in very less time.

2009-04-01 Thread Tim Roberts
Grant Edwards wrote: >On 2009-03-31, Dave Angel wrote: > >> They were added in NTFS, in the Windows 2000 timeframe, to my >> recollection. > >NTFS was added in NT 3.1 (which predates Win2K by 7-8 years). Although that's true, you didn't read his sentence. Sparse file support was not added to N

Sending SMS using python script

2009-04-01 Thread guptha
hi group, my application needs to send SMS occasionally to all the clients .Is there any library in python that supports in sending SMS. I like to conform few information i gathered in this regard. I can send SMS by two ways 1. Sending SMS using Email clients 2. Using sms gateway to send message

Re: python for loop

2009-04-01 Thread John O'Hagan
On Wed, 1 Apr 2009, Steven D'Aprano wrote: > On Wed, 01 Apr 2009 04:39:26 +0100, Rhodri James wrote: > > Dragging this back to the original topic, you clearly find starting list > > indices from zero unintuitive. To me, with a mathematical background, > > it's not just intuitive, it's correct. Al

Re: pygame and socket.recv

2009-04-01 Thread Terry Reedy
Aaron Brady wrote: My game loop looks like this: poll events, get 1 at most send to server wait for server reply render entire frame I am very sure that commercial 'real-time' (versus turn-based) multiplayer games do not operate that way, at least not the ones I have played. I suspect tha

Re: Which is more Pythonic?

2009-04-01 Thread Terry Reedy
John Machin wrote: On Apr 2, 2:10 am, John Posner wrote: Dennis Lee Bieber presented a code snippet with two consecutive statements that made me think, "I'd code this differently". So just for fun ... is Dennis's original statement or my "_alt" statement more idiomatically Pythonic? Are there e

Re: Thoughts on language-level configuration support?

2009-04-01 Thread jfager
On Apr 1, 8:56 pm, CTO wrote: > > I just mean that there should be a > > clear and easy way to do it, that it should be considered a basic > > service, and that if the best way to satisfy all the goals is to > > integrate it directly into the language, that shouldn't be shied away > > from. > > Ho

Re: Python Goes Mercurial

2009-04-01 Thread Tim Daneliuk
Lawrence D'Oliveiro wrote: > In message , Tim Daneliuk wrote: > >> ,,, when I suggested that better open source tools existed, they kindly >> explained their complete lack of interest in moving several millions >> of lines of code to anything new. > > What was their explanation? > Their entire

Display directory pyqt4 and Python

2009-04-01 Thread Dunwitch
I've looked around for the answer and have decided to ask an expert for the solution. Whats suppose to happen is a user pushes a button and displays the directory content in the text edit window on the gui. Everything works, apart from the fact that it only shows the last file in the directory, not

Re: Python Goes Mercurial

2009-04-01 Thread Lawrence D'Oliveiro
In message <7a1dd0d8-1978-470b- a80d-57478d7f7...@q16g2000yqg.googlegroups.com>, Paul Boddie wrote: > And I've heard stories of "bait and > switch" with Git: "you can do XYZ with Git but not with ..." followed > by the discovery that you can't realistically do XYZ with Git, either. Cite? -- http

Re: Python Goes Mercurial

2009-04-01 Thread Lawrence D'Oliveiro
In message , Tim Daneliuk wrote: > ,,, when I suggested that better open source tools existed, they kindly > explained their complete lack of interest in moving several millions > of lines of code to anything new. What was their explanation? -- http://mail.python.org/mailman/listinfo/python-list

Re: Thoughts on language-level configuration support?

2009-04-01 Thread Steven D'Aprano
On Mon, 30 Mar 2009 06:40:00 -0700, jfager wrote: > The basic idea is that a language could offer syntactic support for > declaring configurable points in the program. The language system would > then offer an api to allow the end user to discover a programs > configuration service, as well as a

Re: Beazley on Generators

2009-04-01 Thread Paul Rubin
Lawrence D'Oliveiro writes: > > However, there are situations when you need thousands of lightweight > > threads of execution ;;; > > The Linux kernel has been tested running hundreds of thousands of threads. Those are still heavyweight threads requiring context switches to switch from one to an

Re: how to handle/generate pcap file

2009-04-01 Thread Evan
On Apr 2, 6:59 am, "Rhodri James" wrote: > On Wed, 01 Apr 2009 14:53:34 +0100, Evan wrote: > > > Hello - > > > I'm trying to decode thepcapfilewhich is packet capture by tcpdump > > or wireshark.   Is there a python module that I can use it for this > > problem? > > > Can python-libpcap or pycap

Re: pygame and socket.recv

2009-04-01 Thread Aaron Brady
On Apr 1, 8:28 pm, Tim Wintle wrote: > On Wed, 2009-04-01 at 17:58 -0700, Aaron Brady wrote: > > I tried writing a small game on a pygame layer.  The graphics are > > fine, and at the moment, it is not graphics intensive.  It is multi- > > player, and for the communication, I am sending a pickle s

Re: pygame and socket.recv

2009-04-01 Thread Tim Wintle
On Wed, 2009-04-01 at 17:58 -0700, Aaron Brady wrote: > I tried writing a small game on a pygame layer. The graphics are > fine, and at the moment, it is not graphics intensive. It is multi- > player, and for the communication, I am sending a pickle string across > a LAN, once per frame. > > I'm

pygame and socket.recv

2009-04-01 Thread Aaron Brady
Hi, I tried writing a small game on a pygame layer. The graphics are fine, and at the moment, it is not graphics intensive. It is multi- player, and for the communication, I am sending a pickle string across a LAN, once per frame. I'm observing some latency. It seems that socket.recv isn't per

Re: Thoughts on language-level configuration support?

2009-04-01 Thread CTO
> I just mean that there should be a > clear and easy way to do it, that it should be considered a basic > service, and that if the best way to satisfy all the goals is to > integrate it directly into the language, that shouldn't be shied away > from. Honestly, the programming language and the con

Help for Toplevel

2009-04-01 Thread Muddy Coder
Hi Folks, I have a problem of handling Toplevel window. Basically, I wrote a listbox viewer with scrollbars, and saved in file listbo.py. Then in my main GUI window, with menu, I need to launch the listbox viewer, in a new window. Obviously, a Toplevel window is needed. But, I failed at passing pa

Re: Matrix operations on character matrix element?

2009-04-01 Thread Robert Kern
On 2009-04-01 19:12, Terry Reedy wrote: olusina eric wrote: I hope somebody will be able to help me here. I am trying to solve some physical problems that will require the generation of some function in terms of some parameters. These functions are derived from matrix operation on “characters”.

Re: Demographic Information about Python

2009-04-01 Thread Terry Reedy
Betiana Krancenblum wrote: Hi, I'm looking for statistical information about where Python is beeing used as a programming language and where it is teached as a language for beginner programmers. Where do you think I can find that information? There is some info at python.org. Ask on the e

Re: Beazley on Generators

2009-04-01 Thread Steven D'Aprano
On Thu, 02 Apr 2009 11:37:46 +1300, Lawrence D'Oliveiro wrote: > In message <13298fc5-5024-4343- > bf5a-7e271a08d...@o11g2000yql.googlegroups.com>, Michele Simionato > wrote: > >> However, there are situations when you need thousands of lightweight >> threads of execution ;;; > > The Linux kerne

Re: Matrix operations on character matrix element?

2009-04-01 Thread Terry Reedy
olusina eric wrote: I hope somebody will be able to help me here. I am trying to solve some physical problems that will require the generation of some function in terms of some parameters. These functions are derived from matrix operation on “characters”. Are there ways numpy/scipy perform mat

Re: Thoughts on language-level configuration support?

2009-04-01 Thread Rhodri James
On Wed, 01 Apr 2009 05:15:19 +0100, jfager wrote: On Mar 31, 10:44 pm, "Rhodri James" wrote: [...] What restrictions can be put on the value you get back? What can the help system say about this, or do we have to go back to doing all that by hand? Now translate all those questions into the

Re: python for loop

2009-04-01 Thread Rhodri James
On Wed, 01 Apr 2009 15:12:27 +0100, Lada Kugis wrote: On 01 Apr 2009 08:06:28 GMT, Steven D'Aprano wrote: There are advantages and disadvantages to both systems, but on balance, I think that zero-based is a better system for programming, and one-based for natural language. Nicely put

Re: how to handle/generate pcap file

2009-04-01 Thread Rhodri James
On Wed, 01 Apr 2009 14:53:34 +0100, Evan wrote: Hello - I'm trying to decode the pcap file which is packet capture by tcpdump or wireshark. Is there a python module that I can use it for this problem? Can python-libpcap or pycap or dpkt do that? A quick browse of the pypcap website sugge

Re: python for loop

2009-04-01 Thread Ricardo Aráoz
Lada Kugis wrote: > On 01 Apr 2009 01:26:41 GMT, Steven D'Aprano > wrote: > > >> Why Python (and other languages) count from zero instead of one, and >> why half-open intervals are better than closed intervals: >> >> http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-z

Re: Beazley on Generators

2009-04-01 Thread Lawrence D'Oliveiro
In message <13298fc5-5024-4343- bf5a-7e271a08d...@o11g2000yql.googlegroups.com>, Michele Simionato wrote: > However, there are situations when you need thousands of lightweight > threads of execution ;;; The Linux kernel has been tested running hundreds of thousands of threads. -- http://mail.py

Re: python for loop

2009-04-01 Thread Carl Banks
On Apr 1, 2:32 pm, Arnaud Delobelle wrote: > Lada Kugis writes: > > I'm coming from fortran and c background so I'm certainly biased by > > them. But if you could explain one thing to me: > > > in fortran for example: > > for i=1,n > > goes from 1,2,3,4,...,n > > > in python for example: > > for

Re: List of paths

2009-04-01 Thread Scott David Daniels
Nico Grubert wrote: Dear Python developers... I have the following (sorted) list I want to remove all paths x from the list if there is a path y in the list which is part of x so y.startswith(x) is true. The list I want to have is: ['/notebook', '/desktop', '/server/hp/proliant'] Any ide

Re: Beazley on Generators

2009-04-01 Thread Carl Banks
On Mar 31, 10:03 pm, Terry Reedy wrote: > At PyCon2008, David Beazley presented an excellent talk on generators. > Generator Tricks for Systems > Programmershttp://www.dabeaz.com/generators/index.html > > At PyCon2009, he followed up with another talk on more advanced > generator usage, which Gui

Re: Which is more Pythonic? (was: Detecting Binary content in files)

2009-04-01 Thread John Machin
On Apr 2, 2:10 am, John Posner wrote: > Dennis Lee Bieber presented a code snippet with two consecutive statements > that made me think, "I'd code this differently". So just for fun ... is > Dennis's original statement or my "_alt" statement more idiomatically > Pythonic? Are there even more Pytho

Re: Converting a PIL image object to a buffer

2009-04-01 Thread Simon Hibbs
On 1 Apr, 21:43, Gary Herron wrote: > Simon Hibbs wrote: > > I'm trying to dump a snapshot of my application window to the > > clipboard. I can use ImageGrab in PIL to get the screen data into a > > PIL image object, which i have converted to a bitmap using ImageWin, > > but when I try to pass thi

Re: Detecting Binary content in files

2009-04-01 Thread John Machin
On Apr 2, 8:39 am, John Machin wrote: > On Apr 1, 4:59 pm, Dennis Lee Bieber wrote: > > > > > On Tue, 31 Mar 2009 14:26:08 -0700 (PDT), ritu > > declaimed the following in > > gmane.comp.python.general: > > > > if ( ( -B $filename || > > >            $filename =~ /\.pdf$/ ) && > > >          -s

Re: Beazley on Generators

2009-04-01 Thread Craig Allen
this is great, thanks... we have used generators to create something akin to a cooperative tasking environment... not to implement multitasking, but to be able to control low level data processing scripts. These scripts, written as generators, yield control to a control loop which then can pause,

Re: A design problem I met again and again.

2009-04-01 Thread Carl Banks
On Apr 1, 12:44 am, 一首诗 wrote: > I got the same problem when writing C#/C++ when I have to provide a > lot of method to my code's user. So I create a big class as the entry > point of my code. Although these big classes doesn't contains much > logic, they do grow bigger and bigger. This seems

TIOBE programming language community index

2009-04-01 Thread Steven D'Aprano
The TIOBE programming community index has some interesting data this month. http://www.tiobe.com/content/paperinfo/tpci/index.html * The top three languages, C, C++ and Java between them have a combined rating approaching 50%; * Python has increased popularity over the last year, from positio

Re: Detecting Binary content in files

2009-04-01 Thread John Machin
On Apr 1, 4:59 pm, Dennis Lee Bieber wrote: > On Tue, 31 Mar 2009 14:26:08 -0700 (PDT), ritu > declaimed the following in > gmane.comp.python.general: > > > > > if ( ( -B $filename || > >            $filename =~ /\.pdf$/ ) && > >          -s $filename > 0 ) { > >         return(1); > >     } > >

Re: double/float precision question

2009-04-01 Thread Steven D'Aprano
On Wed, 01 Apr 2009 19:13:33 +0200, TP wrote: > Hi everybody, > > Try the following python statements: > "%.40f" % 0.222 > '0.098864108374982606619596' float( 0.222) > 0.1 Remove the leading quote

Re: python for loop

2009-04-01 Thread Arnaud Delobelle
Lada Kugis writes: > I'm coming from fortran and c background so I'm certainly biased by > them. But if you could explain one thing to me: > > in fortran for example: > for i=1,n > goes from 1,2,3,4,...,n > > in python for example: > for i in range(1,n) > goes from 1,2,3,4,...,n-1 > (that is, it

Re: Alpha/For Discussion: RPMs for around 3,000 PyPI packages.

2009-04-01 Thread andrew cooke
Sean Reifschneider wrote: > At PyCon I got this idea in my head to try building packages for > everything > in the cheeseshop. I've had some success, getting over 3,000 packages > built on Fedora 10 (and fewer on CentOS 5 and fewer still on 4). This is > out of 6176 packages. neat idea. the inf

Alpha/For Discussion: RPMs for around 3,000 PyPI packages.

2009-04-01 Thread Sean Reifschneider
At PyCon I got this idea in my head to try building packages for everything in the cheeseshop. I've had some success, getting over 3,000 packages built on Fedora 10 (and fewer on CentOS 5 and fewer still on 4). This is out of 6176 packages. I've made these initial packages, which should be consi

Re: Demographic Information about Python

2009-04-01 Thread Chris Rebert
2009/4/1 Betiana Krancenblum : > Hi, > > I'm looking for statistical information about where Python is beeing used as > a programming language and where it is teached as a language for beginner > programmers. > Where do you think I can find that information? I don't think there are any statistics

py2exe problem

2009-04-01 Thread Wolfgang Forstmeier
Hey list, what kind of error do I have with getting this error at starting my app. Im am not using IdleConf.GetOption right now. Warning: configHandler.py - IdleConf.GetOption - problem retrieving configration option 'name' from section 'Keys'. returning default value: '' -- http://mail.pyth

Re: Converting a PIL image object to a buffer

2009-04-01 Thread Gary Herron
Simon Hibbs wrote: I'm trying to dump a snapshot of my application window to the clipboard. I can use ImageGrab in PIL to get the screen data into a PIL image object, which i have converted to a bitmap using ImageWin, but when I try to pass this to the clipboard using - win32clipboard.SetClipboa

Demographic Information about Python

2009-04-01 Thread Betiana Krancenblum
Hi, I'm looking for statistical information about where Python is beeing used as a programming language and where it is teached as a language for beginner programmers. Where do you think I can find that information? Thanks, Betiana __

Re: double/float precision question

2009-04-01 Thread Nick Craig-Wood
TP wrote: > Hi everybody, > > Try the following python statements: > > >>> "%.40f" % 0.222 > '0.098864108374982606619596' > >>> float( 0.222) > 0.1 > > It seems the first result is the same than the fol

Re: imp.load_source() - explanation needed

2009-04-01 Thread Albert Hopkins
On Wed, 2009-04-01 at 12:17 -0700, mynthon wrote: > Hi! > > I need help. I don't understand what doc says. > > I load module from path testmod/mytest.py using imp.load_source(). My > code is > > import imp > testmod = imp.load_source('koko', 'testmod/mytest.py) > print testmod > > but i don't u

Re: Stripping non-numbers from a file parse without nested lists?

2009-04-01 Thread daku9999
On Apr 1, 8:10 am, jay logan wrote: > On Apr 1, 11:05 am, jay logan wrote: > > > > > On Apr 1, 2:35 am, daku9...@gmail.com wrote: > > > > On Mar 31, 6:47 pm, "Rhodri James" > > > wrote: > > > > > What you're doing (pace error checking) seems fine for the data > > > > structures that you're using

Converting a PIL image object to a buffer

2009-04-01 Thread Simon Hibbs
I'm trying to dump a snapshot of my application window to the clipboard. I can use ImageGrab in PIL to get the screen data into a PIL image object, which i have converted to a bitmap using ImageWin, but when I try to pass this to the clipboard using - win32clipboard.SetClipboardData(win32clipboard

imp.load_source() - explanation needed

2009-04-01 Thread mynthon
Hi! I need help. I don't understand what doc says. I load module from path testmod/mytest.py using imp.load_source(). My code is import imp testmod = imp.load_source('koko', 'testmod/mytest.py) print testmod but i don't understand whatt is first (name) argument for. Docs says that "The name arg

Re: A design problem I met again and again.

2009-04-01 Thread Martin P. Hellwig
一首诗 wrote: But I think the first step to resolve a problem is to describe it. In that way, I might find the answer myself That is an excellent approach, knowing you have a problem and describing it is actually the hardest part of a design, the rest is more like a puzzle. What I guess so fa

Re: New super python vm

2009-04-01 Thread r
On Apr 1, 1:55 pm, El Loco wrote: > Hi all, > > This is to announce that right after a few weeks after our first > coding sprint, > our project, "Unswallowed-snot", has already achieved substantial > results. > In our tests, runtime performance shows a 150x slowdown. > This is due mainly to our le

Re: league problem in python

2009-04-01 Thread r
On Apr 1, 12:35 pm, Ross wrote: [snip] > How should I go about starting this problem...I'm feel like this is a > really simple problem, but I'm having writer's/coder's block. Can you > guys help? Ross, I highly disagree with bear on this. What you have here is a 90 percent math problem and a 10 p

[Ann] New super python vm

2009-04-01 Thread El Loco
Hi all, This is to announce that right after a few weeks after our first coding sprint, our project, "Unswallowed-snot", has already achieved substantial results. In our tests, runtime performance shows a 150x slowdown. This is due mainly to our lead developer (myself) still not knowing enough pyt

Re: double/float precision question

2009-04-01 Thread Dave Angel
It's not at all clear what you really want. You say you want to "use" the %e format, but then imply you're then going to turn it back into a float. Since I don't know what the end goal is, I'll just comment generally. All Python floating point is equivalent to the 'double' type of the C imp

Re: List of paths

2009-04-01 Thread Paul McGuire
On Apr 1, 3:57 am, Nico Grubert wrote: > Dear Python developers > > I have the following (sorted) list. > ['/notebook', >   '/notebook/mac', >   '/notebook/mac/macbook', >   '/notebook/mac/macbookpro', >   '/notebook/pc', >   '/notebook/pc/lenovo', >   '/notebook/pc/hp', >   '/notebook/pc/sony', >

Re: A design problem I met again and again.

2009-04-01 Thread Nick Craig-Wood
一首诗 wrote: > But I think the first step to resolve a problem is to describe it. In > that way, I might find the answer myself :-) That is a great saying! To answer your original question, split your code up into sections that can be tested independently. If you can test code in a isolated wa

Re: Creating a Python Module - Available Implementations

2009-04-01 Thread Dave Angel
A python source file *is* a module. And you import it the same way you import any of the system modules. Just use the basename, without the .py extension. import mylib The only catch is where you locate this module. When you first write it, just put it in the same directory as your script

Re: python for loop

2009-04-01 Thread Lou Pecora
In article <91t6t4hfjicgvdrcgkhdjfro3ko3ktu...@4ax.com>, Lada Kugis wrote: > On Wed, 1 Apr 2009 00:40:17 -0700 (PDT), Carl Banks > wrote: > > > > >Lada, > > > >I am also an engineer, and I can tell your idea of intuitive is not > >universal, even among engineers. I certainly do not lean towar

Re: league problem in python

2009-04-01 Thread bearophileHUGS
Ross: > How should I go about starting this problem...I'm feel like this is a > really simple problem, but I'm having writer's/coder's block. Can you > guys help? There are refined ways to design a program, but this sounds like a simple and small one, so you probably don't need much formal things

Re: double/float precision question

2009-04-01 Thread Mensanator
On Apr 1, 12:13 pm, TP wrote: > Hi everybody, > > Try the following python statements: > > >>> "%.40f" % 0.222 > > '0.098864108374982606619596'>>> float( > 0.222) > > 0.1 > > It seems the first result is the s

Re: python for loop

2009-04-01 Thread Mensanator
On Apr 1, 9:08 am, Lada Kugis wrote: > On Wed, 1 Apr 2009 00:40:17 -0700 (PDT), Carl Banks > > > > > > wrote: > > >Lada, > > >I am also an engineer, and I can tell your idea of intuitive is not > >universal, even among engineers.  I certainly do not lean toward one- > >based indexing. > > >From a

Re: Thoughts on language-level configuration support?

2009-04-01 Thread Aaron Brady
On Apr 1, 6:29 am, jfager wrote: > On Apr 1, 3:29 am, Kay Schluehr wrote: > > > > "Discoverable", as in built-in tools that let you have the following > > > conversation:  "Program, tell me all the things I can configure about > > > you" - "Okay, here they all are".  No digging through the source

RE: Which is more Pythonic? (was: Detecting Binary content in files)

2009-04-01 Thread John Posner
>> >    mrkrs_alt2 = filter(lambda b: b > 127 or b in list("\r\n\t"), block) >> > >> >> Never tested my 'pythonicity', but I would do: >> >> def test(b) : b > 127 or b in r"\r\n\t" Oops! Clearly, b in "\r\n\t" is preferable to ... b in list("\r\n\t") You do *not* want to u

league problem in python

2009-04-01 Thread Ross
I'm new to programming and have chosen Python as my first language. I've gone through Allen Downey's Think Python book and I think I'm ready to dive into a project. The first problem I've chosen to tackle is a problem I have seen at my tennis club. Each spring/fall, the pro puts out a sheet of pape

Re: The spam to content ratio of this group

2009-04-01 Thread r
On Apr 1, 9:57 am, Grant Edwards wrote: > On 2009-04-01, Eric wrote: > 3) Simply ignoring all posts made from Google Groups works >    quite well. Yea, there's no spam in Usenet land APRIL FOOLS -- http://mail.python.org/mailman/listinfo/python-list

double/float precision question

2009-04-01 Thread TP
Hi everybody, Try the following python statements: >>> "%.40f" % 0.222 '0.098864108374982606619596' >>> float( 0.222) 0.1 It seems the first result is the same than the following C program: #

Re: python for loop

2009-04-01 Thread MRAB
andrew cooke wrote: MRAB wrote: Steven D'Aprano wrote: On Wed, 01 Apr 2009 04:58:48 +0200, Lada Kugis wrote: Why do we try to create languages that are intuitive to humans, then ? Because of the foolish hope that sufficiently easy syntax will make excellent programmers out of average people.

Re: python for loop

2009-04-01 Thread Carl Banks
On Apr 1, 7:08 am, Lada Kugis wrote: > On Wed, 1 Apr 2009 00:40:17 -0700 (PDT), Carl Banks > > > > > > wrote: > > >Lada, > > >I am also an engineer, and I can tell your idea of intuitive is not > >universal, even among engineers.  I certainly do not lean toward one- > >based indexing. > > >From a

Creating a Python Module - Available Implementations

2009-04-01 Thread ntwrkd
I have been browsing through creating a Python module for common custom functions that I frequently use, but I am wondering, is this the best method, and is it necessary? Really all I need is to import functions from another plaintext Python source file, how might I do this? What would merit the ne

Re: Beazley on Generators

2009-04-01 Thread Peter Pearson
On Wed, 01 Apr 2009 01:03:50 -0400, Terry Reedy wrote: > At PyCon2008, David Beazley presented an excellent talk on generators. > Generator Tricks for Systems Programmers > http://www.dabeaz.com/generators/index.html > > At PyCon2009, he followed up with another talk on more advanced > generator

Re: Which is more Pythonic? (was: Detecting Binary content in files)

2009-04-01 Thread bieffe62
On Apr 1, 5:10 pm, John Posner wrote: > Dennis Lee Bieber presented a code snippet with two consecutive statements > that made me think, "I'd code this differently". So just for fun ... is > Dennis's original statement or my "_alt" statement more idiomatically > Pythonic? Are there even more Pytho

Matrix operations on character matrix element?

2009-04-01 Thread olusina eric
I hope somebody will be able to help me here. I am trying to solve some physical problems that will require the generation of some function in terms of some parameters. These functions are derived from matrix operation on “characters”. Are there ways numpy/scipy perform matrix operations on cha

Re: A design problem I met again and again.

2009-04-01 Thread Jeremiah Dodds
On Wed, Apr 1, 2009 at 3:40 PM, 一首诗 wrote: > What are the average size of source files in your project? If it's > far lower than 15,000, don't feel it's a little unbalance? > -- > http://mail.python.org/mailman/listinfo/python-list > While I think 15,000 is, in the vast majority of cases, qu

Re: List of paths

2009-04-01 Thread Eugene Perederey
Sure, generators rock! :-) 2009/4/1 andrew cooke : > Nico Grubert wrote: >>> May be not so much pythonic, but works >>> >>> for i in range(len(q)): >>>     for x in q[i:]: >>>        if x.startswith(q[i]) and x!=q[i]: >>>            q.remove(x) >> >> ...but works fine. Thanks, Eugene. >> Also th

Re: The spam to content ratio of this group

2009-04-01 Thread Tim Golden
s...@pobox.com wrote: Eric> is getting very high. Why aren't captcha's used to prevent all of Eric> this noise? Steven> /me opens mouth to make sarcastic comment Steven> /me shuts mouth again Steven> That's like saying "There's a lot of oil slicks washing up onto Steven>

Re: The spam to content ratio of this group

2009-04-01 Thread skip
Eric> is getting very high. Why aren't captcha's used to prevent all of Eric> this noise? Steven> /me opens mouth to make sarcastic comment Steven> /me shuts mouth again Steven> That's like saying "There's a lot of oil slicks washing up onto Steven> the beach. Why don't w

Re: xml to xhtml

2009-04-01 Thread Joe Riopel
On Wed, Apr 1, 2009 at 10:43 AM, wrote: > If anyone can give me some guidance what should be the best way to > generate html/xhtml page using python would be great. I am open to > other options like xsl or anything else that can make things simple. Since you're open to other options, I would tak

Re: Beazley on Generators

2009-04-01 Thread andrew cooke
Kay Schluehr wrote: > There is just one thing I find disappointing. Since the talk is almost > a compendium of advanced uses of generators I'm missing a reference to > Peter Thatchers implementation of monads: > > http://www.valuedlessons.com/2008/01/monads-in-python-with-nice-syntax.html > > Peter

Re: Stripping non-numbers from a file parse without nested lists?

2009-04-01 Thread jay logan
On Apr 1, 11:05 am, jay logan wrote: > On Apr 1, 2:35 am, daku9...@gmail.com wrote: > > > > > On Mar 31, 6:47 pm, "Rhodri James" > > wrote: > > > > What you're doing (pace error checking) seems fine for the data > > > structures that you're using.  I'm not entirely clear what your usage > > > pat

Re: python for loop

2009-04-01 Thread andrew cooke
MRAB wrote: > Steven D'Aprano wrote: >> On Wed, 01 Apr 2009 04:58:48 +0200, Lada Kugis wrote: >> >>> Why do we try to create languages that are intuitive to humans, then ? >> >> Because of the foolish hope that sufficiently easy syntax will make >> excellent programmers out of average people. >> >>

Which is more Pythonic? (was: Detecting Binary content in files)

2009-04-01 Thread John Posner
Dennis Lee Bieber presented a code snippet with two consecutive statements that made me think, "I'd code this differently". So just for fun ... is Dennis's original statement or my "_alt" statement more idiomatically Pythonic? Are there even more Pythonic alternative codings? mrkrs = [b for b i

Re: Stripping non-numbers from a file parse without nested lists?

2009-04-01 Thread jay logan
On Apr 1, 2:35 am, daku9...@gmail.com wrote: > On Mar 31, 6:47 pm, "Rhodri James" > wrote: > > > What you're doing (pace error checking) seems fine for the data > > structures that you're using.  I'm not entirely clear what your usage > > pattern for "dip" and "dir" is once you've got them, so I c

Re: List of paths

2009-04-01 Thread andrew cooke
Nico Grubert wrote: >> May be not so much pythonic, but works >> >> for i in range(len(q)): >> for x in q[i:]: >>if x.startswith(q[i]) and x!=q[i]: >>q.remove(x) > > ...but works fine. Thanks, Eugene. > Also thanks to Andrew. Your example works fine, too. Thanks to remind me

Re: Regex trouble

2009-04-01 Thread andrew cooke
more exactly, my guess is perl has a special case for this that avoids doing a search over all possible matchers via the pushdown stack. andrew cooke wrote: > > ".*?" is a "not greedy" match, which is significantly more difficult to > handle than a normal ".*". so the performance will depend on

Re: Regex trouble

2009-04-01 Thread andrew cooke
".*?" is a "not greedy" match, which is significantly more difficult to handle than a normal ".*". so the performance will depend on quite complex details of how the regular expression engine is implemented. it wouldn't surprise me if perl was better here, because it comes from a background with

Re: The spam to content ratio of this group

2009-04-01 Thread Grant Edwards
On 2009-04-01, Eric wrote: > is getting very high. Why aren't captcha's used to prevent all of this > noise? 1) Captcha's don't work. 2) The NNTP protocol doesn't support Captcha's 3) Simply ignoring all posts made from Google Groups works quite well. -- Grant Edwards gr

The spam to content ratio of this group

2009-04-01 Thread Eric
is getting very high. Why aren't captcha's used to prevent all of this noise? -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >