Re: pythonize this!

2010-06-16 Thread Richard Brodie
"Lie Ryan" wrote in message news:4c18a...@dnews.tpgi.com.au... > Probably bending the rules a little bit: > sum(x**2 - 8*x - 20 for x in range(1, 2010, 5)) > 536926141 Or, letting Python do the algera for you: >>> from sympy import var, sum >>> dummy = var('j k') >>> k = (5 * j) + 1 >>>

Re: Drawing Multigraphs

2010-06-02 Thread Richard Brodie
"geremy condra" wrote in message news:mailman.825.1275414239.32709.python-l...@python.org... > On Tue, Jun 1, 2010 at 9:42 AM, Nima wrote: >> Hi there, >> Is it possible to draw an (undirected) multigraph using a python library? >> I need to write a program that finds an Eulerian circuit in a

Re: subtraction is giving me a syntax error

2010-03-15 Thread Richard Brodie
"Joel Pendery" wrote in message news:56597268-3472-4fd9-a829-6d9cf51cf...@e7g2000yqf.googlegroups.com... >> y_diff = y_diff-H > > Syntaxerror: Non-ASCII character '\x96' in file on line 70, but no > encoding declared. That's likely an en-dash, not a minus sign. -- http://mail.python.org/ma

Re: String is ASCII or UTF-8?

2010-03-09 Thread Richard Brodie
"C. Benson Manica" wrote in message news:98375575-1071-46af-8ebc-f3c817b47...@q23g2000yqd.googlegroups.com... >The strings come from the same place, i.e. they're exclusively > normal ASCII characters. In this case then converting them to/from UTF-8 is a no-op, so it makes no difference at all.

Re: Docstrings considered too complicated

2010-03-03 Thread Richard Brodie
"Ed Keith" wrote in message news:mailman.215.1267639293.23598.python-l...@python.org... > That has always puzzled me to. ETX and EOT were well established, > why no use one of them? I'd love to know what they were thinking. It goes back to ancient PDP operating systems, so may well predate Un

Re: Is there a better way to do this?

2010-03-01 Thread Richard Brodie
"Matt Mitchell" wrote in message news:mailman.65.1267464765.23598.python-l...@python.org... > My initial idea was to make a list of all the different > ways "project" has been capitalized in my repo and try each one. The > code looks like this: I would use pysvn.Client.list to get a list of fi

Re: Docstrings considered too complicated

2010-02-26 Thread Richard Brodie
"Andreas Waldenburger" wrote in message news:20100226173907.55676...@geekmail.invalid... >> Reminiscent of: >> >> mov AX,BX ; Move the contents of BX into AX >> > Well, there might be some confusion there as to what gets moved where, > wouldn't you say? Depends on what assembler

Re: basic Class in Python

2010-01-19 Thread Richard Brodie
"bartc" wrote in message news:xl_4n.28001$ym4.5...@text.news.virginmedia.com... > Any particular reason why two, and not one (or three)? In some fonts it's > difficult to > tell how many as they run together. It follows the C convention for reserved identifers. -- http://mail.python.org/

Re: Raw string substitution problem

