Re: DTD Parsing

2010-11-09 Thread Ian Kelly
On 11/9/2010 11:14 PM, r0g wrote: Me too when possible, TBH if I only needed strings and there was no pressing security issue I'd just do this... config = {} for line in (open("config.txt", 'r')): if len(line) > 0 and line[0] <> "#": param, value = line.rstrip().split("=",1) config[param] = valu

Am I The Only One Who Keeps Reading “Numpy” as “Numpty”?

2010-11-09 Thread Lawrence D'Oliveiro
Sorry... -- http://mail.python.org/mailman/listinfo/python-list

Re: Allowing comments after the line continuation backslash

2010-11-09 Thread Lawrence D'Oliveiro
In message <878w12kt5x.fsf@metalzone.distorted.org.uk>, Mark Wooding wrote: > Lawrence D'Oliveiro writes: > >> Maybe you should look at the code in context >> , then you can express some >> more opinions on how to improve it. > > 1. class keyval:

Re: Allowing comments after the line continuation backslash

2010-11-09 Thread Lawrence D'Oliveiro
In message , Robert Kern wrote: > For me, putting the brackets on their own lines (and using a trailing > comma) has little to do with increasing readability. It's for making > editing easier. Keeping all of the items consistent means that in order to > add, delete, or move any item is the same o

Re: Silly newbie question - Caret character (^)

2010-11-09 Thread Lawrence D'Oliveiro
In message , Seebs wrote: > I may have my gripes about Python, but I will say this: The Python > community seems full of people who are passionate about writing good code. And they know how to write good code in other languages, not just Python. In other words, they know programming, not just P

Re: DTD Parsing

2010-11-09 Thread r0g
On 10/11/10 03:36, Asun Friere wrote: On Nov 10, 2:02 pm, Christian Heimes wrote: Am 10.11.2010 03:44, schrieb Felipe Bastos Nunes: I'd like to know too. I work with java and jdom, but I'm doing personal things in python, and plan to go full python in the next 2 years. Xml is my first option

Re: DTD Parsing

2010-11-09 Thread Stefan Behnel
Asun Friere, 10.11.2010 06:41: On Nov 10, 4:11 pm, Stefan Behnel wrote: What's your interest in parsing a DTD if you're not up to validating XML? Spitting out boilerplate code. [...] A few years back I used a similar technique to write some boiler plate python code where xml was isomorphicall

