Re: special editor support for indentation needed.

2008-11-14 Thread Aaron Brady
On Nov 14, 11:28 pm, "Eric S. Johansson" <[EMAIL PROTECTED]> wrote: > Aaron Brady wrote: > > On Nov 14, 8:01 pm, "Eric S. Johansson" <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] wrote: > >>>  I don't understand. If you don't want to terminate the "if", why do > >>> you hit backspace? What is i

Re: duck-type-checking?

2008-11-14 Thread greg
Joe Strout wrote: So, the level of assertion that I want to make in a method that expects a Duck is just that its parameter is either a Duck, or something that the caller is claiming is just as good as a Duck. I'm not sure, but I think the new ABC stuff in Py3 is going to provide something

Re: duck-type-checking?

2008-11-14 Thread greg
Joe Strout wrote: So, in this case, the simplest solution was to have the method that initially accepts and stores the data check to make sure that data satisfies the assumptions of the class. In hindsight, yes, but the trouble is that you can't tell ahead of time which of the gazillion pla

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-14 Thread Steven D'Aprano
On Fri, 14 Nov 2008 22:56:52 -0500, Terry Reedy wrote: > [EMAIL PROTECTED] wrote: >> On Nov 13, 4:53 pm, Terry Reedy wrote: >>> [EMAIL PROTECTED] wrote: >>> I have yet to see any reasonable definition of a Python value in the Python docs or elsewhere, despite the fact that a value is one

Re: inspect.findsource problem with llinecache

2008-11-14 Thread Gabriel Genellina
En Wed, 12 Nov 2008 05:22:55 -0200, Rafe <[EMAIL PROTECTED]> escribió: I think I have discovered two bugs with the inspect module and I would like to know if anyone can spot any traps in my workaround. They look like real bugs - please report them at http://bugs.python.org else this will be

Re: How to make arrays from Lists

2008-11-14 Thread Gabriel Genellina
En Tue, 11 Nov 2008 23:09:25 -0200, <[EMAIL PROTECTED]> escribió: On Nov 11, 7:48 pm, [EMAIL PROTECTED] wrote: To create a 2D list, that is a list of lists: x = [[0] * ncols for i in nrows] Many thanks, I don't think I would ever 'discovered' this. Try reading the FAQ: http://www.python.

Re: embedding python

2008-11-14 Thread Gabriel Genellina
En Thu, 13 Nov 2008 19:41:44 -0200, Alan Baljeu <[EMAIL PROTECTED]> escribió: Thanks, I have 2.5 now and it works great with Nose. Now for my next project, I want to embed Python and Nose in a C++ program. I know this means using the python25.dll, and I know how to setup the calls. I thin

Re: fputs in tp_print crashes under Win32

2008-11-14 Thread Gabriel Genellina
En Wed, 12 Nov 2008 08:58:05 -0200, Petr Gotthard <[EMAIL PROTECTED]> escribió: Hello, my C++ extension crashes under Win32 when the tp_print is called. It crashes with both Python 2.5.2 and 2.6. The crash occurs in system32\ntdll.dll, with exception code 0xc005. I found out that this wo

Re: Unsubscriptable object when using Exec

2008-11-14 Thread Indian
Thanks Chris!! It worked.. Yeah my bad i was trying out the bad logic :) On Sat, Nov 15, 2008 at 5:31 AM, Chris Rebert <[EMAIL PROTECTED]> wrote: > On Fri, Nov 14, 2008 at 10:40 AM, Indian <[EMAIL PROTECTED]> wrote: > > Hi Friends > > > > I'm getting the TypeError Unsubscriptable object when usi

Re: special editor support for indentation needed.

2008-11-14 Thread Eric S. Johansson
Aaron Brady wrote: > On Nov 14, 8:01 pm, "Eric S. Johansson" <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >>> I don't understand. If you don't want to terminate the "if", why do >>> you hit backspace? What is it that you would like to have happen? >> the goal is to make some aspects of i

Re: How to eliminate quotes around string field written to a file.

2008-11-14 Thread Shawn Milochik
On Sat, Nov 15, 2008 at 12:19 AM, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 14 Nov 2008 20:39:53 -0800, len wrote: > >> hi >> >> Have this code in my program; >> >> filename = 'custfile' >> codeline = filename + ' = [\n' >> output.write(codeline) >> >> record written to file

Re: How to eliminate quotes around string field written to a file.