2009-12-17 Thread Richard Brodie
"Alan G Isaac" wrote in message news:qemdnrut0jvj1lfwnz2dnuvz_vqdn...@rcn.net... > Naturally enough. So I think the right answer is: > > 1. this is a documentation bug (i.e., the documentation >fails to specify unexpected behavior for raw strings), or > 2. this is a bug (i.e., raw strings

Re: Logic operators with "in" statement

2009-11-17 Thread Richard Brodie
"Mr.SpOOn" wrote in message news:mailman.492.1258380560.2873.python-l...@python.org... > In [13]: ('b3' and '5') in l or ('3' and 'b3') in l > Out[13]: True For anything more than the simplest cases, you might want use sets. That might be the correct data type from the start, depending on whe

Re: Passing values from html to python

2009-10-22 Thread Richard Brodie
"Albert Hopkins" wrote in message news:mailman.1851.1256208328.2807.python-l...@python.org... > On Thu, 2009-10-22 at 10:44 +0200, Ahmed Barakat wrote: >> Hi guys, >> >> I am playing with google app engine, I have this situation: >> >> I have a text box in an html page, I want to get the value i

Re: struct curiosity

2009-10-16 Thread Richard Brodie
"pjcoup" wrote in message news:b1537079-6e3a-43e1-814b-7ccf185fb...@v15g2000prn.googlegroups.com... > I would have expected calcsize('BB') to be either 10 or 12 > (padding), but 11? Is there a simple explanation of what is going > on here? The purpose of the padding is to align the words

Re: Is there a way to specify a superclass at runtime?

2009-10-05 Thread Richard Brodie
"Chris Colbert" wrote in message news:mailman.868.1254748945.2807.python-l...@python.org... > I am trying to abstract this machinery in a single class called > Controller which I want to inherit from either SimController or > RealController based on whether a module level flag SIMULATION is set

Re: Pyserial non-standard baud rate

2009-10-01 Thread Richard Brodie
"oyinbo55" wrote in message news:2feb36fc-106c-4d7c-a697-db59971dc...@a7g2000yqo.googlegroups.com... > Using the standard 19200 baud results in gobbledegook from the > multimeter. You aren't going to notice a 0.1% clock skew within 1 byte. Forget about the difference between 19200 and 19230.

Re: obscure problem using elementtree to make xhtml website

2009-09-04 Thread Richard Brodie
"Stefan Behnel" wrote in message news:4aa01462$0$31340$9b4e6...@newsspool4.arcor-online.net... >>Not a bug in IE (this time), which is correctly parsing the file as html. > > ... which is obviously not the correct thing to do when it's XHTML. It isn't though; it's HTML with a XHTML DOCTYPE, a

Re: Code formatting question: conditional expression

2009-08-18 Thread Richard Brodie
"John Posner" wrote in message news:mailman.26.1250604346.2854.python-l...@python.org... > if total > P.BASE: > excessblk = Block(total - P.BASE, srccol, carry_button_suppress=True) > else: > excessblk = None I wonder if it is appropriate to replace the None sentinel with one that

Re: Character encoding & the copyright symbol

2009-08-06 Thread Richard Brodie
"Robert Dailey" wrote in message news:f64f9830-c416-41b1-a510-c1e486271...@g19g2000vbi.googlegroups.com... > As you can see, I am trying to load the file with encoding 'cp1252' > which, according to the python 3.1 docs, translates to windows-1252. I > also tried 'latin_1', which translates to I

Re: Character encoding & the copyright symbol

2009-08-06 Thread Richard Brodie
"Robert Dailey" wrote in message news:29ab0981-b95d-4435-91bd-a7a520419...@b15g2000yqd.googlegroups.com... > UnicodeEncodeError: 'charmap' codec can't encode character '\xa9' in > position 1650: character maps to > > The file is defined as ASCII. That's the problem: ASCII is a seven bit code.

Re: strange python scripting error

2009-07-23 Thread Richard Brodie
"Diez B. Roggisch" wrote in message news:7crfjof29e4g...@mid.uni-berlin.de... > They have different line-ending-conventions. Not sure if and why that makes > a difference. Depends on your setup. Shells can be a bit dumb about it, so it will likely break simple cgi-style hosting. -bash: ./pyth

Re: gett error message: "TypeError: 'int' object is not callable"

2009-07-09 Thread Richard Brodie
"Tom Kermode" wrote in message news:mailman.2903.1247155607.8015.python-l...@python.org... > Do you know a good way to avoid running into this problem? It > makes sense to suggest not calling variables the same names as > built-in functions, but that's hard for a new python programmer who > do

Re: gett error message: "TypeError: 'int' object is not callable"

2009-07-09 Thread Richard Brodie
"Nick" wrote in message news:e54c4461-c0b7-42fb-8542-cefd7bf5f...@h18g2000yqj.googlegroups.com... > file = open(prefix1) > text = file.readlines() > len = len(text) You have redefined two built-in functions "file" and "len" in the first three lines. This is usually considered poor practice. S

Re: PEP 376

2009-07-01 Thread Richard Brodie
"Joachim Strömbergson" wrote in message news:mailman.2422.1246418400.8015.python-l...@python.org... > Even so, choosing md5 in 2009 for something that (hopefully) will be > used in years is a bad design decision. It creates a dependency for to > an algorithm that all sensible recommendations po

Re: Funny xmlrpc / linux problem

2009-06-19 Thread Richard Brodie
"Hans Müller" wrote in message news:4a37b18d$0$3283$8e6e7...@newsreader.ewetel.de... > Small addition: > > While tracing the network data I found the server to be the problem, > the answer to a request is beeing delayed by about 180ms - no idea why. Nagle's algorithm: you've unintentionally pro

Re: "TypeError: 'int' object is not callable"

2009-06-02 Thread Richard Brodie
"Visco Shaun" wrote in message news:mailman.966.1243852864.8015.python-l...@python.org... > when I was executing the below code I got "TypeError: 'int' object is > not callable" exception. Why is it so? > > if type(c) == type(ERROR): You've probably assigned to type somewhere in your code. What

Re: urllib2 slow for multiple requests

2009-05-14 Thread Richard Brodie
"Tomas Svarovsky" wrote in message news:747b0d4f-f9fd-4fa6-bb6d-0a4365f32...@b1g2000vbc.googlegroups.com... > This is a good point, but then it would manifest regardless of the > language used AFAIK. And this is not the case, ruby and php > implementations are working quite fine. What I meant

Re: urllib2 slow for multiple requests

2009-05-14 Thread Richard Brodie
"cgoldberg" wrote in message news:9ae58862-1cb2-4981-ae6a-0428c7684...@z5g2000vba.googlegroups.com... > you aren't doing a read(), so technically you are just connecting to > the web server and sending the request but never reading the content > back from the socket. > > But that is not the pro

Re: thc v0.3 - txt to html converter - better code?

2009-05-06 Thread Richard Brodie
"Stefan Behnel" wrote in message news:4a008996$0$31862$9b4e6...@newsspool3.arcor-online.net... >language_map = {'English': 'EN', 'Deutsch': 'DE'} >strict_or_transitional = {True: 'Transitional', False: 'Strict'} > ># this will raise a KeyError for unknown languages >language = l

Re: Thread-killing, round 666 (was Re: Lisp mentality vs. Python mentality)

2009-04-27 Thread Richard Brodie
"Vsevolod" wrote in message news:42cebb2b-0361-416c-8932-9371da50a...@y6g2000prf.googlegroups.com... > There's a common unification library -- bordeaux-threads -- > that abstracts away implementation specifics. It's API includes > the function destroy-thread. Which is deprecated, like the Jav

Re: ValueError: filedescriptor out of range in select()

2009-03-17 Thread Richard Brodie
"Laszlo Nagy" wrote in message news:mailman.2032.1237300298.11746.python-l...@python.org... > This method is called after the connection has been closed. Is is possible > that somehow > the file handles are leaking? If I understand correctly, you call shutdown() but not close() in response t

Re: error after upgrade

2009-03-09 Thread Richard Brodie
"jonsoons" wrote in message news:3102ef22-b5e6-466d-a3f3-8648ccb5a...@p11g2000yqe.googlegroups.com... >from binascii import hexlify as _hexlify > ImportError: ld.so.1: python: fatal: relocation error: file /opt/csw/ > lib/libpython2.5.so.1.0: symbol libintl_gettext: referenced symbol not >

Re: Response codes and \r\n

2009-03-05 Thread Richard Brodie
"Catherine Heathcote" wrote in message news:n3nrl.2951$lc7.2...@text.news.virginmedia.com... = > I am reading an XML file (code at the end if it helps) and all goes well > except I am > getting the http response code printed. I suggest you comment out line 22. The status shouldn't be in the d

Re: Python AppStore / Marketplace

2009-02-24 Thread Richard Brodie
"Rhodri James" wrote in message news:mailman.615.1235436896.11746.python-l...@python.org... > A souq is a bazaar :-) > Maybe I've just read too much arabic-themed fiction, but I was surprised not > to find the word in my trusty Chambers. Try under 'souk'. Transliterating to the Roman 'q' seem

