Re: Python benefits over Cobra

2011-04-06 Thread Steven D'Aprano
On Thu, 07 Apr 2011 00:25:46 -0500, harrismh777 wrote: > The gnu suite of tools and the linux kernel were the keys to unlocking > Microsoft lock-in... brilliant technologies for innovation and freedom. I used to believe this too, but then I found I was relying on Linux and GNU software so much t

Re: Multiprocessing, shared memory vs. pickled copies

2011-04-06 Thread John Ladasky
Hello again, Philip, I really appreciate you sticking with me. Hopefully this will help someone else, too. I've done some more reading, and will offer some minimal code below. I've known about this page for a while, and it describes some of the unconventional things one needs to consider when s

Re: who moved reload?

2011-04-06 Thread geremy condra
On Wed, Apr 6, 2011 at 10:57 PM, harrismh777 wrote: > harrismh777 wrote: >> >> You guys want one more...? >> >> ... we can't import tkconstants any longer nope. >> >> >> import tkinter.tkconstants > > oops... so upset I finger-checked...  long day... > > This works: > > import tkinter > from t

Re: who moved reload?

2011-04-06 Thread harrismh777
harrismh777 wrote: You guys want one more...? ... we can't import tkconstants any longer nope. import tkinter.tkconstants oops... so upset I finger-checked... long day... This works: import tkinter from tkinter.constants import * This used to work: import Tkinter from Tkconstants i

Re: who moved reload?

2011-04-06 Thread harrismh777
You guys want one more...? ... we can't import tkconstants any longer nope. import tkinter.tkconstants (oh, and watch that first t on Tkinter, its doozy) nice. (ask me how long it took to find that... nah, wait till I'm not so grumpy... couple days from now) regards, m harris

Re: Python benefits over Cobra

2011-04-06 Thread harrismh777
Chris Angelico wrote: there's a lot of risk in tying yourself to a non-free framework, especially such a heavy one as .NET. You're completely at the mercy of the provider, in this case Microsoft, and if they make an incompatible change in the framework, you're forever stuck. Yes, lock-in is the

Re: Is the function filter deprecated?

2011-04-06 Thread Paul Rubin
Steven D'Aprano writes: > filter(func, *seqs) -> [x for x in itertools.chain(*seqs) if func(x)] > although I suppose functional programming purists might object :) Maybe you really want filter(func, chain.from_iterable(seqs)) -- http://mail.python.org/mailman/listinfo/python-list

Re: multiprocessing

2011-04-06 Thread Dan Stromberg
On Wed, Apr 6, 2011 at 9:06 PM, elsa wrote: > Hi guys, > > I want to try out some pooling of processors, but I'm not sure if it > is possible to do what I want to do. Basically, I want to have a > global object, that is updated during the execution of a function, and > I want to be able to run th

Re: [OT] Free software versus software idea patents

2011-04-06 Thread harrismh777
Ben Finney wrote: It's difficult to take a claim of “free” seriously for a technology (Mono) that knowingly implements techniques (the “C#” language, the “.NET” platform, etc.) covered by specific idea patents held by an entity that demonstrates every intention of wielding them to restrict the fr

Re: python 3 - instantiating class from user input

2011-04-06 Thread Chris Rebert
On Wed, Apr 6, 2011 at 9:41 PM, Chris Rebert wrote: > On Wed, Apr 6, 2011 at 9:04 PM, Brad Bailey wrote: >> I dont understand why this is such a big deal. Nor do i understand why >> google can't find a reasonable answer. If one can't figure out from the >> title what I'm trying to do, then a lo

Re: python 3 - instantiating class from user input

2011-04-06 Thread Chris Rebert
On Wed, Apr 6, 2011 at 9:04 PM, Brad Bailey wrote: > I dont understand why this is such a big deal. Nor do i understand why google > can't find a reasonable answer. If one can't figure out from the title what > I'm trying to do, then a look at code should firmly plant the intent. The > general

python 3 - instantiating class from user input