2008-11-14 Thread Steven D'Aprano
On Fri, 14 Nov 2008 20:39:53 -0800, len wrote: > hi > > Have this code in my program; > > filename = 'custfile' > codeline = filename + ' = [\n' > output.write(codeline) > > record written to file look like this > > "custfile" = [ I cannot reproduce that behaviour. I suggest

Re: How to eliminate quotes around string field written to a file.

2008-11-14 Thread John Machin
On Nov 15, 3:39 pm, len <[EMAIL PROTECTED]> wrote: > hi > > Have this code in my program; > >     filename = 'custfile' >     codeline = filename + ' = [\n' >     output.write(codeline) > > record written to file look like this > >      "custfile" = [ Assuming output is a file object, what you say

How to eliminate quotes around string field written to a file.

2008-11-14 Thread len
hi Have this code in my program; filename = 'custfile' codeline = filename + ' = [\n' output.write(codeline) record written to file look like this "custfile" = [ Yet in another part of the program I have code: def fmtline(fieldline): code = '(' + fieldline[1].re

Permission Issues in python cgi scripts on Apache 2.2 on OSX Leopard

2008-11-14 Thread Dan Yamins
Using Apache 2.2 on my local OSX machine, I;ve set up a virtual host to serve a directory that a project of mine is in. In this directory, I have some python .cgi scripts that I use to dynamically generated locally-used html code. In several places,scripts that work fine when not run as .cgi scr

Re: Little direction please Python MySQL

2008-11-14 Thread len
On Nov 14, 4:19 am, Bruno Desthuilliers wrote: > len a écrit : > > > > > > > Hi all; > > > I am looking for a little direction in moving from novice python MySQL > > to real world processing. > > > I can connect to MySQL databases and have performed most of the > > various select, create, update,

Re: Little direction please Python MySQL

2008-11-14 Thread len
On Nov 13, 7:32 pm, Ethan Furman <[EMAIL PROTECTED]> wrote: > len wrote: > > Hi all; > > [snip] > > > Here is my problem.  I need to start doing this in the really world at > > my company converting some older cobol system and data to python > > programs and MySQL.  I have gotten past packed decima

Re: web site feedback page using python for sending email

2008-11-14 Thread Philip Semanchuk
On Nov 14, 2008, at 1:48 PM, KAM.covad wrote: Here is a great reference: http://www.thinkspot.net/sheila/staticpages/index.php?page=gypsymail However, the code will not work for an SMTP site like gmail that requires authentication. Anyone know of a site that has that code? I am a nube with

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-14 Thread Terry Reedy
[EMAIL PROTECTED] wrote: On Nov 13, 4:53 pm, Terry Reedy wrote: [EMAIL PROTECTED] wrote: I have yet to see any reasonable definition of a Python value in the Python docs or elsewhere, despite the fact that a value is one of the three defining characteristics of an object, a central concept in

Re: ElementTree XML Namspace

2008-11-14 Thread Mark Tolonen
"Hunter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] We are reviewing a vendor who will output some data in an XML format. I will then use python to convert the data to another format for upload to another vendor. I'm having trouble with very basic steps with the sample file th

Re: C Module question

2008-11-14 Thread Gabriel Genellina
En Mon, 10 Nov 2008 11:44:44 -0200, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribió: On Nov 10, 2:23 pm, Floris Bruynooghe <[EMAIL PROTECTED]> wrote: Sorry, I probably should have mentioned you want to cast the object to PyFileObject and then use the PyFile_AsFile() function to get the FILE*

Re: automatic reload

2008-11-14 Thread alex23
Mike Driscoll <[EMAIL PROTECTED]> wrote: > TurboGears somehow > watches files for changes, so you might want to check out their source > to see how it works. I'm sure it's something similar. I think that's more an inherited feature from TG's use of CherryPy. There's some code provided on the CP si

Re: Windows PE and Python 2.6 (Side-by-Side error)

2008-11-14 Thread Mark Tolonen
"Werner Merkl" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hallo, I like Python 2.6 and I like to use it anywhere, even within Windows PE. In former version of Python (<= 2.5.x) it was easy to bring it to a Windows PE system: Install Python to Windows XP or Vista and (robo-)

Re: Can I check if I'm running from the interpreter prompt?

2008-11-14 Thread alex23
On Nov 15, 9:48 am, [EMAIL PROTECTED] wrote: > Thanks.  I wasn't aware there was a documented way to check for > interactivity.   That's more of a side-effect than the actual intent of those attributes, which are there to hold the interpreter prompts. But it does seem to be the only way. It might

Re: special editor support for indentation needed.

2008-11-14 Thread Aaron Brady
On Nov 14, 8:01 pm, "Eric S. Johansson" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > >  I don't understand. If you don't want to terminate the "if", why do > > you hit backspace? What is it that you would like to have happen? > > the goal is to make some aspects of indentation behave the

Re: Determine the best buffer sizes when using socket.send() and socket.recv()

2008-11-14 Thread Greg Copeland
On Nov 14, 1:58 pm, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > On Nov 14, 5:27 pm, Greg Copeland <[EMAIL PROTECTED]> wrote: > > > > > On Nov 14, 9:56 am, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > I'd like to know if there's a way to determine which is the best > > > buf

Re: special editor support for indentation needed.

2008-11-14 Thread Eric S. Johansson
[EMAIL PROTECTED] wrote: > I don't understand. If you don't want to terminate the "if", why do > you hit backspace? What is it that you would like to have happen? the goal is to make some aspects of indentation behave the same without context dependency. this goal exists for many features of pr

Re: ANN: ActivePython 2.6.0.0 is now available

2008-11-14 Thread Mensanator
On Nov 14, 6:02 pm, Trent Mick <[EMAIL PROTECTED]> wrote: > I'm happy to announce that ActivePython 2.6.0.0 is now > available for download from: >      http://www.activestate.com/Products/activepython/ > > ActivePython 2.6.0.0 is based on Python 2.6.0. > > What is ActivePython? > -

Re: object creation

2008-11-14 Thread Jerry Hill
On Fri, Nov 14, 2008 at 6:38 PM, Joe Strout <[EMAIL PROTECTED]> wrote: > On Nov 14, 2008, at 4:33 PM, Jerry Hill wrote: > >> Then add >> def __init__(self): >> a = 0 >> b = 0 > > Doesn't that have to be "self.a" and "self.b"? Yes, that should indeed have been self.a and self.b! Sorry about that

Re: best python unit testing framwork

2008-11-14 Thread Brendan Miller
On Thu, Nov 13, 2008 at 3:54 AM, James Harris <[EMAIL PROTECTED]> wrote: > On 11 Nov, 22:59, Brendan Miller <[EMAIL PROTECTED]> wrote: >> What would heavy python unit testers say is the best framework? >> >> I've seen a few mentions that maybe the built in unittest framework >> isn't that great. I'

Re: object creation

2008-11-14 Thread Steven D'Aprano
On Fri, 14 Nov 2008 16:38:15 -0700, Joe Strout wrote: > On Nov 14, 2008, at 4:33 PM, Jerry Hill wrote: > >> Then add >> def __init__(self): >> a = 0 >> b = 0 >> >> to your box class to make a and b instance variables. > > Doesn't that have to be "self.a" and "self.b"? Only if you want it to

Re: duck-type-checking?

2008-11-14 Thread Steven D'Aprano
On Fri, 14 Nov 2008 13:28:27 -0700, Joe Strout wrote: > But this class wasn't really that complex; it's just that it assumed all > the stuff it's being fed were strings (or could be treated as strings), > and I inadvertently fed it an NLTK.Tree node instead (not realizing that > a library method I

Re: Code generation architecture question

2008-11-14 Thread Alex_Gaynor
On Nov 14, 3:04 am, Aaron Brady <[EMAIL PROTECTED]> wrote: > On Nov 13, 7:16 pm, Alex_Gaynor <[EMAIL PROTECTED]> wrote: > > > I'm trying to figure out what the best architecture for doing code > > generation would be.  I have a set of ASTs that define a program, so > > what should I do to for code

Re: Unsubscriptable object when using Exec

2008-11-14 Thread Chris Rebert
On Fri, Nov 14, 2008 at 10:40 AM, Indian <[EMAIL PROTECTED]> wrote: > Hi Friends > > I'm getting the TypeError Unsubscriptable object when using Exec in a class > > Here's the example > > class Fake(object): > def __init__(self, reg): > self._reg = reg > > def OpenKey(self, rootkey, path):

ANN: ActivePython 2.6.0.0 is now available

2008-11-14 Thread Trent Mick
I'm happy to announce that ActivePython 2.6.0.0 is now available for download from: http://www.activestate.com/Products/activepython/ ActivePython 2.6.0.0 is based on Python 2.6.0. What is ActivePython? - ActivePython is ActiveState's binary distribution of Python. Bui

Re: Can I check if I'm running from the interpreter prompt?

2008-11-14 Thread skip
Peter> hasattr(sys, "ps1") Thanks. I wasn't aware there was a documented way to check for interactivity. It would have been more obvious if sys had an "isinteractive" method or attribute. -- Skip Montanaro - [EMAIL PROTECTED] - http://smontanaro.dyndns.org/ -- http://mail.python.org/mailm

Re: object creation

2008-11-14 Thread Bruno Desthuilliers
BiraRai a écrit : (snip) class box: a = int() b = int() I strongly suggest you read the tutorial. -- http://mail.python.org/mailman/listinfo/python-list

Re: object creation

2008-11-14 Thread Bruno Desthuilliers
BiraRai a écrit : for record in roll: x = box() x.createSomething(record) do something Can anyone tell me why python keeps return the original object x that was created in the FOR loop. Where is the "return" statement ? I want to instantiate a new x object for each iterat

Re: object creation

2008-11-14 Thread Bruno Desthuilliers
Jerry Hill a écrit : On Fri, Nov 14, 2008 at 6:10 PM, BiraRai <[EMAIL PROTECTED]> wrote: class box: a = int() b = int() def createSomething(self,x): At a guess, x = box() does create a new instance of your box class, but since you've declared a and b to be class variables instead of inst

Re: using "private" parameters as static storage?

2008-11-14 Thread Aaron Brady
On Nov 13, 4:23 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > def static(**vars): >     ns = NS(vars) >     def deco(f): >         return lambda *args, **kwargs: f(ns, *args, **kwargs) >     return deco > > @static(ncalls=0, history=[]) > def foo(ns, x): >    ns.ncalls += 1 >    ns.history.appe

Re: object creation

2008-11-14 Thread Joe Strout
On Nov 14, 2008, at 4:33 PM, Jerry Hill wrote: Then add def __init__(self): a = 0 b = 0 to your box class to make a and b instance variables. Doesn't that have to be "self.a" and "self.b"? Best, - Joe -- http://mail.python.org/mailman/listinfo/python-list

Re: object creation

2008-11-14 Thread Jerry Hill
On Fri, Nov 14, 2008 at 6:10 PM, BiraRai <[EMAIL PROTECTED]> wrote: > class box: > a = int() > b = int() > > def createSomething(self,x): At a guess, x = box() does create a new instance of your box class, but since you've declared a and b to be class variables instead of instance variables,

C Function Pointer Wrapping Example not working

2008-11-14 Thread Charlie
Hi All, I am new to using swig/C++/python. I got some problem with function pointers. I posted in swig-user, but got no response. So I forwarded it here. You help is greatly appreciated. Thanks! -- Forwarded message -- Hi All, Yesterday I posted about the question I had of temp

Re: duck-type-checking?

2008-11-14 Thread Steve Holden
Joe Strout wrote: > On Nov 14, 2008, at 2:07 PM, Paul McGuire wrote: > >> Or to be even more thorough: >> def sub(x: must have getitem, y: must have strip and strip must be >> callable, and y.strip must return something that has replace and >> replace must be callable) >> >> So even this simple ex

Re: object creation

2008-11-14 Thread BiraRai
On Nov 14, 5:44 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Nov 14, 5:16 pm, BiraRai <[EMAIL PROTECTED]> wrote: > > > for record in roll: > >     x = box() > >     x.createSomething(record) > >     do something > > > Can anyone tell me why python keeps return the original object x that >

Re: special editor support for indentation needed.

2008-11-14 Thread [EMAIL PROTECTED]
On Nov 14, 5:27 pm, "Eric S. Johansson" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Nov 14, 4:08 pm, "Eric S. Johansson" <[EMAIL PROTECTED]> wrote: > >> Almar Klein wrote: > >>> Hi Eric, > >>> First of all, I like your initiative. > >> there's nothing like self interest to drive on

Re: object creation

2008-11-14 Thread George Sakkis
On Nov 14, 5:16 pm, BiraRai <[EMAIL PROTECTED]> wrote: > for record in roll: >     x = box() >     x.createSomething(record) >     do something > > Can anyone tell me why python keeps return the original object x that > was created in the FOR loop.  I want to instantiate a new x object for > e

Re: duck-type-checking?

2008-11-14 Thread George Sakkis
On Nov 14, 4:49 pm, Joe Strout <[EMAIL PROTECTED]> wrote: > So things like this should suffice: > >         # simple element >         assert(is_stringlike(foo)) >         assert(is_numeric(foo)) >         assert(is_like(foo, Duck)) > >         # sequence of elements >         assert(seqof_stringl

Re: special editor support for indentation needed.

2008-11-14 Thread Eric S. Johansson
[EMAIL PROTECTED] wrote: > On Nov 14, 4:08 pm, "Eric S. Johansson" <[EMAIL PROTECTED]> wrote: >> Almar Klein wrote: >>> Hi Eric, >>> First of all, I like your initiative. >> there's nothing like self interest to drive one's initiative. :-) 14 years >> with >> speech recognition and counting. I'm

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-14 Thread rurpy
On Nov 13, 4:53 pm, Terry Reedy wrote: > [EMAIL PROTECTED] wrote: > >> I have yet to see any reasonable definition of a Python >> value in the Python docs or elsewhere, despite the fact >> that a value is one of the three defining characteristics >> of an object, a central concept in Python. > > I

object creation

2008-11-14 Thread BiraRai
for record in roll: x = box() x.createSomething(record) do something Can anyone tell me why python keeps return the original object x that was created in the FOR loop. I want to instantiate a new x object for each iteration of the FOR loop -- http://mail.python.org/mailman/list

Re: using "private" parameters as static storage?

2008-11-14 Thread Arnaud Delobelle
Joe Strout <[EMAIL PROTECTED]> writes: > On Nov 13, 2008, at 3:23 PM, Arnaud Delobelle wrote: > >> Aaron Brady <[EMAIL PROTECTED]> writes: >> >>> One way around it, which I like the idea of but I'll be honest, I've >>> never used, is getting a function a 'self' parameter. You could make >>> it a

Re: special editor support for indentation needed.

2008-11-14 Thread [EMAIL PROTECTED]
On Nov 14, 4:08 pm, "Eric S. Johansson" <[EMAIL PROTECTED]> wrote: > Almar Klein wrote: > > Hi Eric, > > > First of all, I like your initiative. > > there's nothing like self interest to drive one's initiative.  :-) 14 years > with > speech recognition and counting.  I'm so looking to my 15th anni

ElementTree XML Namspace

2008-11-14 Thread Hunter
We are reviewing a vendor who will output some data in an XML format. I will then use python to convert the data to another format for upload to another vendor. I'm having trouble with very basic steps with the sample file they sent me. My very simple test script is: from xml.etree.ElementTree i

Re: Can I check if I'm running from the interpreter prompt?

2008-11-14 Thread Peter Otten
[EMAIL PROTECTED] wrote: > Is there a reliable way (this is on Solaris if that matters) to tell if > I'm > running in the interactive interpreter as opposed to in a script? I think > examining sys.argv works, but wanted to double check. hasattr(sys, "ps1") http://www.python.org/doc/2.5.2/lib/mo

Re: duck-type-checking?

2008-11-14 Thread Joe Strout
On Nov 14, 2008, at 2:07 PM, Paul McGuire wrote: Or to be even more thorough: def sub(x: must have getitem, y: must have strip and strip must be callable, and y.strip must return something that has replace and replace must be callable) So even this simple example gets nasty in a hurry, let alon

Re: Can I check if I'm running from the interpreter prompt?

2008-11-14 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: Is there a reliable way (this is on Solaris if that matters) to tell if I'm running in the interactive interpreter as opposed to in a script? I think examining sys.argv works, but wanted to double check. import sys, traceback try: raise ValueError

Re: Avoiding local variable declarations?

2008-11-14 Thread Paul McGuire
On Nov 14, 12:08 pm, Mark Wooding <[EMAIL PROTECTED]> wrote: > Chris Mellon <[EMAIL PROTECTED]> wrote: > > Any time you port between languages, it's rarely a good idea to just > > convert code verbatim. For example: > > > import random, string > > def random_char(): > >     return random.choice(str

Re: duck-type-checking?

2008-11-14 Thread Paul McGuire
On Nov 14, 1:27 pm, [EMAIL PROTECTED] wrote: > On Nov 14, 12:47 am, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > > > On Nov 13, 10:55 pm, Steven D'Aprano <[EMAIL PROTECTED] > > > cybersource.com.au> wrote: > > > Take this example: > > > > def foo(alist): > > >     alist.sort() > > >     alist

Re: special editor support for indentation needed.

2008-11-14 Thread Eric S. Johansson
Almar Klein wrote: > Hi Eric, > > First of all, I like your initiative. there's nothing like self interest to drive one's initiative. :-) 14 years with speech recognition and counting. I'm so looking to my 15th anniversary of being injured next year another initiative is exporting the spee