Re: Will multithreading make python less popular?

2009-02-19 Thread Richard Brodie
"sturlamolden" wrote in message news:d544d846-15ac-446e-a77f-cede8fcf9...@m40g2000yqh.googlegroups.com... > The GIL does not matter before crunching numbers on the CPU > becomes the bottleneck. And when you finally get there, perhaps it is > time to look into some C programming? Or numpy on a

Re: v = json.loads("{'test':'test'}")

2009-01-27 Thread Richard Brodie
"Steven D'Aprano" wrote in message news:018d0300$0$20629$c3e8...@news.astraweb.com... > Supposedly "every browser" (what, all of them?) already support a de > facto extension to the JSON standard, allowing more flexible quoting. That's a consequence of JSON being a subset of Javascript syntax,

Re: Why no lexical scoping for a method within a class?

2008-12-17 Thread Richard Brodie
"walterbyrd" wrote in message news:518b9dd9-69c5-4d5b-bd5f-ad567be62...@b38g2000prf.googlegroups.com... > However in the methods are within a class, the scoping seems to work > differently. Not really, self is a formal parameter to the function. It would be a strange language where a function'

Re: Python 3.0 automatic decoding of UTF16

2008-12-05 Thread Richard Brodie
"J Kenneth King" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > It probably means what it says: that the input file contains characters > it cannot read using the specified encoding. That was my first thought. However it appears that there is an off by one error somewhere in the

