Re: Windows 7 : any problems installing or running Python ?

2009-08-07 Thread r
On Aug 7, 10:05 pm, Dave WB3DWE wrote: ...(snip) Oh God, windows 7 is here :(. What great functionality has M$ bestowed on the weary peasants now? More importantly why the heck am i still using windows in 2009? i think i will dump my winders os for good this year and go linux from here on out (ca

Re: Bug or feature: double strings as one

2009-08-07 Thread Carl Banks
On Aug 7, 10:00 am, Grant Edwards wrote: > On 2009-08-07, Scott David Daniels wrote: > > > Grant Edwards wrote: > >> On 2009-08-07, durumdara wrote: > >>> In other languages, like Delphi (Pascal), Javascript, SQL, etc., I > >>> must concatenate the strings with some sign, like "+" or "||". > > >

Re: Bug or feature: double strings as one

2009-08-07 Thread r
On Aug 7, 10:31 pm, Steven D'Aprano wrote: ...(snip excessive showmanship) :-) Ah Steven thats a real nice "snappy comeback" and some may get blinded by the "black magic" but basically all you are saying is that "version a" takes less overhead than "version b", compilation wise... but let's dig a

Re: question: why isn't a byte of a hash more uniform? how could I improve my code to cure that?

2009-08-07 Thread Paul Rubin
László Sándor writes: > OK, I understand. Could anyone suggest a better way to do this, then? > > (Recap: random-looking, close-to uniform assignment of one number out > of four possibilities to strings.) Use a cryptographic hash function like md5 (deprecated for security purposes but should be

Re: Python docs disappointing - group effort to hire writers?

2009-08-07 Thread Paul Rubin
Steven D'Aprano writes: > As for the rest, you're right that the current bug-tracker puts up > barriers to people submitting comments and bugs. That's actually a good > thing. The only thing worse than not enough information is too much > information, and the current situation does a good job o

Re: Python docs disappointing - group effort to hire writers?

2009-08-07 Thread Carl Banks
On Aug 7, 9:25 pm, Steven D'Aprano wrote: > If you want an open-access documentation system go right ahead and build > one. There are plenty of wikis available to use, and the Python docs are > freely available as your starting point. I might even contribute myself. > I just don't want it mixed in

Re: Python docs disappointing - group effort to hire writers?

2009-08-07 Thread Steven D'Aprano
On Fri, 07 Aug 2009 13:35:26 -0700, Kee Nethery wrote: > > Why exactly is posting an open comment on a bug tracker somehow > > inferior to posting an open comment on a wiki? > > It's a good question and deserves a good answer. > > * Fewer Steps > * Immediate > * Does not need to be formally rev

Re: How to address a global variable in a function

2009-08-07 Thread n179911
On Aug 7, 8:29 pm, n179911 wrote: > HI, > > I have a global variable > > // line 8 > tx  = 0 > > and then I have this function (start in line 12): > def handleTranslate(result): >         print line >         txStr, tyStr = result.group(1), result.group(2) >         print txStr, tyStr > >        

Re: how to overload operator "< <" (a < x < b)?

2009-08-07 Thread Carl Banks
On Aug 7, 9:01 pm, Carl Banks wrote: > On Aug 7, 7:18 am, "Diez B. Roggisch" wrote: > > > > > > > alex23 schrieb: > > > > On Aug 7, 10:50 pm, Benjamin Kaplan wrote: > > >> That isn't an operator at all. Python does not support compound > > >> comparisons like that. You have to do "a > b and b >

Re: How to address a global variable in a function

2009-08-07 Thread Chris Rebert
On Fri, Aug 7, 2009 at 11:29 PM, n179911 wrote: > HI, > > I have a global variable > > // line 8 > tx  = 0 > > and then I have this function (start in line 12): > def handleTranslate(result): >        print line >        txStr, tyStr = result.group(1), result.group(2) >        print txStr, tyStr >

Re: how to overload operator "< <" (a < x < b)?

2009-08-07 Thread Carl Banks
On Aug 7, 7:18 am, "Diez B. Roggisch" wrote: > alex23 schrieb: > > > > > > > On Aug 7, 10:50 pm, Benjamin Kaplan wrote: > >> That isn't an operator at all. Python does not support compound > >> comparisons like that. You have to do "a > b and b > c". > > > You know, it costs nothing to open up a

Re: how to overload operator "< <" (a < x < b)?

2009-08-07 Thread Steven D'Aprano
On Fri, 07 Aug 2009 08:04:22 -0700, Scott David Daniels wrote: > Benjamin Kaplan wrote: >> Python does not support compound comparisons like that. You have >> to do "a > b and b > c". > > Funny, my python does. This has been around a long time. I am not > certain whether 1.5.2 did it, but "

Re: Bug or feature: double strings as one

2009-08-07 Thread Steven D'Aprano
On Fri, 07 Aug 2009 17:35:28 +, kj wrote: > I fail to see why > > x = ("first part of a very long string " > "second part of a very long string") That's done by the compiler at compile time and is fast. > is so much better than > > x = ("first part of a very long string " + > "se

Re: unicode() vs. s.decode()

2009-08-07 Thread Steven D'Aprano
On Fri, 07 Aug 2009 17:13:07 +0200, Thorsten Kampe wrote: > One guy claims he has times between 2.7 and 5.7 seconds when > benchmarking more or less randomly generated "one million different > lines". That *is* *exactly* nothing. We agree that in the grand scheme of things, a difference of 2.7 s

How to address a global variable in a function

2009-08-07 Thread n179911
HI, I have a global variable // line 8 tx = 0 and then I have this function (start in line 12): def handleTranslate(result): print line txStr, tyStr = result.group(1), result.group(2) print txStr, tyStr tx += int(txStr) ty += int(tyStr) return

Windows 7 : any problems installing or running Python ?

2009-08-07 Thread Dave WB3DWE
Anybody tried it ? Is anything broken, ie is the whole shootin' match good to go ? I'm esp interested in WConio for 3.0/3.1 which I use heavily. Thanks Dave pdlem...@earthlink.net " I saw the number 4 in silver " Guido

Re: unicode() vs. s.decode()

2009-08-07 Thread Steven D'Aprano
On Fri, 07 Aug 2009 12:00:42 +0200, Thorsten Kampe wrote: > Bollocks. No one will even notice whether a code sequence runs 2.7 or > 5.7 seconds. That's completely artificial benchmarking. You think users won't notice a doubling of execution time? Well, that explains some of the apps I'm forced t

Re: importing fully qualified scripts to check syntax

2009-08-07 Thread Gabriel Genellina
En Fri, 07 Aug 2009 17:29:28 -0300, horos11 escribió: I'm trying to make a syntax checker, where I say: python -c "import /path/to/script" to check the syntax of the script named '/path/to/script' (note: no py extension needed). Of course this doesn't work because the functionality for import

Re: unique-ifying a list

2009-08-07 Thread Gabriel Genellina
En Fri, 07 Aug 2009 17:53:10 -0300, kj escribió: Suppose that x is some list. To produce a version of the list with duplicate elements removed one could, I suppose, do this: x = list(set(x)) but I expect that this will not preserve the original order of elements. I suppose that I could

Re: Is "feedparser" deprecated?

2009-08-07 Thread Gabriel Genellina
En Fri, 07 Aug 2009 16:07:48 -0300, John Nagle escribió: Feedparser requires SGMLlib, which has been removed from Python 3.0. Feedparser hasn't been updated since 2007. Does this mean Feedparser is dead? Since we have generic and easy of use XML parsers like ElementTree and lxml, speciali

Re: Bug or feature: double strings as one

2009-08-07 Thread r
It sure doesn't get any more obivous than... "string1" + "string2" Although i much prefer string formatting to concatenation for almost all cases except the most simple. This auto-magic conacatenation of strings is unintuitive and completely moronic if you ask my opinion. I blow chunks when i se

Re: Executing untrusted code

2009-08-07 Thread Nobody
On Fri, 07 Aug 2009 08:15:08 -0700, Emanuele D'Arrigo wrote: > Are > there best practices to at least minimize some of the risks associated > with untrusted code execution? Yes: don't execute it. Failing that, run the Python interpreter within a sandbox. If you want to support restricted executi

Re: Python docs disappointing - group effort to hire writers?

2009-08-07 Thread r
On Aug 7, 3:35 pm, Kee Nethery wrote: (snip) Kee, that was an eloquent and enlighting post and i think it speaks volumes to the lack of inclusion of all Pythoneers in this community. Not to mention the viscous attitudes and self indulgence we have around here. For those of you with ADD, Kee was

Re: syntax checker in python

2009-08-07 Thread Diez B. Roggisch
horos11 schrieb: ps - I just realized that it isn't enough to do: python -c 'import /path/to/script' since that actually executes any statement inside of the script (wheras all I want to do is check syntax) So - let me reprhase that - exactly how can you do a syntax check in python? Something

Re: Bug or feature: double strings as one

2009-08-07 Thread r
On Aug 7, 7:31 am, durumdara wrote: > Hi! > > I found an interesting thing in Python. > Today one of my "def"s got wrong result. ...(snip) I think it's a completely useless feature and i have never used it even once! This so-called "feature" seems a direct contridiction to the zen... """There s

Re: help with threads

2009-08-07 Thread Piet van Oostrum
> Michael Mossey (MM) wrote: >MM> Ah yes, that explains it. Some of these long computations are done in >MM> pure C, so I'm sure the GIL is not being released. Is that C code under your own control? Or at least the glue from Python to C? In that case, and if the C code is not manipulating Py

Re: Bug or feature: double strings as one

2009-08-07 Thread John Machin
On Aug 8, 3:43 am, alex23 wrote: > kj wrote: > > Feature, as others have pointed out, though I fail to see the need > > for it, given that Python's general syntax for string (as opposed > > to string literal) concatenation is already so convenient.  I.e., > > I fail to see why > > > x = ("first p

Re: Why all the __double_underscored_vars__?

2009-08-07 Thread r
On Aug 7, 5:13 pm, Chris Rebert wrote: > On Fri, Aug 7, 2009 at 5:51 PM, kj wrote: > > Python is chock-full of identifiers beginning and ending with double > > underscores, such as __builtin__, __contains__, and __coerce__. ...(snip) > Right, but the *users* of the functionality provided by __meth

Re: Bug or feature: double strings as one

2009-08-07 Thread Bearophile
durumdara: > I wanna ask that is a bug or is it a feature? For me it's a bug-prone antifeature. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: ValueError: Procedure probably called with not enough arguments (8 bytes missing)

2009-08-07 Thread LabJack Support
On Aug 7, 4:16 pm, LabJack Support wrote: > Hello! I am chasing around a problem that I am having with ctypes and > I am hoping someone can help out. Here is the Python code: > >     def asynch(self, baudrate, data, idNum=None, demo=0, portB=0, > enableTE=0, enableTO=0, enableDel=0, numWrite=0, nu

ValueError: Procedure probably called with not enough arguments (8 bytes missing)

2009-08-07 Thread LabJack Support
Hello! I am chasing around a problem that I am having with ctypes and I am hoping someone can help out. Here is the Python code: def asynch(self, baudrate, data, idNum=None, demo=0, portB=0, enableTE=0, enableTO=0, enableDel=0, numWrite=0, numRead=0): """ Name: U12.asynchConfig

Re: Why all the __double_underscored_vars__?

2009-08-07 Thread Chris Rebert
On Fri, Aug 7, 2009 at 5:51 PM, kj wrote: > Python is chock-full of identifiers beginning and ending with double > underscores, such as __builtin__, __contains__, and __coerce__. > > Using underscores to signal that an identifier is somehow "private" > to an implementation is pretty common in langu

Re: Setuptools - help!

2009-08-07 Thread Heikki Toivonen
Peter Chant wrote: > Thanks, it worked. Any ideas how to run the resulting scripts without > installing or running as root? If you install as root, you should be able to run the scripts as normal user. However, I don't recommend this approach since it could conflict with your system Python packag

Why all the __double_underscored_vars__?

2009-08-07 Thread kj
Python is chock-full of identifiers beginning and ending with double underscores, such as __builtin__, __contains__, and __coerce__. Using underscores to signal that an identifier is somehow "private" to an implementation is pretty common in languages other than Python. But in these cases the u

Re: syntax checker in python

2009-08-07 Thread Jonathan Gardner
On Aug 7, 1:39 pm, horos11 wrote: > ps - I just realized that it isn't enough to do: > > python -c 'import /path/to/script' > > since that actually executes any statement inside of the script > (wheras all I want to do is check syntax) > > So - let me reprhase that - exactly how can you do a synta

Re: unique-ifying a list

2009-08-07 Thread Jonathan Gardner
On Aug 7, 1:53 pm, kj wrote: > Suppose that x is some list.  To produce a version of the list with > duplicate elements removed one could, I suppose, do this: > >     x = list(set(x)) > > but I expect that this will not preserve the original order of > elements. > > I suppose that I could write so

Re: Bug or feature: double strings as one

2009-08-07 Thread Duncan Booth
Grant Edwards wrote: > Definitely. Not only does it have _all_ the features, it even > manages to simultaneously have several mutually-exclusive > features. Sounds a bit like Perl. -- http://mail.python.org/mailman/listinfo/python-list

Good news & bad news (was: Turtle Graphics are incompatible with gmpy)

2009-08-07 Thread Mensanator
Bad news: I ran the 2.5 turtle.py through the 2to3 refactorer but the result would not run in 3.1, some kind of type mismatch between ints and NoneType. So I set it aside. Good news: I tracked down the actual cause of the image discrepencies in my report. http://www.mensanator.com/mensanator/Py

Re: Is python buffer overflow proof?

2009-08-07 Thread Fuzzyman
On Aug 4, 6:06 am, John Nagle wrote: > Gabriel Genellina wrote: > > En Mon, 03 Aug 2009 18:04:53 -0300, sturlamolden > > escribió: > > >> On 2 Aug, 15:50, Jizzai wrote: > > >>> Is a _pure_ python program buffer overflow proof? > > >>> For example in C++ you can declare a char[9] to hold user inp

unique-ifying a list

2009-08-07 Thread kj
Suppose that x is some list. To produce a version of the list with duplicate elements removed one could, I suppose, do this: x = list(set(x)) but I expect that this will not preserve the original order of elements. I suppose that I could write something like def uniquify(items): seen

Re: Is python buffer overflow proof?

2009-08-07 Thread Fuzzyman
On Aug 3, 10:04 pm, sturlamolden wrote: > On 2 Aug, 15:50, Jizzai wrote: > > > Is a _pure_ python program buffer overflow proof? > > > For example in C++ you can declare a char[9] to hold user input. > > If the user inputs 10+ chars a buffer overflow occurs. > > Short answer: NO > > Bounds checki

Re: Is "feedparser" deprecated?

2009-08-07 Thread I V
On Fri, 07 Aug 2009 12:57:11 -0700, alex23 wrote: > John Nagle wrote: >> Feedparser hasn't been updated since 2007. Does this mean Feedparser is >> dead? > > Wouldn't you be better served asking this on the feedparser bug tracker? > > http://code.google.com/p/feedparser/issues/list But if the p

Re: one method of COM object needs a variant type variable

2009-08-07 Thread Gabriel Genellina
En Fri, 07 Aug 2009 04:21:03 -0300, MICHÁLEK Jan Mgr. escribió: Thanks Gabriel, I seen this before, but I don't know, what's mean 'compatible object'. I need create object who will like as an variant type. A variant is like a giant union contaning almost every basic type. See http://msdn.mi

Re: questions about object references

2009-08-07 Thread Ned Deily
In article <786181.46665...@web110610.mail.gq1.yahoo.com>, William wrote: > I have a question.  Suppose I do the following: > > def myfunc(a,b): >   return a+b > > myfunc2=myfunc > > is there anyway to find all of the references to myfunc?  That is, can I find > out all of the functions that

syntax checker in python

2009-08-07 Thread horos11
ps - I just realized that it isn't enough to do: python -c 'import /path/to/script' since that actually executes any statement inside of the script (wheras all I want to do is check syntax) So - let me reprhase that - exactly how can you do a syntax check in python? Something like perl's -c:

Re: Python docs disappointing - group effort to hire writers?

2009-08-07 Thread Kee Nethery
On Aug 7, 2009, at 10:48 AM, alex23 wrote: Kee Nethery wrote: I'm looking forward to the acceleration of improvements to the official docs based upon easy to provide user feedback. Glad to see that the bug tracking system is going to not be the primary means for documentation changes. I'm n

Re: PEP 8 exegetics: conditional imports?

2009-08-07 Thread Peter Otten
alex23 wrote: > This is something I was _utterly_ unaware of. Is there a list of what > modules are built-in readily available? >> sys.builtin_module_names ('__builtin__', '__main__', '_ast', '_bisect', '_codecs', '_collections', '_functools', '_locale', '_random', '_socket', '_sre', '_struct',

importing fully qualified scripts to check syntax

2009-08-07 Thread horos11
hey all, I'm trying to make a syntax checker, where I say: python -c "import /path/to/script" to check the syntax of the script named '/path/to/script' (note: no py extension needed). Of course this doesn't work because the functionality for import is bundled up with the environment.. So - is t

Re: question: why isn't a byte of a hash more uniform? how could I improve my code to cure that?

2009-08-07 Thread Peter Otten
Dave Angel wrote: [clever analysis snipped] > I'd use digest() instead of hexdigest(), and of course reduce the > subscript to 63 or less. OP: You could also try hash(line) % 4 While AFAIK it doesn't make promises about randomness it might still be good enough in practice. Peter -- http:

Re: PEP 8 exegetics: conditional imports?

2009-08-07 Thread Dave Angel
Albert Hopkins wrote: On Fri, 2009-08-07 at 16:50 +, kj wrote: Conditional imports make sense to me, as in the following example: def foobar(filename): if os.path.splitext(filename)[1] == '.gz': import gzip f = gzip.open(filename) else: f = file(filename)

Re: PEP 8 exegetics: conditional imports?

2009-08-07 Thread alex23
Peter Otten <__pete...@web.de> wrote: > This criterion is unlikely to be met for the examples you give above. time > is a built-in module, and gzip a thin wrapper around zlib which is also > built-in. This is something I was _utterly_ unaware of. Is there a list of what modules are built-in readil

Re: passing menu label to function

2009-08-07 Thread J Wolfe
Thanks Peter, I figured out an alternative just as you posted your response, I just looped through the buttons I wanted to add and used the loop variable to label the item and then passed it to the function, though your way seems much more robust. Thanks a lot! -- http://mail.python.org/mailman

Re: question: why isn't a byte of a hash more uniform? how could I improve my code to cure that?

2009-08-07 Thread Dave Angel
L wrote: Hi all, I am a Python novice, and right now I would be happy to simply get my job done with it, but I could appreciate some thoughts on the issue below. I need to assign one of four numbers to names in a list. The assignment should be pseudo-random: no pa

Re: Is "feedparser" deprecated?

2009-08-07 Thread alex23
John Nagle wrote: >    Feedparser requires SGMLlib, which has been removed from Python 3.0. > Feedparser hasn't been updated since 2007. Does this mean Feedparser > is dead? Wouldn't you be better served asking this on the feedparser bug tracker? http://code.google.com/p/feedparser/issues/list -

Re: PEP 8 exegetics: conditional imports?

2009-08-07 Thread Christian Heimes
kj wrote: I seek the wisdom of the elders. Is there a consensus on the matter of conditional imports? Are they righteous? Or are they the way of the wicked? imports in functions are dangerous and may lead to dead locks if they are mixed with threads. An import should never start a thread an

Re: PEP 8 exegetics: conditional imports?

2009-08-07 Thread Peter Otten
kj wrote: > Conditional imports make sense to me, as in the following example: > > def foobar(filename): > if os.path.splitext(filename)[1] == '.gz': > import gzip > f = gzip.open(filename) > else: > f = file(filename) > # etc. > > And yet, quoth PEP 8: > >

Re: question: why isn't a byte of a hash more uniform? how could I improve my code to cure that?

2009-08-07 Thread Ethan Furman
László Sándor wrote: Thank you, Tim. My comments are below. On 2009-08-07 13:19:47 -0400, Tim Chase said: After I have written a short Python script that hashes my textfile line by line and collects the numbers next to the original, I checked what I got. Instead of getting around 25% in ea

Re: Setuptools - help!

2009-08-07 Thread Peter Chant
Robert Kern wrote: > You need to put main.py into the pphoto package. > > $ mkdir pphoto/ > $ mv main.py pphoto/ > $ touch pphoto/__init__.py > Thanks, it worked. Any ideas how to run the resulting scripts without installing or running as root? Pete -- http://www.petezilla.co.uk -- http:/

Re: passing menu label to function

2009-08-07 Thread Peter Otten
J Wolfe wrote: > I would like to pass the label name of a menu to the command it is > calling, is that possible? > > self.menuitem.menu.add_command(label="pass this",command = lambda i = > self.self.menuitem.menu.cget("label"): self.function(i)) > > def function(self, i) > print i # print

Survey: Does your company use Python? Do you know a company that uses Python?

2009-08-07 Thread VanL
This is a survey to find as many companies using Python as we can. You can see the survey below: You don't need to work at the company to add it to this list! We will filter for duplicates. The answers to

Is "feedparser" deprecated?

2009-08-07 Thread John Nagle
Feedparser requires SGMLlib, which has been removed from Python 3.0. Feedparser hasn't been updated since 2007. Does this mean Feedparser is dead? John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: Module updating plans for Python 3.1: feedparser, MySQLdb

2009-08-07 Thread John Nagle
Buck wrote: I use MySQLdb quite a bit in my work. I could volunteer to help update it. Are there any particular bugs we're talking about or just a straight port to 3.0? It's a non-trivial port. There's a release candidate for Python 2.6; see https://sourceforge.net/project/shownotes.php?re

Re: question: why isn't a byte of a hash more uniform? how could I improve my code to cure that?

2009-08-07 Thread László Sándor
Thank you, Tim. My comments are below. On 2009-08-07 13:19:47 -0400, Tim Chase said: After I have written a short Python script that hashes my textfile line by line and collects the numbers next to the original, I checked what I got. Instead of getting around 25% in each treatment, the range i

Database query execution times in Python?

2009-08-07 Thread pwnedd
Hi all, I've been writing some code using libraries based on the Python Database API 2.0 (MySQLdb & pg), and so far things are working really well. There is one thing that I have not been able to figure out how to do, however: Retrieve the time is took a given query to execute. Does anyone kno

Re: PEP 8 exegetics: conditional imports?

2009-08-07 Thread Albert Hopkins
On Fri, 2009-08-07 at 16:50 +, kj wrote: > > Conditional imports make sense to me, as in the following example: > > def foobar(filename): > if os.path.splitext(filename)[1] == '.gz': > import gzip > f = gzip.open(filename) > else: > f = file(filename) > # e

Re: Python docs disappointing - group effort to hire writers?

2009-08-07 Thread alex23
David Robinow wrote: >  When one believes that development is controlled by a cabal which is > jealous of outsiders and actively prevents improvements to the docs, > any change, even if only in perception, helps to weaken the hold of > the evil forces holding back the success of Python. Yeah, it'

passing menu label to function

2009-08-07 Thread J Wolfe
Hi, I would like to pass the label name of a menu to the command it is calling, is that possible? self.menuitem.menu.add_command(label="pass this",command = lambda i = self.self.menuitem.menu.cget("label"): self.function(i)) def function(self, i) print i # print the label name Any help

Re: PEP 8 exegetics: conditional imports?

2009-08-07 Thread Albert Hopkins
On Fri, 2009-08-07 at 16:50 +, kj wrote: > > Conditional imports make sense to me, as in the following example: > > def foobar(filename): > if os.path.splitext(filename)[1] == '.gz': > import gzip > f = gzip.open(filename) > else: > f = file(filename) > # e

Re: Changing Remote Registry

2009-08-07 Thread Tim Golden
Kevin Holleran wrote: Long story short, I am using _winreg to do this. hKey = _winreg.OpenKey (keyPath, path, 0, _winreg.KEY_SET_VALUE) value,type = _winreg.QueryValueEx(hKey, item) if (value == wrongValue): _winreg.SetValue(hKey,'',_winreg.REG_SZ,correctValue) When I do this I receive

Re: Python docs disappointing - group effort to hire writers?

2009-08-07 Thread David Robinow
On Fri, Aug 7, 2009 at 1:48 PM, alex23 wrote: > Why exactly is posting an open comment on a bug tracker somehow > inferior to posting an open comment on a wiki? When one believes that development is controlled by a cabal which is jealous of outsiders and actively prevents improvements to the docs,

questions about object references

2009-08-07 Thread William
I have a question.  Suppose I do the following: def myfunc(a,b):   return a+b myfunc2=myfunc is there anyway to find all of the references to myfunc?  That is, can I find out all of the functions that may be aliased to myfunc? second question: class MyClass(object):  def __init__(a,b):    s

Re: Python docs disappointing - group effort to hire writers?

2009-08-07 Thread alex23
Kee Nethery wrote: > I'm looking forward to the acceleration of improvements to the   > official docs based upon easy to provide user feedback. Glad to see   > that the bug tracking system is going to not be the primary means for   > documentation changes. I'm not sure what you see as being funda

Re: unicode() vs. s.decode()

2009-08-07 Thread alex23
garabik-news-2005...@kassiopeia.juls.savba.sk wrote: > I am not sure I understood that. Must be my English :-) I just parsed it as "blah blah blah I won't admit I'm wrong" and didn't miss anything substantive. -- http://mail.python.org/mailman/listinfo/python-list

Re: Bug or feature: double strings as one

2009-08-07 Thread alex23
kj wrote: > Feature, as others have pointed out, though I fail to see the need > for it, given that Python's general syntax for string (as opposed > to string literal) concatenation is already so convenient.  I.e., > I fail to see why > > x = ("first part of a very long string " >      "second par

Re: Python docs disappointing - group effort to hire writers?

2009-08-07 Thread r
On Aug 7, 11:03 am, Kee Nethery wrote: ...(snip) > I'm looking forward to the acceleration of improvements to the   > official docs based upon easy to provide user feedback. Glad to see   > that the bug tracking system is going to not be the primary means for   > documentation changes. +1 -- ht

Re: Extracting matrix from a text file

2009-08-07 Thread alex23
MRAB wrote: > Or: >          columns = line.split(' ')[1 : ] Even better, well spotted. -- http://mail.python.org/mailman/listinfo/python-list

Re: Bug or feature: double strings as one

2009-08-07 Thread kj
In Peter Otten <__pete...@web.de> writes: >durumdara wrote: >> I found an interesting thing in Python. >> Today one of my "def"s got wrong result. >> >> When I checked the code I saw that I miss a "," from the list. >> >> l = ['ó' 'Ó'] >> >> Interesting, that Python handle them as one strin

Re: PEP 8 exegetics: conditional imports?

2009-08-07 Thread alex23
On Aug 8, 2:50 am, kj wrote: > Conditional imports make sense to me, as in the following example[...] > And yet, quoth PEP 8: > >     - Imports are always put at the top of the file, just after any module >       comments and docstrings, and before module globals and constants. > > ...which seems

Re: Extracting matrix from a text file

2009-08-07 Thread MRAB
alex23 wrote: On Aug 8, 2:19 am, bbarb...@inescporto.pt wrote: I am new in python, and I am running it on Mac with Smultron editor. I need to read a textfile that includes numbers (in a matrix form), indexes, and strings, like this: Marsyas-kea distance matrix for MIREX 2007 Audio Similarit

Re: question: why isn't a byte of a hash more uniform? how could I improve my code to cure that?

2009-08-07 Thread Tim Chase
After I have written a short Python script that hashes my textfile line by line and collects the numbers next to the original, I checked what I got. Instead of getting around 25% in each treatment, the range is 17.8%-31.3%. That sounds suspiciously like 25% with a +/- 7% fluctuation one might e

Re: Bug or feature: double strings as one

2009-08-07 Thread Grant Edwards
On 2009-08-07, Scott David Daniels wrote: > Grant Edwards wrote: >> On 2009-08-07, durumdara wrote: >>> In other languages, like Delphi (Pascal), Javascript, SQL, etc., I >>> must concatenate the strings with some sign, like "+" or "||". >> >> In other languages like Ruby, awk, C, C++, etc. adja

PEP 8 exegetics: conditional imports?

2009-08-07 Thread kj
Conditional imports make sense to me, as in the following example: def foobar(filename): if os.path.splitext(filename)[1] == '.gz': import gzip f = gzip.open(filename) else: f = file(filename) # etc. And yet, quoth PEP 8: - Imports are always put at the

Re: Extracting matrix from a text file

2009-08-07 Thread alex23
On Aug 8, 2:19 am, bbarb...@inescporto.pt wrote: > I am new in python, and I am running it on Mac with Smultron editor. I   > need to read a textfile that includes numbers (in a matrix form),   > indexes, and strings, like this: > > Marsyas-kea distance matrix for MIREX 2007 Audio Similarity Exchan

Re: Cython + setuptools not working with .pyx,only with .c-files

2009-08-07 Thread Stefan Behnel
Diez B. Roggisch wrote: > I'm trying to build a Cython-extension as Egg. > > However, this doesn't work - I can either use distutils to build the > extension, creating a myextension.c-file on the way. > > If that's there, I can use setuptools to build the egg. > > But when I remove the .c-file,

question: why isn't a byte of a hash more uniform? how could I improve my code to cure that?

2009-08-07 Thread László Sándor
Hi all, I am a Python novice, and right now I would be happy to simply get my job done with it, but I could appreciate some thoughts on the issue below. I need to assign one of four numbers to names in a list. The assignment should be pseudo-random: no pattern whatsoever, but deterministic, reprod

Extracting matrix from a text file

2009-08-07 Thread bbarbero
Hello to all!! I am new in python, and I am running it on Mac with Smultron editor. I need to read a textfile that includes numbers (in a matrix form), indexes, and strings, like this: Marsyas-kea distance matrix for MIREX 2007 Audio Similarity Exchange Q/R 1 2 3 4

py2exe-created exe results in "application failed to initialize"

2009-08-07 Thread Rick King
Hi everyone, I want to package up an application into an exe using py2exe but the result produces the dreaded "application failed to initialize 0x142" error. I'm using wxPython and basically just took the sample for wxpython GUI that came with py2exe and changed the name. My setup is pyth

Re: Python docs disappointing - group effort to hire writers?

2009-08-07 Thread Kee Nethery
During all this conversation there was a ticket posted in the bug tracking system with the suggestion of each section in the official docs linking to a fixed wiki page that can contain user contributions. The ticket has been closed because this addition to the official docs is already in th

Re: Bug or feature: double strings as one

2009-08-07 Thread Scott David Daniels
Grant Edwards wrote: On 2009-08-07, durumdara wrote: In other languages, like Delphi (Pascal), Javascript, SQL, etc., I must concatenate the strings with some sign, like "+" or "||". In other languages like Ruby, awk, C, C++, etc. adjacent string constants are concatenated. I must learn thi

Re: how to kill subprocess when Python process is killed?

2009-08-07 Thread mark.v.we...@gmail.com
On Aug 7, 12:57 am, alex23 wrote: > On Aug 7, 3:42 pm, "mark.v.we...@gmail.com" > wrote: > > > When I kill the main process (cntl-C) the subprocess keeps running. > > How do I kill the subprocess too? The subprocess is likely to run a > > long time. > > You can register functions to run when the

Re: Changing Remote Registry

2009-08-07 Thread MRAB
Kevin Holleran wrote: On Fri, Aug 7, 2009 at 10:46 AM, MRAB > wrote: Kevin Holleran wrote: On Fri, Aug 7, 2009 at 10:11 AM, MRAB mailto:pyt...@mrabarnett.plus.com>

Executing untrusted code

2009-08-07 Thread Emanuele D'Arrigo
Greetings everybody, I've been reading and mulling about python and security, specifically in terms of executing code that may or may not be trustworthy. I understand that libraries such as Rexec and Bastion are now deprecated because they have known vulnerabilities that may be exploited to circum

Re: Changing Remote Registry

2009-08-07 Thread Kevin Holleran
On Fri, Aug 7, 2009 at 10:46 AM, MRAB wrote: > Kevin Holleran wrote: > >> >> On Fri, Aug 7, 2009 at 10:11 AM, MRAB > pyt...@mrabarnett.plus.com>> wrote: >> >>Kevin Holleran wrote: >> >>Good morning, >> >>I fear the answer to this is that I just cannot do this >> >>

Re: how to overload operator "< <" (a < x < b)?

2009-08-07 Thread exarkun
On 12:50 pm, benjamin.kap...@case.edu wrote: On Fri, Aug 7, 2009 at 8:00 AM, dmitrey wrote: hi all, is it possible to overload operator "< �<"? (And other like this one, eg "<= �<=", "> �>", ">= �>=") Any URL/example? Thank you in advance, D. That isn't an operator at all. Python does not supp

Re: Processes not exiting

2009-08-07 Thread MRAB
ma3mju wrote: On 3 Aug, 09:36, ma3mju wrote: On 2 Aug, 21:49, Piet van Oostrum wrote: MRAB (M) wrote: M> I wonder whether one of the workers is raising an exception, perhaps due M> to lack of memory, when there are large number of jobs to process. But that wouldn't prevent the join. And y

Re: how to overload operator "< <" (a < x < b)?

2009-08-07 Thread Scott David Daniels
Benjamin Kaplan wrote: Python does not support compound comparisons like that. You have to do "a > b and b > c". Funny, my python does. This has been around a long time. I am not certain whether 1.5.2 did it, but "chained comparisons" have been around for a long time. >>> 'a'< 'd' <'

Re: Changing Remote Registry

2009-08-07 Thread MRAB
Kevin Holleran wrote: On Fri, Aug 7, 2009 at 10:11 AM, MRAB > wrote: Kevin Holleran wrote: Good morning, I fear the answer to this is that I just cannot do this I wrote a python script that goes out to a bunch of remote

Re: how to overload operator "< <" (a < x < b)?

2009-08-07 Thread Robert Lehmann
On Fri, 07 Aug 2009 08:50:52 -0400, Benjamin Kaplan wrote: > On Fri, Aug 7, 2009 at 8:00 AM, dmitrey > wrote: >> hi all, >> is it possible to overload operator "<  <"? (And other like this one, >> eg "<=  <=", ">  >", ">=  >=") >> Any URL/example? >> Thank you in advance, D. > > That isn't an ope

Re: Processes not exiting

2009-08-07 Thread ma3mju
On 3 Aug, 09:36, ma3mju wrote: > On 2 Aug, 21:49, Piet van Oostrum wrote: > > > > MRAB (M) wrote: > > >M> I wonder whether one of the workers is raising an exception, perhaps due > > >M> to lack of memory, when there are large number of jobs to process. > > > But that wouldn't prevent the jo

RE: Changing Remote Registry

2009-08-07 Thread Kevin Holleran
> > Good morning, >> >> I fear the answer to this is that I just cannot do this >> >> I wrote a python script that goes out to a bunch of remote machines and >> queries the registry for some values. Effectively, there have been some >> software upgrades that have been done as the need arose b

  1   2   >