Re: return a value to shell script

2008-11-14 Thread News123
I don't know what exactly your python script is doing and what kind of return value you have, Let's assume your python application prints nothing to stdout, then python could print out the return value and you could get it with the back ticks (reverse single quote) (at least for sh bash csh tcsh a

Re: Multiprocessing vs. [Pyro, RPyC]

2008-11-14 Thread Jeffrey Barish
[EMAIL PROTECTED] wrote: > > Jeffrey> With the release of multiprocessing in Python 2.6, is there > any Jeffrey> reason to use Pyro or RPyC? > > As far as I know the multiprocessing module only works on one machine > (multi-cpu or multi-core), not across machines. So I thought at first,

Re: Multiprocessing vs. [Pyro, RPyC]

2008-11-14 Thread skip
Jeffrey> With the release of multiprocessing in Python 2.6, is there any Jeffrey> reason to use Pyro or RPyC? As far as I know the multiprocessing module only works on one machine (multi-cpu or multi-core), not across machines. -- Skip Montanaro - [EMAIL PROTECTED] - http://smontanaro.d

Multiprocessing vs. [Pyro, RPyC]

2008-11-14 Thread Jeffrey Barish
With the release of multiprocessing in Python 2.6, is there any reason to use Pyro or RPyC? -- Jeffrey Barish -- http://mail.python.org/mailman/listinfo/python-list

web site feedback page using python for sending email

2008-11-14 Thread KAM.covad
Here is a great reference: http://www.thinkspot.net/sheila/staticpages/index.php?page=gypsymail However, the code will not work for an SMTP site like gmail that requires authentication. Anyone know of a site that has that code? I am a nube with python and am looking for a way to learn as well a

Re: duck-type-checking?

2008-11-14 Thread Joe Strout
On Nov 14, 2008, at 12:27 PM, [EMAIL PROTECTED] wrote: What would be actually interesting would be an switch to the python interpreter that internally annotated function parameters with how they are used in the function and raised an exception as soon as the function is called instead of later.

Question: what to do, my Python is getting crazy

2008-11-14 Thread Pekeika
Good morning group, When I open my Python window, this is appearing instead of the command line >>>. (I'm somehow new to Python). File "boot_com_servers.py", line 21, in File "C:\Python25\lib\site-packages\pythoncom.py", line 3, in pywintypes.__import_pywin32_system_module__("pythoncom"

Re: special editor support for indentation needed.

2008-11-14 Thread Matimus
On Nov 14, 11:41 am, "Eric S. Johansson" <[EMAIL PROTECTED]> wrote: > in trying to make programming in Python more accessible to disabled > programmers > (specifically mobility impaired speech recognition users), and hitting a bit > of > a wall.  The wall (for today) is indentation.  I need a met

Re: running same script on same data on two different machines --> different result

2008-11-14 Thread John Machin
On Nov 15, 2:14 am, Christopher Brewster <[EMAIL PROTECTED]> wrote: > I am running the same script on the same data on two different > machines (the folder is synchronised with Dropbox). > I get two different results. All the script does is count words in > different files and perform a simple set

Re: Sort dictionary by value when value is a list

2008-11-14 Thread Chris Rebert
On Fri, Nov 14, 2008 at 10:26 AM, major-john <[EMAIL PROTECTED]> wrote: > I'm having trouble sorting a dictionary based on values when the values are > all lists, and i want to sort the list by key with the largest value lists > in decreasing size. > > Currently, I have the following: > > from oper

Re: special editor support for indentation needed.

2008-11-14 Thread Almar Klein
Hi Eric, First of all, I like your initiative. I'm not sure if I undestand you correctly, but can't you just increase indentation after each line that ends with a colon? That's how I do it in my editor. The user would then only need to specify when to decrease indentation. Cheers, Almar 2008/

Re: find() a larger string within a smaller string

2008-11-14 Thread Gary Herron
korean_dave wrote: > stringa = "hi" > stringb = "hiy" > > I'd like it to return -1 when I do: > > returnVal = stringa.find(stringb); > > Instead, it treats stringa as "hi" and stringb as "hi". > No it doesn't. stringb is "hiy" and it "treats" it that way. (And just what do you mean

Re: Determine the best buffer sizes when using socket.send() and socket.recv()

2008-11-14 Thread Giampaolo Rodola'
On Nov 14, 5:27 pm, Greg Copeland <[EMAIL PROTECTED]> wrote: > On Nov 14, 9:56 am, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > > > > > > > Hi, > > I'd like to know if there's a way to determine which is the best > > buffer size to use when you have to send() and recv() some data over > > the n

Looking for traffic generating utility (like ping)

2008-11-14 Thread [EMAIL PROTECTED]
Hello, I am looking for a utility that will generate any number of pings per second, and allow me to check how many of the pings in the last X seconds have been dropped, while it is still running. The reason I can't use the built-in Unix ping is that 1) it does not provide overall feedback while i

special editor support for indentation needed.

2008-11-14 Thread Eric S. Johansson
in trying to make programming in Python more accessible to disabled programmers (specifically mobility impaired speech recognition users), and hitting a bit of a wall. The wall (for today) is indentation. I need a method of getting the "right indentation" without having to speak a bunch of unnece

Re: find() a larger string within a smaller string

2008-11-14 Thread John Machin
On Nov 15, 6:20 am, korean_dave <[EMAIL PROTECTED]> wrote: > stringa = "hi" > stringb = "hiy" > > I'd like it to return -1 when I do: > > returnVal = stringa.find(stringb); > > Instead, it treats stringa as "hi" and stringb as "hi". You appear to be gravely mistaken: | >>> stringa = "hi" | >>

Re: find() a larger string within a smaller string

2008-11-14 Thread Mensanator
On Nov 14, 1:20 pm, korean_dave <[EMAIL PROTECTED]> wrote: > stringa = "hi" > stringb = "hiy" > > I'd like it to return -1 when I do: > > returnVal = stringa.find(stringb); > > Instead, it treats stringa as "hi" and stringb as "hi". > > How do I solve this? Try this: >>> stringa = 'hi' >>> st

Re: duck-type-checking?

2008-11-14 Thread pruebauno
On Nov 14, 12:47 am, George Sakkis <[EMAIL PROTECTED]> wrote: > On Nov 13, 10:55 pm, Steven D'Aprano <[EMAIL PROTECTED] > > cybersource.com.au> wrote: > > Take this example: > > > def foo(alist): > > alist.sort() > > alist.append(5) > > > The argument can be any object with sort and append

find() a larger string within a smaller string

2008-11-14 Thread korean_dave
stringa = "hi" stringb = "hiy" I'd like it to return -1 when I do: returnVal = stringa.find(stringb); Instead, it treats stringa as "hi" and stringb as "hi". How do I solve this? -- http://mail.python.org/mailman/listinfo/python-list

Re: Sort dictionary by value when value is a list

2008-11-14 Thread Vlastimil Brom
2008/11/14 major-john <[EMAIL PROTECTED]> > I'm having trouble sorting a dictionary based on values when the values are > all lists, and i want to sort the list by key with the largest value lists > in decreasing size. > > Currently, I have the following: > > from operator import itemgetter > > di

Fw: automatic reload

2008-11-14 Thread Alan Baljeu
Alan Baljeu http://www.collaborative-systems.org Intelligent software that works _with_ you. - Forwarded Message From: Alan Baljeu <[EMAIL PROTECTED]> To: Mike Driscoll <[EMAIL PROTECTED]> Sent: Friday, November 14, 2008 2:06:26 PM Subject: Re: automatic reload I thought I was readi

Re: What is the best Python GUI API?

2008-11-14 Thread rm
On Nov 14, 1:59 pm, rm <[EMAIL PROTECTED]> wrote: > On Nov 13, 7:08 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: > > > rm wrote: > > > On Nov 13, 2:23 pm, James Harris <[EMAIL PROTECTED]> > > > wrote: > > > >> On 13 Nov, 18:59, Stef Mientki <[EMAIL PROTECTED]> wrote: > > > >>> Abah Joseph wrote: > >

Re: What is the best Python GUI API?

2008-11-14 Thread rm
On Nov 13, 7:08 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: > rm wrote: > > On Nov 13, 2:23 pm, James Harris <[EMAIL PROTECTED]> > > wrote: > > >> On 13 Nov, 18:59, Stef Mientki <[EMAIL PROTECTED]> wrote: > > >>> Abah Joseph wrote: > >  What is the best Python GUI API? I am planning to start m

Unsubscriptable object when using Exec

2008-11-14 Thread Indian
Hi Friends I'm getting the TypeError Unsubscriptable object when using Exec in a class Here's the example class Fake(object): def __init__(self, reg): self._reg = reg def OpenKey(self, rootkey, path): open_key = self._reg path_string='[\'HKLM\']' for key in path.split('\\'):

Re: Building musical chords starting from (a lot of) rules

2008-11-14 Thread bvdp
Mr.SpOOn wrote: Hi, I'm writing a method to create musical chords. This method must follow a specific set of syntax rules. At least, this is my idea, but maybe there's a better way. Anyway, in the code I have class Chord which is a set. The costrunction of a chord is based on a root note and a

Re: Clustering the keys of a dict according to its values

2008-11-14 Thread Mark Wooding
Florian Brucker <[EMAIL PROTECTED]> wrote: > That is, generate a new dict which holds for each value of the old > dict a list of the keys of the old dict that have that very value. > Another requirement is that it should also work on lists, in that case > with indices instead of keys. We may assum

Sort dictionary by value when value is a list

2008-11-14 Thread major-john
I'm having trouble sorting a dictionary based on values when the values are all lists, and i want to sort the list by key with the largest value lists in decreasing size. Currently, I have the following: from operator import itemgetter dict = {'A': [(10, 20), (12, 18), (5, 11), (18, 25)], 'C': [

Re: Building musical chords starting from (a lot of) rules

2008-11-14 Thread Paul McNett
Mr.SpOOn wrote: Anyway, I think I can use a chain of if-clauses, one per rule and at the end remove the notes marked with "no". But this seems to me a very bad solution, not so pythonic. Before I proceed for this way, do you have any suggestion? Hope the problem is not too complicated. I say,

Re: Building musical chords starting from (a lot of) rules

2008-11-14 Thread Dan Upton
On Fri, Nov 14, 2008 at 1:00 PM, Mr. SpOOn <[EMAIL PROTECTED]> wrote: > Hi, > I'm writing a method to create musical chords. > > This method must follow a specific set of syntax rules. At least, this > is my idea, but maybe there's a better way. > Anyway, in the code I have class Chord which is a s

Re: Avoiding local variable declarations?

2008-11-14 Thread Mark Wooding
Chris Mellon <[EMAIL PROTECTED]> wrote: > Any time you port between languages, it's rarely a good idea to just > convert code verbatim. For example: > > import random, string > def random_char(): > return random.choice(string.ascii_letters + string.digits) Note that this code doesn't preserve

Re: using "private" parameters as static storage?

2008-11-14 Thread Joe Strout
On Nov 13, 2008, at 8:26 PM, Steven D'Aprano wrote: def spam(_count=[0]): _count[0] += 1 return "spam " * _count[0] This is a common trick, often used for things like caching. One major advantage is that you are exposing the cache as an *optional* part of the interface, which make

Re: using "private" parameters as static storage?

2008-11-14 Thread Joe Strout
On Nov 13, 2008, at 3:23 PM, Arnaud Delobelle wrote: Aaron Brady <[EMAIL PROTECTED]> writes: One way around it, which I like the idea of but I'll be honest, I've never used, is getting a function a 'self' parameter. You could make it a dictionary or a blank container object, or just the funct

Building musical chords starting from (a lot of) rules

2008-11-14 Thread Mr . SpOOn
Hi, I'm writing a method to create musical chords. This method must follow a specific set of syntax rules. At least, this is my idea, but maybe there's a better way. Anyway, in the code I have class Chord which is a set. The costrunction of a chord is based on a root note and a structure, so by d

Re: automatic reload

2008-11-14 Thread Mike Driscoll
On Nov 14, 11:04 am, Alan Baljeu <[EMAIL PROTECTED]> wrote: > I need a solution for automatically reloading files I edited.  This is in a > unit testing/fixing context, so there shouldn't be much problem with leftover > data.  I just need to be able to call a reload_changed() method of some sort

Re: urllib2 - safe way to download something

2008-11-14 Thread konstantin
On 14 нояб, 18:12, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Fri, 14 Nov 2008 06:35:27 -0800, konstantin wrote: > > Hi, > > > I wonder if there is a safe way to download page with urllib2. I've > > constructed following method to catch all possible exceptions. > > See here:

automatic reload

2008-11-14 Thread Alan Baljeu
I need a solution for automatically reloading files I edited. This is in a unit testing/fixing context, so there shouldn't be much problem with leftover data. I just need to be able to call a reload_changed() method of some sort before rerunning tests. Stopping and restarting the python inter

Re: using "private" parameters as static storage?

2008-11-14 Thread Chris Mellon
On Thu, Nov 13, 2008 at 10:25 PM, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 14 Nov 2008 13:35:02 +1100, Ben Finney wrote: > >> Instead, it looks like you're falling foul of one of the classic >> mistakes in the "How to ask questions the smart way" document: you've >> got a goal, but you'

Re: Windows PE and Python 2.6 (Side-by-Side error)

2008-11-14 Thread Martin v. Löwis
> Has anyone an idea? You should not install "for all users" before copying it, but "just for me". Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Text based screens without ncurses

2008-11-14 Thread Shawn Milochik
On Thu, Nov 13, 2008 at 2:10 PM, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-11-13, Mirat Can Bayrak <[EMAIL PROTECTED]> wrote: > >> Hi, i'll try to write a editor in python, i want it run under >> terminal (no qt or gtk) but i dont want to use urwid or curses >> modules. >> >> Can i write m

Re: [UnicodeEncodeError] Don't know what else to try

2008-11-14 Thread Martin v. Löwis
Gilles Ganault wrote: > On Fri, 14 Nov 2008 11:01:27 +0100, "Martin v. Löwis" > <[EMAIL PROTECTED]> wrote: >> Add >>print type(output) >> here. If it says "unicode", reconsider the next line >> >>> print output.decode('utf-8') > > In case the string fetc

  1   2   >