Re: time

2008-10-07 Thread Richard Brodie
"Gabriel Rossetti" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] . > I'm a UTC/GMT +1, I tried obtaining the UTC time, it says it's 2 hours > earlier than the > current time (14:59). I tried various other methods, I still get the wrong > time. Does > anyone have an idea with wha

Re: Installing pySerial

2008-09-18 Thread Richard Brodie
"Joe G (Home)" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I have installed Python for windows today from the python web site .I also > installed > pySerial using the Windows installer from the sourceforge web site. You need to read the pySerial smallprint, where it say

Re: md5 differences

2008-09-10 Thread Richard Brodie
"Python" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > here's an example: > [EMAIL PROTECTED]:~% echo "hello" | md5 > b1946ac92492d2347c6235b4d2611184 > How do I get the same results? Checksum the same string. >>> md5.new("hello\n").hexdigest() 'b1946ac92492d2347c6235b4d2611184

Re: URLs and ampersands

2008-08-05 Thread Richard Brodie
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I could just do a string replace, but is there a "right" way to escape > and unescape URLs? The right way is to parse your HTML with an HTML parser. URLs are not exempt from the normal HTML escaping rules, although

Re: 32 bit or 64 bit?

2008-06-17 Thread Richard Brodie
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >That was suggested. Problem is, that sometimes the velocities are near >zero. So this solution, by itself, is not general enough. Maybe working in p, and delta-p would be more stable. -- http://mail.python.org/mailman/listinfo/pyth

Re: cgi, parse_header and semi-colon

2008-06-06 Thread Richard Brodie
"Sylvain" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If we upload a file with a semi-colon (i.e : "C:/my;file.jpg") : > cgi.FieldStorage.filename returns only "my" everything after the semi- > colon is missing > > Is it a bug or i'm missing something ? I doubt it's bug in par

Re: Unicode chr(150) en dash

2008-04-17 Thread Richard Brodie
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I think I understand the unicode basic principles, what confuses me is the > usage > different applications > make out of it. > > For example, I got that EN DASH out of a web page which states > at the beggining. That's why I > di

Re: Serving binary content (images, etc) using BasteHTTPServer

2008-04-16 Thread Richard Brodie
<[EMAIL PROTECTED]> wrote in message news:556871d3-1fea-40f2-9cc6- >s.end_headers A bare method name (without parentheses) won't get called. -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with PARAGRAPH SEPARATOR