Class extension confusion :(

2010-11-09 Thread r0g
I have a subclass of BaseHHTPRequestHandler which uses a dictonary "paths" and a function "api_call" which are defined in the main namespace of the module. I'd rather I was able to pass these object to the constructor and store them as data attributes "self.paths" and "self.api_call" but I'm no

Re: DTD Parsing

2010-11-09 Thread Asun Friere
On Nov 10, 4:11 pm, Stefan Behnel wrote: > What's your interest in parsing a DTD if you're not up to validating XML? Spitting out boilerplate code. Just at the moment I'm creating a stub XSLT sheet, which creates a template per element (from a 3rd party DTD with 143 elements, yuk!) containing n

Re: DTD Parsing

2010-11-09 Thread Stefan Behnel
Asun Friere, 10.11.2010 04:42: On Nov 10, 2:02 pm, Christian Heimes wrote: Back to the initial question: I highly recommend LXML for any kind of XML processing, validation, XPath etc. Sorry Christian, didn't realise at first that that was a response to MY intial question. But does lxml actua

Re: Why "flat is better than nested"?

2010-11-09 Thread alex23
Gregory Ewing wrote: > I get it. Does that mean that I don't get it? Mu. -- http://mail.python.org/mailman/listinfo/python-list

Re: Compare source code

2010-11-09 Thread Dan Stromberg
On Thu, Nov 4, 2010 at 10:45 AM, Tim Harig wrote: > I also looked at F# and Scala; but, neither are really applicable on my > chosen platform. With F# being such a new language, I suspect that it > borrowed its indent practices either from Haskell or from Python. > I'm pretty sure F# gets its wh

Re: Silly newbie question - Caret character (^)

2010-11-09 Thread Seebs
On 2010-11-10, Lawrence D'Oliveiro wrote: > What was sad to me to read was this > phrase of yours: > ... but rather, takes the shortest path to something that won't get > those complaints anymore ... > To me, this is the sign of someone who doesn't

Re: Silly newbie question - Caret character (^)

2010-11-09 Thread Lawrence D'Oliveiro
In message , Seebs wrote: > In particular, he's very good at making up complications from whole cloth > which aren't really problems, and then offering "solutions" which show > people a clever trick to work around the problem. (e.g., his elaborate > revelations about how to use feof() in C to wor

Re: Commercial or Famous Applicattions.?

2010-11-09 Thread Lawrence D'Oliveiro
In message , Martin Gregorie wrote: > ...and don't forget getmail, a better behaved replacement for fetchmail. I was just looking this up in the Getmail FAQ, since I didn’t know about the issues with Fetchmail. That’s it, ESR is off my Christmas-card list... -- http://mail.python.org/mailman/l

Re: DTD Parsing

2010-11-09 Thread Asun Friere
On Nov 10, 2:02 pm, Christian Heimes wrote: > Back to the initial question: I highly recommend LXML for any kind of > XML processing, validation, XPath etc. Sorry Christian, didn't realise at first that that was a response to MY intial question. But does lxml actually have something for parsing

Re: DTD Parsing

2010-11-09 Thread Asun Friere
On Nov 10, 2:02 pm, Christian Heimes wrote: > Am 10.11.2010 03:44, schrieb Felipe Bastos Nunes: > > > I'd like to know too. I work with java and jdom, but I'm doing > > personal things in python, and plan to go full python in the next 2 > > years. Xml is my first option for configuration files and

Re: Allowing comments after the line continuation backslash

2010-11-09 Thread Robert Kern
On 2010-11-09 19:39 , Mark Wooding wrote: Tim Chase writes: On 11/09/10 18:05, Robert Kern wrote: For me, putting the brackets on their own lines (and using a trailing comma) has little to do with increasing readability. It's for making editing easier. It also makes diff's much easier to re

Re: DTD Parsing

2010-11-09 Thread Christian Heimes
Am 10.11.2010 03:44, schrieb Felipe Bastos Nunes: > I'd like to know too. I work with java and jdom, but I'm doing > personal things in python, and plan to go full python in the next 2 > years. Xml is my first option for configuration files and simple > storages. Don't repeat the mistakes of other

Re: DTD Parsing

2010-11-09 Thread Felipe Bastos Nunes
I'd like to know too. I work with java and jdom, but I'm doing personal things in python, and plan to go full python in the next 2 years. Xml is my first option for configuration files and simple storages. 2010/11/10, Asun Friere : > Now that PyXML (and thus xmlproc) is defunct, does anyone know a

Re: Allowing comments after the line continuation backslash

2010-11-09 Thread Tim Chase
On 11/09/10 19:39, Mark Wooding wrote: Tim Chase writes: It also makes diff's much easier to read Hmm. That's a good point, actually. I'm not overly fussed about the ease of editing: it doesn't seem especially hard either way. But nice diffs are definitely valuable. Food for thought; than

DTD Parsing

2010-11-09 Thread Asun Friere
Now that PyXML (and thus xmlproc) is defunct, does anyone know any handy modules (apart from re :) for parsing DTDs? -- http://mail.python.org/mailman/listinfo/python-list

Re: Allowing comments after the line continuation backslash

2010-11-09 Thread Mark Wooding
Tim Chase writes: > On 11/09/10 18:05, Robert Kern wrote: > > For me, putting the brackets on their own lines (and using a > > trailing comma) has little to do with increasing readability. It's > > for making editing easier. > > It also makes diff's much easier to read (my big impetus for doing t

Re: Allowing comments after the line continuation backslash

2010-11-09 Thread Tim Chase
On 11/09/10 18:05, Robert Kern wrote: For me, putting the brackets on their own lines (and using a trailing comma) has little to do with increasing readability. It's for making editing easier. It also makes diff's much easier to read (my big impetus for doing the same as Robert) -tkc -- ht

Re: Pythonic/idiomatic?

2010-11-09 Thread Robert Kern
On 11/8/10 8:13 PM, Seebs wrote: On 2010-11-09, Ben Finney wrote: Seebs writes: I think we're stuck with backwards compatibility at least as far as 2.4. Then you don't yet have the ???any??? and ???all??? built-in functions, or the tuple-of-prefixes feature of ???str.startswith??? either.

Re: Pythonic/idiomatic?

2010-11-09 Thread Martin Gregorie
On Wed, 10 Nov 2010 00:11:23 +, Seebs wrote: > On 2010-11-09, Jean-Michel Pichavant wrote: >> One pythonic way to do it, is to use an option parser. > > That seems like massive overkill -- I don't care about any of the other > options. It seems like it'd result in doing more work to get and

Re: Silly newbie question - Caret character (^)

2010-11-09 Thread Seebs
On 2010-11-09, Terry Reedy wrote: > I've been wondering why C programmers keep writing code susceptible to > buffer overruns ;=). Because we're dumb! (Actually, in my defense, my code almost never, if ever, has buffer overruns. I do in some rare cases have truncation issues with sufficiently

Re: Pythonic/idiomatic?

2010-11-09 Thread Seebs
On 2010-11-09, Jean-Michel Pichavant wrote: > One pythonic way to do it, is to use an option parser. That seems like massive overkill -- I don't care about any of the other options. It seems like it'd result in doing more work to get and then extract the options, and most of that would be discar

Re: Allowing comments after the line continuation backslash

2010-11-09 Thread Robert Kern
On 11/9/10 4:51 PM, Mark Wooding wrote: Lawrence D'Oliveiro writes: In message<87fwvdb69k.fsf@metalzone.distorted.org.uk>, Mark Wooding wrote: for descr, attr, colours in [ ('normal', 'image','Normal'), ('highlighted', 'highlight','Highlighted'),

Re: python script installation wizard

2010-11-09 Thread Ian Kelly
On Tue, Nov 9, 2010 at 3:43 PM, macro coders wrote: > > i want simple "hello world" script. i want python installer. sample image > http://img705.imageshack.us/img705/9430/py2exe.png how do python setup > wizard? > Use the distutils package in the standard library. You'll need to write a setu

Re: Allowing comments after the line continuation backslash

2010-11-09 Thread Mark Wooding
Lawrence D'Oliveiro writes: > In message <87fwvdb69k.fsf@metalzone.distorted.org.uk>, Mark Wooding > wrote: > > for descr, attr, colours in [ > > ('normal', 'image','Normal'), > > ('highlighted', 'highlight','Highlighted'), > > ('selected','select'

Re: Silly newbie question - Caret character (^)

2010-11-09 Thread Lawrence D'Oliveiro
In message , Terry Reedy wrote: > Your two 'nitpicks' about fflush have both come up on this list as real > issues causing people problems. Cache on disk drives is a bug, not a feature. Performance-wise, it’s fast RAM hobbled by being located on the wrong side of a connection to the CPU that i

Re: Learning Pyhton - Functional Programming - How intersect/difference two dict with dict/values? fast!

2010-11-09 Thread macm
Sorry Mr. Nagle and Folks I had a bad day today. I need forward but with fever, a grasp and headache is hard. You are absolute right, I was rude and I ask your pardon. About my code, sorry I thought was the best way to copy and paste in python console. Best Regards macm On Nov 9, 7:03 pm, "D

python script installation wizard

2010-11-09 Thread macro coders
i want simple "hello world" script. i want python installer. sample image http://img705.imageshack.us/img705/9430/py2exe.png how do python setup wizard? -- *Www.PythonTR.Org* -macrocoders- -- http://mail.python.org/mailman/listinfo/python-list

Re: Silly newbie question - Caret character (^)

2010-11-09 Thread Lawrence D'Oliveiro
In message , Terry Reedy wrote: > I've been wondering why C programmers keep writing code susceptible to > buffer overruns ;=). I am continually disappointed with the ‘do as I say, not as I do” attitude among people offering up sample code. I remember writing to one contributor to a programmin

Re: Silly newbie question - Caret character (^)

2010-11-09 Thread Lawrence D'Oliveiro
In message <87pquekxbe.fsf@metalzone.distorted.org.uk>, Mark Wooding wrote: > The book was much cheaper than a copy of the C standard from ANSI or ISO > even when it was new. It was a common joke (HHOS) at the time that the > difference in price reflected the value of the annotations. Crapw

Re: populating a doubly-subscripted array

2010-11-09 Thread Mark Wooding
Gregory Ewing writes: > A reasonably elegant way to fix this is to use list comprehensions > for all except the innermost list: > >ff = [[0.0]*5 for i in xrange(5)] Yes, this is a good approach. I should have suggested something like this as a solution myself, rather than merely explaining

Re: Dictionary of lists strange behaviour

2010-11-09 Thread John Posner
On 11/9/2010 1:43 PM, Terry Reedy wrote: ... List *is* useful as an initializer for collecitons.defaultdicts. And it was useful when several members of this forum helped me to develop a prime-number generator. See http://www.mail-archive.com/python-list@python.org/msg288128.html. (I meant t

Kareena and Saif Kissing I Kurbaan sex scene | Kareena Topless Kiss | Kurbaan Kiss

2010-11-09 Thread Sana Khan
http://groups.google.com/group/hsfun/t/8c6133cfeac2eff0 -- http://mail.python.org/mailman/listinfo/python-list

Re: subclassing str

2010-11-09 Thread Mark Wooding
rantingrick writes: > One thing i love about Python is the fact that it can please almost > all the "religious paradigm zealots" with it's multiple choice > approach to programming. However some of the features that OOP > fundamentalists hold dear in their heart are not always achievable in > a c

Re: Deditor 0.2.2

2010-11-09 Thread TheSeeker
On Nov 9, 10:04 am, Kruptein wrote: > On Nov 8, 3:01 pm, Jean-Michel Pichavant > wrote: > > > > > > > > > > > TheSeeker wrote: > > > On Nov 6, 7:06 am, Kruptein wrote: > > > >> Hey, > > > >> I released version 0.2.2 of my pythonic text-editor  Deditor. > > >> It adds the use of projects, a proje

Re: Silly newbie question - Caret character (^)

2010-11-09 Thread Mark Wooding
Philip Semanchuk writes: > What's funny is that I went looking for a printed copy of the C > standard a few years back and the advice I got was that the cheapest > route was to find a used copy of Schildt's "Annotated ANSI C Standard" > and ignore the annotations. So it serves at least one useful

Re: functions, list, default parameters

2010-11-09 Thread Mark Wooding
Lawrence D'Oliveiro writes: > In message , Robert Kern > wrote: > > So examining LHS "selectors" is not sufficient for determining > > immutability. > > Yes it is. All your attempts at counterexamples showed is that it is not > necessary, not that it is not sufficient. You've got them the wron

Re: Why "flat is better than nested"?

2010-11-09 Thread John Posner
On 11/9/2010 3:44 PM, Gregory Ewing wrote: I don’t get it. I get it. Does that mean that I don't get it? Yes. As Dr. Feynman said about quantum mechanics. -John -- http://mail.python.org/mailman/listinfo/python-list

Re: populating a doubly-subscripted array

2010-11-09 Thread Gregory Ewing
Mark Wooding wrote: What [x] * n does is make a list, whose length is n, and all of whose entries are precisely the value x. If x itself is a list, then you get an outer list all of whose entries are the /same/ inner list A reasonably elegant way to fix this is to use list comprehensions for

Re: JavaScript vs Python

2010-11-09 Thread Stef Mientki
On 09-11-2010 10:25, Lawrence D'Oliveiro wrote: > In message , Chris > Rebert wrote: > >> On Mon, Nov 8, 2010 at 10:52 PM, Lawrence D'Oliveiro >> wrote: >> >>> Because JavaScript is actually a decent language in its own right. >> "The Good Parts" of it anyway. > Python, too, has its good parts, y

Re: Learning Pyhton - Functional Programming - How intersect/difference two dict with dict/values? fast!

2010-11-09 Thread D'Arcy J.M. Cain
On Tue, 09 Nov 2010 15:55:16 -0500 Terry Reedy wrote: > To echo John Nagle's point, if you want non-masochist volunteers to read > your code, write something readable like: > > dict1 = {'ab': [[1,2,3,'d3','d4',5], 12], > 'ac': [[1,3,'78a','79b'], 54], > 'ad': [[56,57,58,59],

Re: Learning Pyhton - Functional Programming - How intersect/difference two dict with dict/values? fast!

2010-11-09 Thread Terry Reedy
On 11/9/2010 9:32 AM, macm wrote: dict1 = {'ab':[[1,2,3,'d3','d4',5],12],'ac':[[1,3,'78a','79b'], 54],'ad': [[56,57,58,59],34], 'ax': [[56,57,58,59],34]} To echo John Nagle's point, if you want non-masochist volunteers to read your code, write something readable like: dict1 = {'ab': [[1,

Re: Why "flat is better than nested"?

2010-11-09 Thread Gregory Ewing
Lawrence D'Oliveiro wrote: In message , rustom wrote: If you take zen seriously you dont get it If you dont take zen seriously you dont get it That -- seriously -- is zen I don’t get it. I get it. Does that mean that I don't get it? -- Greg -- http://mail.python.org/mailman/listinfo/pyth

Re: Learning Pyhton - Functional Programming - How intersect/difference two dict with dict/values? fast!

2010-11-09 Thread John Nagle
On 11/9/2010 9:32 AM, macm wrote: Hi Folks, dict1 = {'ab':[[1,2,3,'d3','d4',5],12],'ac':[[1,3,'78a','79b'], 54],'ad': [[56,57,58,59],34], 'ax': [[56,57,58,59],34]} dict2 = {'ab':[[22,2,'a0','42s','c4','d3'],12],'ab':[[2,4,50,42,'c4'], 12],'ac':[[1,3,'79b',45,65,'er4'],54],'ae': [[56,57,58,59],34

Re: An easier way to do this? (spoiler if you're using pyschools for fun)

2010-11-09 Thread Terry Reedy
On 11/9/2010 2:00 PM, Matty Sarro wrote: I'm working on one of the puzzles on pyschools.com , and am trying to figure out if I can make my solution a bit more elegant. Definitely def getSumOfLastDigit(numList): sumOfDigits=0 for i in range(0, len(numList)):

Re: An easier way to do this? (spoiler if you're using pyschools for fun)

2010-11-09 Thread Peter Otten
Matty Sarro wrote: > Hey everyone, > I'm working on one of the puzzles on pyschools.com, and am trying to > figure out if I can make my solution a bit more elegant. > > def getSumOfLastDigit(numList): > sumOfDigits=0 > for i in range(0, len(numList)): > num=str(numList.pop()) >

Re: An easier way to do this? (spoiler if you're using pyschools for fun)

2010-11-09 Thread Chris Rebert
On Tue, Nov 9, 2010 at 11:00 AM, Matty Sarro wrote: > Hey everyone, > I'm working on one of the puzzles on pyschools.com, and am trying to figure > out if I can make my solution a bit more elegant. > > def getSumOfLastDigit(numList): >     sumOfDigits=0 >     for i in range(0, len(numList)): >    

An easier way to do this? (spoiler if you're using pyschools for fun)

2010-11-09 Thread Matty Sarro
Hey everyone, I'm working on one of the puzzles on pyschools.com, and am trying to figure out if I can make my solution a bit more elegant. def getSumOfLastDigit(numList): sumOfDigits=0 for i in range(0, len(numList)): num=str(numList.pop()) sumOfDigits+=int(num[-1:]) r

Re: Dictionary of lists strange behaviour

2010-11-09 Thread Terry Reedy
On 11/9/2010 12:19 PM, Ciccio wrote: Il 09/11/2010 16:47, Terry Reedy ha scritto: On 11/9/2010 9:14 AM, Ciccio wrote: Hi all, hope you can help me understanding why the following happens: In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']} In [214]: rg = dict.fromkeys(g.keys(),[]) If you rewr

Re: Learning Pyhton - Functional Programming - How intersect/difference two dict with dict/values? fast!

2010-11-09 Thread Peter Otten
macm wrote: > Hi Folks, > > dict1 = {'ab':[[1,2,3,'d3','d4',5],12],'ac':[[1,3,'78a','79b'], > 54],'ad': [[56,57,58,59],34], 'ax': [[56,57,58,59],34]} > dict2 = {'ab':[[22,2,'a0','42s','c4','d3'],12],'ab':[[2,4,50,42,'c4'], > 12],'ac':[[1,3,'79b',45,65,'er4'],54],'ae': [[56,57,58,59],34],'ax': > [

Re: How to test if a module exists?

2010-11-09 Thread Jon Dufresne
On Mon, Nov 8, 2010 at 11:35 PM, Lawrence D'Oliveiro wrote: > In message , Roy Smith wrote: > >> On the other hand, if your module's bug is that it in turn imports some >> other module, which doesn't exist, you'll also get an ImportError. > > Does it really matter? Either way, the module is unusab

Re: How to test if a module exists?

2010-11-09 Thread Jon Dufresne
On Tue, Nov 9, 2010 at 4:30 AM, Roy Smith wrote: > In article , >  Lawrence D'Oliveiro wrote: > >> In message , Roy Smith wrote: >> >> > On the other hand, if your module's bug is that it in turn imports some >> > other module, which doesn't exist, you'll also get an ImportError. >> >> Does it re

Re: Silly newbie question - Caret character (^)

2010-11-09 Thread Terry Reedy
On 11/9/2010 2:00 AM, Seebs wrote: Yes, Herb Schildt: http://www.seebs.net/c/c_tcn4e.html I've been wondering why C programmers keep writing code susceptible to buffer overruns ;=). Your two 'nitpicks' about fflush have both come up on this list as real issues causing people proble

Learning Pyhton - Functional Programming - How intersect/difference two dict with dict/values? fast!

2010-11-09 Thread macm
Hi Folks, dict1 = {'ab':[[1,2,3,'d3','d4',5],12],'ac':[[1,3,'78a','79b'], 54],'ad': [[56,57,58,59],34], 'ax': [[56,57,58,59],34]} dict2 = {'ab':[[22,2,'a0','42s','c4','d3'],12],'ab':[[2,4,50,42,'c4'], 12],'ac':[[1,3,'79b',45,65,'er4'],54],'ae': [[56,57,58,59],34],'ax': [[9],34]} dict3 = {'ac':[[1,

Re: A way to get setup.py to create links instead of copy

2010-11-09 Thread Steve Holden
On 11/9/2010 4:18 AM, Geoff Bache wrote: > Hi all, > > One of the things I've always loved about Python (having come from > compiled languages) was the lack of an extra step between changing my > code and running it. > > On my current project, however, I find that I have to install my > Python co

Re: Dictionary of lists strange behaviour

2010-11-09 Thread Ciccio
Thank you all, this was timely and helpful. francesco -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionary of lists strange behaviour

2010-11-09 Thread Ciccio
Il 09/11/2010 16:47, Terry Reedy ha scritto: On 11/9/2010 9:14 AM, Ciccio wrote: Hi all, hope you can help me understanding why the following happens: In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']} In [214]: rg = dict.fromkeys(g.keys(),[]) If you rewrite this as bl = [] rg = dict.fromkey

Re: Help Documenting Python Syntax

2010-11-09 Thread Terry Reedy
On 11/9/2010 10:26 AM, RJB wrote: I have been trying to redevelop a syntax page for Python at http://cse.csusb.edu/dick/samples/python.syntax.html Page does not load correctly; had to hit refresh to get entire page. It should specify that this is the syntax for Python 2.5. To me "the Pyt

Re: udp sockets with python

2010-11-09 Thread Jean-Paul Calderone
On Nov 9, 5:20 am, Mag Gam wrote: > Hello, > > When measuring round trip time for the UDP echo client/server the C > version is much faster. I was wondering if there is anything I can do > to speed up. > > My current code for client looks like this > > sock=socket(AF_INET,SOCK_DGRAM) > for x i

Re: Help Documenting Python Syntax

2010-11-09 Thread Grant Edwards
On 2010-11-09, Terry Reedy wrote: > On 11/9/2010 10:26 AM, RJB wrote: >> I have been trying to redevelop a syntax page for Python at >> http://cse.csusb.edu/dick/samples/python.syntax.html > > Page does not load correctly; had to hit refresh to get entire page. > It should specify that this

Re: Deditor 0.2.2

2010-11-09 Thread Kruptein
On Nov 8, 3:01 pm, Jean-Michel Pichavant wrote: > TheSeeker wrote: > > On Nov 6, 7:06 am, Kruptein wrote: > > >> Hey, > > >> I released version 0.2.2 of my pythonic text-editor  Deditor. > >> It adds the use of projects, a project is a set of files which you can > >> open all at once to make deve

Re: Commercial or Famous Applicattions.?

2010-11-09 Thread Grant Edwards
On 2010-11-09, Jorge Biquez wrote: > Can you mention applications/systems/solutions made with Python that > are well known and used by public in general? ANd that maybe we do > not know they are done with Python? I'm not sure how much the "public in general" knows about it, but one I ran acros

Re: Dictionary of lists strange behaviour

2010-11-09 Thread Terry Reedy
On 11/9/2010 9:14 AM, Ciccio wrote: Hi all, hope you can help me understanding why the following happens: In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']} In [214]: rg = dict.fromkeys(g.keys(),[]) If you rewrite this as bl = [] rg = dict.fromkeys(g.keys(),bl) is the answer any more obvious

Help Documenting Python Syntax

2010-11-09 Thread RJB
I have been trying to redevelop a syntax page for Python at http://cse.csusb.edu/dick/samples/python.syntax.html I would appreciate and encouragement or corrections -- because I know there is at least one gross error in there. By the way, this is part of a suite of language definitions... go

Re: Silly newbie question - Caret character (^)

2010-11-09 Thread Philip Semanchuk
On Nov 9, 2010, at 1:04 AM, Lawrence D'Oliveiro wrote: > In message , Seebs wrote: > >> On 2010-11-09, Lawrence D'Oliveiro >> wrote: >> >>> In message , Dennis >>> Lee Bieber wrote: Have you ever looked at the reference manual for Ada? >> >>> Or even worse, the annotated reference.

Re: Dictionary of lists strange behaviour

2010-11-09 Thread Jean-Michel Pichavant
Ciccio wrote: Hi all, hope you can help me understanding why the following happens: In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']} In [214]: rg = dict.fromkeys(g.keys(),[]) In [215]: rg Out[215]: {'a': [], 'b': []} In [216]: rg['a'].append('x') In [217]: rg Out[217]: {'a': ['x'], 'b': ['x']}

Re: Commercial or Famous Applicattions.?

2010-11-09 Thread Kevin Walzer
On 11/8/10 7:18 PM, Jorge Biquez wrote: Hello all. Newbie question. Sorry. Can you mention applications/systems/solutions made with Python that are well known and used by public in general? ANd that maybe we do not know they are done with Python? There are several on the Mac: Checkout, a POS

Free E-Books collection

2010-11-09 Thread naveed ahmed
Freeit http://freeit11.blogspot.comis the world's leading online source of ebooks, with a vast range of ebooks from academic, Popular and professional publishers. Freeit http://freeit11.blogspot.com eBook communicates my vision of exploring the whole universe to you. What if you had a plausible

Dictionary of lists strange behaviour

2010-11-09 Thread Ciccio
Hi all, hope you can help me understanding why the following happens: In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']} In [214]: rg = dict.fromkeys(g.keys(),[]) In [215]: rg Out[215]: {'a': [], 'b': []} In [216]: rg['a'].append('x') In [217]: rg Out[217]: {'a': ['x'], 'b': ['x']} What I meant

Re: Dictionary of lists strange behaviour

2010-11-09 Thread Matteo Landi
On Tue, Nov 9, 2010 at 3:14 PM, Ciccio wrote: > Hi all, > > hope you can help me understanding why the following happens: > > In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']} > In [214]: rg = dict.fromkeys(g.keys(),[]) The argument you pass which is used to fill the values of the new dict, is cr

Re: Cross compiling (i386 from amd64) with distutils

2010-11-09 Thread bobicanprogram
On Nov 7, 7:19 pm, Jason wrote: > My situation is this: I have a Diamond Systems single-board computer > with a > matching GPIO board. DS have a library for controlling the GPIO > board... but > it's a static library (libdscud-6.02.a) with an accompanying header > (dscud.h). > I'd like to create a

Re: Commercial or Famous Applicattions.?

2010-11-09 Thread Martin Gregorie
On Tue, 09 Nov 2010 00:47:08 +, brf256 wrote: > Mailman is of course. > ...and don't forget getmail, a better behaved replacement for fetchmail. -- martin@ | Martin Gregorie gregorie. | Essex, UK org | -- http://mail.python.org/mailman/listinfo/python-list

Re: Best exercises for beginers to learn?

2010-11-09 Thread Matty Sarro
I agree completely with Seebs, however I will mention that until you find a project that tickles your fancy there are some good places to find exercises. Pyschools: http://www.pyschools.com Project Euler: http://projecteuler.net/ You can also check out: http://learnpythonthehardway.org/index The ex

Re: Pythonic/idiomatic?

2010-11-09 Thread Jean-Michel Pichavant
Seebs wrote: I have an existing hunk of Makefile code: CPPFLAGS = "$(filter -D* -I* -i* -U*,$(TARGET_CFLAGS))" For those not familiar with GNU makeisms, this means "assemble a string which consists of all the words in $(TARGET_CFLAGS) which start with one of -D, -I, -i, or -U". So if you

RE: { '0':'c->c->a' ,'1':'a->b->a' .........}

2010-11-09 Thread Sells, Fred
Since your keys are not unique, I would think that you would want a list of values for the object corresponding to each key. Something like Mydict = {} Mydict.setdefault(mykey, []).append(avalue) -Original Message- From: python-list-bounces+frsells=adventistcare@python.org [mailto:p

Re: Compare source code

2010-11-09 Thread Neil Cerutti
On 2010-11-07, Ethan Furman wrote: > Lawrence D'Oliveiro wrote: >> In message , Tim Harig wrote: >>> I personally prefer tabs as it lets *me* decide how far the >>> apparent indentations are in the code. >> >> But they don???t. Other people can have different settings, >> and they will see differ

Re: How to test if a module exists?

2010-11-09 Thread Roy Smith
In article , Lawrence D'Oliveiro wrote: > In message , Roy Smith wrote: > > > On the other hand, if your module's bug is that it in turn imports some > > other module, which doesn't exist, you'll also get an ImportError. > > Does it really matter? Either way, the module is unusable. If I unde

udp sockets with python

2010-11-09 Thread Mag Gam
Hello, When measuring round trip time for the UDP echo client/server the C version is much faster. I was wondering if there is anything I can do to speed up. My current code for client looks like this sock=socket(AF_INET,SOCK_DGRAM) for x in range (1000): sock.sendto("foo",(server,port))

Re: Dictionary of lists strange behaviour

2010-11-09 Thread Dave Angel
On 2:59 PM, Ciccio wrote: Hi all, hope you can help me understanding why the following happens: In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']} In [214]: rg = dict.fromkeys(g.keys(),[]) In [215]: rg Out[215]: {'a': [], 'b': []} In [216]: rg['a'].append('x') In [217]: rg Out[217]: {'a': ['x'

Re: How to test if a module exists?

2010-11-09 Thread Jean-Michel Pichavant
Jon Dufresne wrote: On Sat, Nov 6, 2010 at 1:52 PM, Roy Smith wrote: import sys try: import xx except ImportError: tb = sys.exc_traceback while tb: print tb tb = tb.tb_next I went ahead and implemented this and it now works. I even uncovered a bug I wasn't prev

Re: List index out of range, but list has enough elements

2010-11-09 Thread Stefan Behnel
[rearranged the responses in the right order] Costin Gamenț, 09.11.2010 11:44: On Tue, Nov 9, 2010 at 3:21 PM, Costin Gamenț wrote: On Tue, Nov 9, 2010 at 11:33 AM, Stefan Behnel wrote: Costin Gamenț, 09.11.2010 10:24: Hi, I am trying to read a string as csv, but I encountered an odd problem.

Re: List index out of range, but list has enough elements

2010-11-09 Thread Costin Gamenț
Thank you all for your interest in my problem. As Peter pointed out, there was one row with zero elements in it and that's where my problem was (of course it was the very last row, hence my confidence I have "good" data). Have a nice one, Costin On Tue, Nov 9, 2010 at 12:02 PM, Nitin Pawar wrote

Re: Compare source code

2010-11-09 Thread Mark Wooding
Arnaud Delobelle writes: > python-mode has python-beginning-of-block (C-c C-u) and > python-end-of-block. Yes. It was one of my explicit gripes that editing Python requires one to learn entirely new and unfamiliar keystrokes for doing fairly familiar editing tasks. -- [mdw] -- http://mail.pyt

Re: Pythonic/idiomatic?

2010-11-09 Thread Mark Wooding
Seebs writes: > ' '.join([x for x in target_cflags.split() if re.match('^-[DIiU]', x)]) > > This appears to do the same thing, but is it an idiomatic use of list > comprehensions, or should I be breaking it out into more bits? It looks OK to me. You say (elsewhere in the thread) that you'

Re: List index out of range, but list has enough elements

2010-11-09 Thread Nitin Pawar
You may want to try a spilt if you are getting 8 different elements then it will give you a list of those elements On Tue, Nov 9, 2010 at 3:21 PM, Costin Gamenț wrote: > Thank you for your timely response. Yes, I am sure "i" and "j" are > from the same iteration. I should point out that "i" actua

Re: List index out of range, but list has enough elements

2010-11-09 Thread Costin Gamenț
Thank you for your timely response. Yes, I am sure "i" and "j" are from the same iteration. I should point out that "i" actually has 8 elements and that str(i) gives a nice printout. On Tue, Nov 9, 2010 at 11:33 AM, Stefan Behnel wrote: > Costin Gamenț, 09.11.2010 10:24: >> >> Hi, I am trying to

Re: List index out of range, but list has enough elements

2010-11-09 Thread Peter Otten
Costin Gamenț wrote: > Hi, I am trying to read a string as csv, but I encountered an odd > problem. Here's my code: > > csvfile = csv.reader(datastr.split('\n'), delimiter=';') > r = '' > for i in csvfile: > for j in i: > print j >

Re: Pythonic/idiomatic?

2010-11-09 Thread Peter Otten
Seebs wrote: > I have an existing hunk of Makefile code: > CPPFLAGS = "$(filter -D* -I* -i* -U*,$(TARGET_CFLAGS))" > For those not familiar with GNU makeisms, this means "assemble a string > which consists of all the words in $(TARGET_CFLAGS) which start with one > of -D, -I, -i, or -U". So if yo

Re: List index out of range, but list has enough elements

2010-11-09 Thread Stefan Behnel
Costin Gamenț, 09.11.2010 10:24: Hi, I am trying to read a string as csv, but I encountered an odd problem. Here's my code: csvfile = csv.reader(datastr.split('\n'), delimiter=';') r = '' for i in csvfile: for j in i: print j

Re: Compare source code

2010-11-09 Thread Lawrence D'Oliveiro
In message , Ethan Furman wrote: > Lawrence D'Oliveiro wrote: > >> In message , Tim Harig wrote: >>> >>> I personally prefer tabs as it lets *me* decide how far the apparent >>> indentations are in the code. >> >> But they don’t. Other people can have different settings, and they will >> see dif

Re: JavaScript vs Python

2010-11-09 Thread Lawrence D'Oliveiro
In message , Chris Rebert wrote: > On Mon, Nov 8, 2010 at 10:52 PM, Lawrence D'Oliveiro > wrote: > >> Because JavaScript is actually a decent language in its own right. > > "The Good Parts" of it anyway. Python, too, has its good parts, you have to admit... -- http://mail.python.org/mailman/l

Re: How to test if a module exists?

2010-11-09 Thread Lawrence D'Oliveiro
In message , Roy Smith wrote: > Fail early and often, that's what I say. Good advice that could apply to lots of things. Except maybe procrastination ... :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Silly newbie question - Caret character (^)

2010-11-09 Thread Lawrence D'Oliveiro
In message , Seebs wrote: > The publisher doesn't care whether the books are accurate ... A sad state for the once-proud name “Osborne” ... -- http://mail.python.org/mailman/listinfo/python-list

List index out of range, but list has enough elements

2010-11-09 Thread Costin Gamenț
Hi, I am trying to read a string as csv, but I encountered an odd problem. Here's my code: csvfile = csv.reader(datastr.split('\n'), delimiter=';') r = '' for i in csvfile: for j in i: print j print i[0] the "print j"

  1   2   >