2011-04-06 Thread Brad Bailey
I dont understand why this is such a big deal. Nor do i understand why google can't find a reasonable answer. If one can't figure out from the title what I'm trying to do, then a look at code should firmly plant the intent. The general idea of the code is, in my opinion, very basic. I notice,

multiprocessing

2011-04-06 Thread elsa
Hi guys, I want to try out some pooling of processors, but I'm not sure if it is possible to do what I want to do. Basically, I want to have a global object, that is updated during the execution of a function, and I want to be able to run this function several times on parallel processors. The ord

set a breakpoint in malloc_error_break to debug?

2011-04-06 Thread Vincent Davis
Not sure what is going on here. the set "wset" is large I am sure but ... Is this something I am going wrong? def walked_dir(adir): wdirset = set() for dirpath, dirnames, filenames in os.walk(adir): for name in filenames: if isfile(dirpath+'/'+name): ful

Re: Trapping the segfault of a subprocess.Popen

2011-04-06 Thread Terry Reedy
On 4/6/2011 7:58 PM, Nobody wrote: On Wed, 06 Apr 2011 02:20:22 -0700, Pierre GM wrote: I need to run a third-party binary from a python script and retrieve its output (and its error messages). I use something like process = subprocess.Popen(options, stdout=subprocess.PIPE, stderr=subprocess.

Re: Is the function filter deprecated?

2011-04-06 Thread Terry Reedy
On 4/6/2011 7:20 PM, Jabba Laci wrote: Hi, I tried Pylint today and it gave me a warning for the function "filter". That is a bug in PyLint. Do not take any code checker as gospel truth. Is it deprecated? No. One can look in the source code for a deprecation warning statement or run 3.2 w

Re: Is the function filter deprecated?

2011-04-06 Thread Steven D'Aprano
On Wed, 06 Apr 2011 19:20:31 -0400, Jabba Laci wrote: > Hi, > > I tried Pylint today and it gave me a warning for the function "filter". > Is it deprecated? No. > Is the usage of list comprehensions encouraged? Certainly, but list comprehensions are not necessarily equivalent to filter. In

Re: Light weight IDE like pywin for os x 10.6

2011-04-06 Thread python
On Apr 5, 1:26 pm, Detlev Offenbach wrote: > python wrote: > > I have looked a while for this answer.  Sorry if it right before me. > > > I have move from Windows toosx.  The thing I miss most is pywin. > > I know you can purchase or download fullIDE'sfor python or even use > > Eclipse.   I really

Re: Trapping the segfault of a subprocess.Popen

2011-04-06 Thread Dan Stromberg
On Wed, Apr 6, 2011 at 2:20 AM, Pierre GM wrote: > All, > > I need to run a third-party binary from a python script and retrieve > its output (and its error messages). I use something like > >>> process = subprocess.Popen(options, stdout=subprocess.PIPE, > stderr=subprocess.PIPE) > >>> (info_out,

Amazon Simple Queue Service Worker

2011-04-06 Thread Joseph Ziegler
Hi all, Little new to the python world, please excuse the Noobness. We are writing a server which will subscribe to the Amazon Simple Queue Service. I am looking for a good service container. I saw Twisted and Zope out there. It's going to be a server which polls on a queue via the Boto api. D

Re: Sandboxed Python: memory limits?

2011-04-06 Thread Chris Angelico
On Thu, Apr 7, 2011 at 10:06 AM, Chris Angelico wrote: > I'm not too concerned about extensions, here; in any case, I lock most > of them off. I just want to prevent stupid stuff like this: > > a='a' > while True: >    a+=a > > from bringing the entire node to its knees. Obviously that will > even

Re: Sandboxed Python: memory limits?

2011-04-06 Thread Chris Angelico
On Thu, Apr 7, 2011 at 6:38 AM, Martin v. Loewis wrote: > You can adjust the implementations of PyMem_Malloc and PyObject_Malloc. > This would catch many allocations, but not all of them. If you adjust > PyMem_MALLOC instead of PyMem_Malloc, you catch even more allocations - > but extensions modul

Re: Trapping the segfault of a subprocess.Popen

2011-04-06 Thread Nobody
On Wed, 06 Apr 2011 02:20:22 -0700, Pierre GM wrote: > I need to run a third-party binary from a python script and retrieve > its output (and its error messages). I use something like process = subprocess.Popen(options, stdout=subprocess.PIPE, > stderr=subprocess.PIPE) (info_out, info_er

Re: Sending pictures using sockets

2011-04-06 Thread Dan Stromberg
On Wed, Apr 6, 2011 at 4:17 PM, Littlefield, Tyler wrote: > On 4/6/2011 4:58 PM, craf wrote: > >> >Hello. >> > >> >I'm testing the sockets in Python and I've seen the way in which >> >works to send string. My question is if anyone knows where >> >can find some information on how to send pictures t

Re: Behaviour of subprocess.Popen, ssh and nohup I don't understand

2011-04-06 Thread Nobody
On Wed, 06 Apr 2011 09:47:21 +0200, Adriaan Renting wrote: > This solves the problem using stdin=open(os.devnull, 'rb') instead of > stdin=None makes it run even if there is input from stdin in the > foreground process. > > The operating system is Ubuntu 8.04 > I understood what Suspended (tty in

Re: Is the function filter deprecated?

2011-04-06 Thread Emile van Sebille
On 4/6/2011 4:20 PM Jabba Laci said... Hi, I tried Pylint today and it gave me a warning for the function "filter". Is it deprecated? This post from Guido written in 2005 with an undated update would seem to indicate No. http://www.artima.com/weblogs/viewpost.jsp?thread=98196 Is the us

Is the function filter deprecated?

2011-04-06 Thread Jabba Laci
Hi, I tried Pylint today and it gave me a warning for the function "filter". Is it deprecated? Is the usage of list comprehensions encouraged? The transformation is not complicated, by the way: replace "filter( func, seq )" with "[ x for x in seq if func(x) ]" . Thanks, Laszlo -- http://mail.py

Re: Sending pictures using sockets

2011-04-06 Thread Littlefield, Tyler
On 4/6/2011 4:58 PM, craf wrote: >Hello. > >I'm testing the sockets in Python and I've seen the way in which >works to send string. My question is if anyone knows where >can find some information on how to send pictures through >Sockets. I use Python 2.7 and have read the information regarding >S

Sending pictures using sockets

2011-04-06 Thread craf
Hello. I'm testing the sockets in Python and I've seen the way in which works to send string. My question is if anyone knows where can find some information on how to send pictures through Sockets. I use Python 2.7 and have read the information regarding Sockets of the Python website, but I can no

[OT] Free software versus software idea patents (was: Python benefits over Cobra)

2011-04-06 Thread Ben Finney
Steven D'Aprano writes: > Mono is free, open source software that is compatible with .NET […] It's difficult to take a claim of “free” seriously for a technology (Mono) that knowingly implements techniques (the “C#” language, the “.NET” platform, etc.) covered by specific idea patents held by an

Re: TypeError: iterable argument required

2011-04-06 Thread eryksun ()
On Wednesday, April 6, 2011 3:21:42 PM UTC-4, Νικόλαος Κούρας wrote: > On 6 Απρ, 19:58, "eryksun ()" wrote: > > > The expression ``x or y`` first evaluates *x*; if *x* is > > true, its value is returned; otherwise, *y* is evaluated > > and the resulting value is returned. > > I doesnt matter if

Re: Sandboxed Python: memory limits?

2011-04-06 Thread Martin v. Loewis
> I have a vague memory of reading somewhere that it's possible to > replace the Python memory allocator. This would be an option, if > there's no simple way to say "your maximum is now 16MB", but I now > can't find it back. Was I hallucinating? You can adjust the implementations of PyMem_Malloc a

Re: is python 3 better than python 2?

2011-04-06 Thread Dan Stromberg
On Wed, Apr 6, 2011 at 9:31 AM, MRAB wrote: > On 06/04/2011 07:06, Dan Stromberg wrote: >> >> On Tue, Apr 5, 2011 at 10:04 PM, Terry Reedy > > wrote: >> >>    On 4/5/2011 4:42 PM, John Nagle wrote: >> >>        Well, actually Unicode support went in back around Python 2.4.

Re: a better way to invert a list?

2011-04-06 Thread Ian Kelly
On Wed, Apr 6, 2011 at 1:51 PM, Paul Rubin wrote: >    In Haskell or ML, you can use patterns that contain wild >    cards that play a role in the pattern-matching but don't establish any >    binding. Can that be done in Python? > > Not as much.  You could say something like > >         sorted(en

Re: a better way to invert a list?

2011-04-06 Thread Paul Rubin
scattered writes: > def invert(p): > return [ j for (i,j) in sorted(zip(p,range(len(p] return [j for i,j in sorted(enumerate(p), key=itemgetter(1))] looks a little cleaner to me. In Haskell or ML, you can use patterns that contain wild cards that play a role in the pattern

Re: TypeError: iterable argument required

2011-04-06 Thread MRAB
On 06/04/2011 20:21, Νικόλαος Κούρας wrote: On 6 Απρ, 19:58, "eryksun ()" wrote: The expression ``x or y`` first evaluates *x*; if *x* is true, its value is returned; otherwise, *y* is evaluated and the resulting value is returned. I doesnt matter if *y* is True or False before its value is

Python and DDE

2011-04-06 Thread Robert Upton
Dear Pythoners, I am attempting to get the DDE module to import into Python and am having some trouble. I have downloaded and installed the pywin32 extensions for Python 2.6, which is the version of python I am running on Windows. When I attempt to import the DDE module, as follows, import win3

Re: TypeError: iterable argument required

2011-04-06 Thread Νικόλαος Κούρας
On 6 Απρ, 19:58, "eryksun ()" wrote: > The expression ``x or y`` first evaluates *x*; if *x* is > true, its value is returned; otherwise, *y* is evaluated > and the resulting value is returned. I doesnt matter if *y* is True or False before its value is returned? *y*'s value returned no matter i

Re: Behaviour of subprocess.Popen, ssh and nohup I don't understand

2011-04-06 Thread Dan Stromberg
On Wed, Apr 6, 2011 at 12:47 AM, Adriaan Renting wrote: > > > This solves the problem using stdin=open(os.devnull, 'rb') instead of > stdin=None makes it run even if there is input from stdin in the > foreground process. > > The operating system is Ubuntu 8.04 > I understood what Suspended (tty in

Re: TypeError: iterable argument required

2011-04-06 Thread Terry Reedy
On 4/6/2011 6:06 AM, Νικόλαος Κούρας wrote: Now it works like i wanted but i want to ask you if i wrote it correctly, especially when i check against `""` and None One important note: there is one and one one None object; there can be multiple strings with value ''. So, testing against each i

Re: is python 3 better than python 2?

2011-04-06 Thread Terry Reedy
On 4/6/2011 12:31 PM, MRAB wrote: On 06/04/2011 07:06, Dan Stromberg wrote: I suspect not all string methods were kept for the bytes type: Doc says "Bytes and bytearray objects, being “strings of bytes”, have all methods found on strings, with the exception of encode(), format() and isiden

Re: TypeError: iterable argument required

2011-04-06 Thread eryksun ()
On Wednesday, April 6, 2011 11:57:32 AM UTC-4, Νικόλαος Κούρας wrote: > >>> mail = None > >>> mail = mail or 7 > >>> mail > 7 Quote: The expression ``x or y`` first evaluates *x*; if *x* is true, its value is returned; otherwise, *y* is evaluated and the resulting value is returned. Since 'mail

Re: TypeError: iterable argument required

2011-04-06 Thread eryksun ()
On Wednesday, April 6, 2011 11:41:24 AM UTC-4, Νικόλαος Κούρας wrote: > On 6 Απρ, 16:54, "eryksun ()" wrote: > > > You can also use an empty string as the default value when getting the > > field value > > Please provide me an example. import cgi form = cgi.FieldStorage() user = form.getfirst(

Re: is python 3 better than python 2?

2011-04-06 Thread MRAB
On 06/04/2011 07:06, Dan Stromberg wrote: On Tue, Apr 5, 2011 at 10:04 PM, Terry Reedy mailto:tjre...@udel.edu>> wrote: On 4/5/2011 4:42 PM, John Nagle wrote: Well, actually Unicode support went in back around Python 2.4. Even earlier, I think, but there were and still are pr

Re: TypeError: iterable argument required

2011-04-06 Thread Eric Snow
Hi, The "or" expression will return the first element that evaluates to True, or the last element if they all evaluate to False. Positive integers evaluate to True. None evaluates to False. See: http://docs.python.org/library/stdtypes.html#truth-value-testing

Re: TypeError: iterable argument required

2011-04-06 Thread Blockheads Oi Oi
On 06/04/2011 16:57, Νικόλαος Κούρας wrote: mail = None mail = mail or 7 mail 7 mail = None mail = 7 or mail mail 7 Here no matter the order iam writing the comparison it always return the number. why not the same here? mail = None mail = mail or '' mail '' mail = None mail = '' or mai

Re: TypeError: iterable argument required

2011-04-06 Thread Νικόλαος Κούρας
>>> mail = None >>> mail = mail or 7 >>> mail 7 >>> mail = None >>> mail = 7 or mail >>> mail 7 Here no matter the order iam writing the comparison it always return the number. why not the same here? >>> mail = None >>> mail = mail or '' >>> mail '' >>> mail = None >>> mail = '' or mail >>> ma

Re: TypeError: iterable argument required

2011-04-06 Thread Νικόλαος Κούρας
On 6 Απρ, 16:54, "eryksun ()" wrote: > You can also use an empty string as the default value when getting the field > value Please provide me an example. > Also, a simple OR statement can eliminate the None. For example: mail = mail > or ''. Since None is False, the statement returns the righ

!!!!$$$$only for ladies$$$!!!!

2011-04-06 Thread aarthi priya
only for ladies$$$ Special site for ladies and women Ladies Secrets A to z of ladies --->>http://www.wix.com/kumarrajlove/ammu just click -- http://mail.python.org/mailman/listinfo/python-list

Re: TypeError: iterable argument required

2011-04-06 Thread eryksun ()
On Wednesday, April 6, 2011 6:06:06 AM UTC-4, Νικόλαος Κούρας wrote: > > The trouble was in `if "@" in mail` . > You can only test somthing `in` something else if the second thing is > iterable and None isnt. > > So i made the code look like this: > > [code] > if ( mail is not None and '@' in mai

Re: Python benefits over Cobra

2011-04-06 Thread Chris Angelico
On Wed, Apr 6, 2011 at 10:29 PM, Steven D'Aprano wrote: > Mono is free, open source software that is compatible with .NET and is > available on Linux, Mac OS, Solaris, Unix and even that little-known > operating system "Windows". *wink* Ah! My apologies, I stand corrected. Not being familiar with

Re: Standard config file format

2011-04-06 Thread Neil Cerutti
On 2011-04-06, Chris Rebert wrote: > On Tue, Apr 5, 2011 at 7:16 PM, Vincent Davis > wrote: >> I am working on a program to monitor directory file changes >> and am would like a configuration file. This file would >> specify email addresses, file and directory locations.. Is >> there a prefer

Re: Python benefits over Cobra

2011-04-06 Thread Steven D'Aprano
On Wed, 06 Apr 2011 18:26:25 +1000, Chris Angelico wrote: > Right now, I have around me two laptops running Windows XP, two running > Ubuntu 10.10 64-bit, and two running Ubuntu 32-bit. (Surprisingly > balanced.) With a very few exceptions, code that I write in IDLE on one > box will run perfectly

***************************Hai***************************

2011-04-06 Thread Ravi Prasath
http://www.workfrominter.com/ http://www.workfrominter.com/ http://girlsdailysex.blogspot.com/ http://girlsdailysex.blogspot.com/ Just See What Is this Website Are Msg For You -- http://mail.python.org/mailman/listinfo/python-list

Re: TypeError: iterable argument required

2011-04-06 Thread Νικόλαος Κούρας
On 5 Απρ, 05:49, "eryksun ()" wrote: > On Monday, April 4, 2011 9:40:33 AM UTC-4, Νικόλαος Κούρας wrote: > > In one of your messages you wrote the following: > > > cursor.execute( '''INSERT INTO users(mail, comment) VALUES(%s, > > %s)''', (mail, comment) ) > > except MySQLdb.Error: > > print ( "Er

Re: a better way to invert a list?

2011-04-06 Thread Peter Otten
Glazner wrote: >> > def invert(p): >> > inverse = [None] * len(p) >> > for (i, j) in enumerate(p): >> > inverse[j] = i >> > return inverse >> >> Elegant. This seems like the best solution, although it isn't as much >> fun to write as a "one-liner". Thanks > > invert([1, 2, 3, 1]) > [None, 3

Re: a better way to invert a list?

2011-04-06 Thread scattered
On Apr 6, 4:48 am, Glazner wrote: > > > def invert(p): > > >     inverse = [None] * len(p) > > >     for (i, j) in enumerate(p): > > >         inverse[j] = i > > >     return inverse > > > Elegant. This seems like the best solution, although it isn't as much > > fun to write as a "one-liner". Than

Trapping the segfault of a subprocess.Popen

2011-04-06 Thread Pierre GM
All, I need to run a third-party binary from a python script and retrieve its output (and its error messages). I use something like >>> process = subprocess.Popen(options, stdout=subprocess.PIPE, >>> stderr=subprocess.PIPE) >>> (info_out, info_err) = process.communicate() That works fine, except

Re: a better way to invert a list?

2011-04-06 Thread Glazner
> > def invert(p): > >     inverse = [None] * len(p) > >     for (i, j) in enumerate(p): > >         inverse[j] = i > >     return inverse > > Elegant. This seems like the best solution, although it isn't as much > fun to write as a "one-liner". Thanks >>> invert([1, 2, 3, 1]) [None, 3, 1, 2] #bl

Re: Python benefits over Cobra

2011-04-06 Thread Chris Angelico
On Wed, Apr 6, 2011 at 6:03 PM, harrismh777 wrote: > Having said all of that, I must admit my bias against Microsoft .NET and the > Mono frameworks. I personally cannot support a language that requires either > one. Microsoft has made such a mess out of almost everything it has > touched... includ

Re: Python benefits over Cobra

2011-04-06 Thread harrismh777
Brendan Simon wrote: >> >> Any other arguments where Python has benefits over Cobra ?? >> Python is built from C, Cobra is built from Cobra... Python does not require Microsoft .NET, nor MONO framework, Python has better community support, has a larger install base and developer communit

Re: Behaviour of subprocess.Popen, ssh and nohup I don't understand

2011-04-06 Thread Adriaan Renting
>>> On 4/1/2011 at 07:33 AM, Kushal Kumaran wrote: > On Fri, Apr 1, 2011 at 4:31 AM, Adriaan Renting wrote: >> L.S. >> >> I have a problem that a background process that I'm trying to start with >> subprocess.Popen gets interrupted and starts waiting for input no matter >> what I try to do to

Re: Fun python 3.2 one-liner

2011-04-06 Thread Chris Angelico
On the right hand side of my gmail window, Google posited that I might be interested in "One-liner jokes". And I have to confess, the first thing I thought of was "So I was writing a one-liner in assembly and..." ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: How to program in Python to run system commands in 1000s of servers

2011-04-06 Thread bruce bushby
Hi Roy Two things you can look at: func https://fedorahosted.org/func/ mcollective http://docs.puppetlabs.com/mcollective/ On Wed, Apr 6, 2011 at 2:24 AM, Roy Smith wrote: > In article , > geremy condra wrote: > > > On Tue, Apr 5, 2011 at 7:51 AM, Babu wrote: > > > > > > Here is my pr