2008-03-20 Thread Richard Brodie
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Would that mean that the string "myString" is an ascii-string or what? It would mean it was a byte encoded string already, yes. When you try to encode it, Python tries to coerce it to Unicode and it's equivalent to: myString.decode(

Re: %x unsigned?

2008-03-14 Thread Richard Brodie
"Hrvoje Niksic" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The %x conversion specifier is documented in > http://docs.python.org/lib/typesseq-strings.html as "Unsigned > hexadecimal (lowercase)." What does "unsigned" refer to? It's obsolete, a fallout of int/long int unificat

Re: Regarding coding style

2008-03-07 Thread Richard Brodie
"K Viltersten" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 1. When writing English, Strunk and White apply. Do they? I've never seen them ;) > 2. You should use two spaces after a sentence-ending period. > > For heavens sake, why? Most people find it easier to type two space

Re: Eurosymbol in xml document

2008-03-04 Thread Richard Brodie
"Robert Bossy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If the file is declared as latin-1 and contains an euro symbol, then the file > is > actually invalid since euro is not defined of in iso-8859-1. Paradoxical would be a better description than invalid, if it contains

Re: XML expat error

2008-02-27 Thread Richard Brodie
"dirkheld" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > xml.parsers.expat.ExpatError: not well-formed (invalid token): line > 554, column 20 > > I guess that the element I try to read or the XML(which would be > strange since they have been created with the same code) can't ben

Re: keyword 'in' not returning a bool?

2008-02-08 Thread Richard Brodie
"c james" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] 't' in sample == True > False It's comparison operator chaining: 't' in sample == True is like 't' == sample == True and is equivalent to 't' in sample and sample == True -- http://mail.python.org/mailman/listinfo

Re: serving html from a python script in IE

2007-11-01 Thread Richard Brodie
"bluegray" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > print "Content-Type: application/xhtml+xml That's your problem. You can't use that Mime type because IE doesn't support XHMTL. No "appendix C" hair splitting comments, please. -- http://mail.python.org/mailman/listinfo

Re: Convert string to command..

2007-10-18 Thread Richard Brodie
"Matimus" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I think several people have given you the correct answer, but for some > reason you aren't getting it. Instead of saving the string > representation of a dictionary to the database... Mind you, if this were Jeopardy, "Store

Re: Dictionary invalid token error

2007-10-02 Thread Richard Brodie
"brad" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Why does 09 cause an invalid token while 9 does not? 9 isn't a valid octal digit. You probably want to use strings for storing telephone number like codes, if leading zeroes are significant. -- http://mail.python.org/mailma

Re: File handle not being released by close

2007-07-30 Thread Richard Brodie
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm guessing the garbage collector is causing the file to be written, > but shouldn't close do this? Only if you call it ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing XML with ElementTree (unicode problem?)

2007-07-23 Thread Richard Brodie
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > so what's the difference? how comes parsing is fine > in the first case but erroneous in the second case? You may have guessed the encoding wrong. It probably wasn't utf-8 to start with but iso8859-1 or similar. What actual byte valu

Re: file open default location

2007-06-12 Thread Richard Brodie
"T. Crane" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > As an aside, I forgot to mention above that I'm using Windows XP. Any other > ideas or > possible reasons that it would not choose my script location as the default > location to > save something? If you open a DOS wi

Re: Unicode to HTML entities

2007-05-29 Thread Richard Brodie
"Clodoaldo" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I was looking for a function to transform a unicode string into >htmlentities. >>> u'São Paulo'.encode('ascii', 'xmlcharrefreplace') 'São Paulo' -- http://mail.python.org/mailman/listinfo/python-list

Re: just a bug (was: xml.dom.minidom: how to preserve CRLF's inside CDATA?)

2007-05-25 Thread Richard Brodie
"Neil Cerutti" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Web browsers are in the very business of reasonably rendering > ill-formed mark-up. It's one of the things that makes > implementing a browser take forever. ;) For HTML, yes. it accepts all sorts of garbage, like most

Re: just a bug (was: xml.dom.minidom: how to preserve CRLF's inside CDATA?)

2007-05-25 Thread Richard Brodie
"Marc 'BlackJack' Rintsch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > How did you verified that it is well formed? It appears to have a more fundamental problem, which is that it isn't correctly encoded (presumably because the CDATA is truncated in mid-character). I'm surpris

Re: q: how to output a unicode string?

2007-04-25 Thread Richard Brodie
"Frank Stajano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I find the encode/decode terminology somewhat confusing, because arguably > both sides are > "encoded". For example, a unicode-encoded string (I mean a sequence of > unicode code > points) should count as "decoded"

Re: setDaemon problem.

2007-04-20 Thread Richard Brodie
"Michael Hoffman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> Neither is particularly intuitive; it just depends whether you are more >> familiar with the Posix terminology or the Java one. I personally prefer >> detached but there is little chance of a name change now. > > Wh

Re: setDaemon problem.

2007-04-20 Thread Richard Brodie
"Ramashish Baranwal" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I was also wondering about "daemonizing" a thread, but I interpreted > that it would daemonize the process which it didn't. I think setDaemon > should be renamed to setDetached or something similar. Neither is pa

Re: Arrays, Got Me Confused

2007-04-13 Thread Richard Brodie
"Robert Rawlins - Think Blue" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Wider fragments of code don't really exists at this moment in time No but specifying the problem too narrowly tends to get you an unidiomatic solution. > Basically I'm trying to create a class that conta

Re: Stack experiment

2007-04-03 Thread Richard Brodie
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> There is a stray leading space in it. > > Nah, I'd say there's a stray ([^0-9]) after the space. If you regard the spaces as being a required part of the postfix grammar, it would be simpler. But who would design a language where wh

Re: Stack experiment

2007-04-03 Thread Richard Brodie
<[EMAIL PROTECTED]> wrote in message >There may be something wrong with the "re" code in your example, >but I don't know enough about that to help in that area. There is a stray leading space in it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python / Socket speed

2007-02-26 Thread Richard Brodie
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Seems like sockets are about 6 times faster on OpenSUSE than on > Windows XP in Python. > > http://pyfanatic.blogspot.com/2007/02/socket-performance.html > > Is this related to Python or the OS? It's 6 times faster even when not using

Re: basic jython question

2007-02-15 Thread Richard Brodie
"Gerard Flanagan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I have a 'logger' module which is essentially just a facade over the > 'logging' standard module. Can this be called from jython, and how is > this acheived? This is a colleague's question but I have no knowledge > o

Re: Inconsistent list/pointer problem

2007-02-01 Thread Richard Brodie
"Doug Stell" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I call the function, passing in a list as the input data. The function > must manipulate and operate on a copy of that list's data, without > altering the list in the calling routine. Then you will want to make a copy: l

Re: Bizarre floating-point output

2007-01-08 Thread Richard Brodie
"Nick Maclaren" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > x = (1.234567890125, 1.2345678901255) > print x > print x[0], x[1] > (1.234567890124, 1.2345678901254999) 1.23456789012 1.23456789013 > > Is there a rational reason, or is that simply an artifact of the

Re: merits of Lisp vs Python

2006-12-08 Thread Richard Brodie
"Alex Mizrahi" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > heh, do you have "standard numeric packages" for everything? maybe then we'll > make > standard programs for everything -- that will obsolete "slow" "custom > scripts" and we'll > just use shell to select what progr

Re: merits of Lisp vs Python

2006-12-08 Thread Richard Brodie
"Mark Tarver" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > seems to show that Python is a cut down (no macros) version of Lisp > with a worse performance. Performance claims are always controversial. So, Python is much slower doing array multiplication, when you hand roll it, i

Re: len(var) is [CONSTANT] equal to len(var) == [CONSTANT]?

2006-11-23 Thread Richard Brodie
"Tor Erik Soenvisen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > which executes fine. Hence, 0- is okey... But this is a relatively > small range, and sooner or later you probably get two numbers with the same > id... Thoughts anyone? I think you are confusing yourself unn

Re: Yield

2006-11-16 Thread Richard Brodie
"Danny Colligan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I absoultely agree. Thanks for pointing me out to some real-world > code. However, the function you pointed me to is not a generator > (there is no yield statement... it just returns the entire list of > primes). O

Re: Yield

2006-11-16 Thread Richard Brodie
"Danny Colligan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Now that we're on the subject, what are the advantages of using > generators over, say, list comprehensions or for loops? It seems to me > that virtually all (I won't say everything) the examples I've seen can > be do

Re: Tertiary Operation

2006-10-17 Thread Richard Brodie
"abcd" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >x = None > result = (x is None and "" or str(x)) > > ...what's wrong with the first operation I did with x? I was expecting > "result" to be an empty string, not the str value of None. Your evil tertiary hack has failed you be

Re: Python component model

2006-10-10 Thread Richard Brodie
"Edward Diener No Spam" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Thinking in Java or C++" as opposed to Python does not mean anything to me > as a general > statement. I am well aware of the difference between statically and > dynamically typed > languages but why this

Re: HOST - Assembla Inc. Breakout - Copyright Violation by Mr. Andy Singleton

2006-10-06 Thread Richard Brodie
"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > This is on the same level of interest to the communities of python, ruby & > java as the > color of my socks this morning - a deep black with cute little skulls > imprinted. I did find Andy's claim that he expec

Re: Best way to handle large lists?

2006-10-03 Thread Richard Brodie
"Chaz Ginger" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Each item in the list is a fully qualified domain name, e.g. > foo.bar.com. The order in the list has no importance. So you don't actually need to use lists at all, then. You can just use sets and write: newSet = bigSe

Re: How do I converted a null (0) terminated string to a Python string?

2006-09-14 Thread Richard Brodie
"Marc 'BlackJack' Rintsch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I would spell it: > > if strg.endswith('\0'): >strg = strg[:-1] I would just go with: strg = strg.rstrip('\0') -- http://mail.python.org/mailman/listinfo/python-list

Re: Are Python's reserved words reserved in places they dont need to be?

2006-09-12 Thread Richard Brodie
"metaperl" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Why isn' t the parser smart enough to see that class followed by an > identifier is used for class definition but class followed by equals is > a simple assignment? Because it's simpler to reserve words than worry about po

Re: getting quick arp request

2006-09-07 Thread Richard Brodie
"Steve Holden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is it relevant to point out that the ARP protocol is a connectionless > network-layer > protocol. Not really, since the program uses normal TCP socket connections. The feature is working exactly as designed - to slow

Re: threading support in python

2006-09-05 Thread Richard Brodie
"km" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > True, since smartness is a comparison, my friends who have chosen java > over python for considerations of a true threading support in a > language are smarter, which makes me a dumbo ! :-) No, but I think you making unwise assu

Re: threading support in python

2006-09-05 Thread Richard Brodie
"km" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I know many of my friends who did not choose python for obvious reasons > of the nature of thread execution in the presence of GIL which means > that one is wasting sophisticated hardware resources. It would probably be easier

Re: threading support in python

2006-09-04 Thread Richard Brodie
"km" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > if GIL doesnt go then does it mean that python is useless for > computation intensive scientific applications which are in need of > parallelization in threading context ? No. -- http://mail.python.org/mailman/listinfo/pyth

Re: windows pagfile utilization

2006-08-30 Thread Richard Brodie
"Tim Chase" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Thanks for putting 4 gigs of ram in your machine. How about I let you use 2 > of 'em > while I underutilize the other 2 gigs?" > > Sounds silly, IMHO. Well, for a lot of scenarios, it's going to be the 2GB limit on sy

Re: windows pagfile utilization

2006-08-30 Thread Richard Brodie
"djoefish" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > My program still crashes at 2g (according to the task manager). Do I > need to inform python that the pagefile has a new size? How do I check > that python is utilizing the full pagefile? It won't. You'll hit the 2Gb user

Re: List match

2006-08-17 Thread Richard Brodie
"OriginalBrownster" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I know this probably is a very easy thing to do in python, but i wanted > to compare 2 lists and generate a new list that does not copy similar > entries. An example below > > list= ["apple", "banana", "grape"] > l

Re: help parsing this

2006-08-14 Thread Richard Brodie
"a" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > mx.DateTime.RangeError at /podcasts > Failed to parse "31 Apr 2006 20:19:00 -0400": day out of range: 31 > Python /usr/lib/python2.4/site-packages/mx/DateTime/Parser.py in > DateTimeFromString, line 608 > > how to parse this date >

Re: Newbie - How to iterate list or scalar ?

2006-08-08 Thread Richard Brodie
"Andy Dingley" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > pluginVersionNeeded is a parameter passed into a method and it can > either be a simple scalar variable, or it can be a list of the same > variables. The obvious question would be, "is there a good reason why you don't

Re: ElementTree and Unicode

2006-08-02 Thread Richard Brodie
"Sébastien Boisgérault" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] element = Element("string", value=u"\x00") I'm not as familiar with elementtree.ElementTree as I perhaps should be. However, you appear to be trying to insert a null character into an XML document. Should y

Re: Windows vs. Linux

2006-08-02 Thread Richard Brodie
"Gerhard Fiedler" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >With the same reasoning one could say that the Unix creators should have > used the VMS (or any other existing) form. Only if they used Guido's time machine. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python strings outside the 128 range

2006-07-13 Thread Richard Brodie
"Gerhard Fiedler" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If I understand you correctly, you are saying that if I distribute a file > with the following lines: > > s = "é" > print s > > I basically need to distribute also the information how the file is encoded > and ever

Re: Illegal instruction or undefined symbol from import

2006-07-05 Thread Richard Brodie
"Mathias Waack" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > BTW, does anybody know why the c-lib offers both log and log1p? So you can get a sensible answer computing log(1 + 10 ^ -30). There's a lot of somewhat obscure mathematical stuff that got into the standard C lib. How

Re: Having problems with strings in HTML

2006-06-27 Thread Richard Brodie
"Sion Arrowsmith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >>By the way, you _do_ realize that your "&" characters should be escaped >>as "&", don't you? > > No they shouldn't. They part of the url, which is (IIRC) a CDATA > attribute of the A element, not PCDATA. It is CDATA

Re: serial port servo control

2006-06-22 Thread Richard Brodie
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 1) How should I write to the serial port with python? I found the > module "pyserial": I don't think there is any need to hunt for anything better. > In C I'd do this by sending 3 char's, as they're only 1 byte, > but i'm not exactl

Re: not quite 1252

2006-04-28 Thread Richard Brodie
"Anton Vredegoor" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Yes my header also says UTF-8. However some kind person send me an e-mail > stating that > since I am getting \x94 and such output when using repr (even if str is > giving correct > output) there could be some pr

Re: How protect proprietary Python code? (bytecode obfuscation?, what better?)

2006-04-18 Thread Richard Brodie
"bruno at modulix" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Do they ask the same thing for Java or .NET apps ?-) If you Google for "bytecode obfuscation", you'll find a large number of products already exist for Java and .Net -- http://mail.python.org/mailman/listinfo/p

Re: Cannot import htmllib

2006-04-13 Thread Richard Brodie
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > As far as I can see, the files formatter.py and htmllib.py are where > they are supposed to be, in /usr/lib/python2.4/. You probably have aliased it by calling your main program formatter.py, or something similar. -- http://mail.

Re: urllib.urlencode wrongly encoding � character

2006-04-06 Thread Richard Brodie
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm obviously missing some context here, but "encoding ± to %B1 on any > platform" is exactly what urlencode does: > >>>> import urllib >>>> urllib.urlencode([("key", chr(0xb1))]) >'key=%B1' Yeah but you'

Re: cgi error

2006-03-31 Thread Richard Brodie
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > It works fine when i run it in python , but it won't run when i run my > cgi script. > > It says AttributeError: 'module' object has no attribute 'FTPHost' > what could be a possible cause? thanks. Perhaps you called your script 'ftp

  1   2   >