Re: Extended slicing and Ellipsis - where are they used?

2007-09-14 Thread Paddy
On Sep 15, 12:29 am, James Stroud <[EMAIL PROTECTED]> wrote: > Paddy wrote: > > And the ellipses ... ? > > ;) > > py> class Bob(dict): > ... def __getitem__(self, k, *args, **kwargs): > ... if k is Ellipsis: > ... return sorted(self.keys()) > ... else: > ... return dict.__geti

Re: regexp search on infinite string?

2007-09-14 Thread Paddy
On Sep 15, 2:57 am, James Stroud <[EMAIL PROTECTED]> wrote: > Paddy wrote: > > Lets say i have a generator running that generates successive > > characters of a 'string' > >>From what I know, if I want to do a regexp search for a pattern of > > characters then I would have to 'freeze' the generator

Re: smtp debugging methods

2007-09-14 Thread Tim Roberts
Sean Nakasone <[EMAIL PROTECTED]> wrote: > >I'm having trouble with sending smtp mail. It's hanging after the >smtplib.SMTP() line. It doesn't works from home but not from work. What's >the best way to debug this? It's quite possible that your network at work has a firewall blocking these port

(wxPython) wx.ProgressDialog - how to cancel out of?

2007-09-14 Thread Terry Carroll
I'm trying to use wx.ProgressBar, and the cancel button is not responding. Here is a simple program that exhibits the problem: # import wx import time max = 10 app = wx.PySimpleApp() dlg = wx.ProgressDialog("Progress dialog example",

Re: How to avoid overflow errors

2007-09-14 Thread Steven D'Aprano
On Fri, 14 Sep 2007 18:19:45 -0700, James Stroud wrote: >> How do I subclass int and/or long so that my class also auto-converts >> only when needed? >> >> >> >> > Use __new__. The disadvantage of that is that your example code requires me to duplicate my methods in the long version and the

Re: How to avoid overflow errors

2007-09-14 Thread Steven D'Aprano
On Fri, 14 Sep 2007 21:43:38 -0300, Eduardo O. Padoan wrote: >> How do I subclass int and/or long so that my class also auto-converts >> only when needed? > > What about just subclassing long - is this not an option? Of course it's an option. As it turned out, that was the easiest way for me to

Re: Coming from Perl

2007-09-14 Thread Bryan Olson
Amer Neely wrote: > This seems to indicate that maybe my host needs to configure Apache to > run python scripts? But I didn't need to do anything with mine. Another possibility: If it works on Windows but not Unix, check the end-of-line characters. Windows ends each line with the two character se

Re: An ordered dictionary for the Python library?

2007-09-14 Thread Carl Banks
On Thu, 13 Sep 2007 19:21:08 -0700, James Stroud wrote: > Carl Banks wrote: >> On Sep 13, 4:20 pm, James Stroud <[EMAIL PROTECTED]> wrote: >>> Mark Summerfield wrote: - If an item is inserted it is put in the right place (because the underlying data structure, b*tree, skiplist or whateve

Re: How to avoid overflow errors

2007-09-14 Thread Carl Banks
On Fri, 14 Sep 2007 22:59:13 -0300, Eduardo O. Padoan wrote: > On 14 Sep 2007 18:08:00 -0700, Paul Rubin > <"http://phr.cx"@nospam.invalid> wrote: >> "Eduardo O. Padoan" <[EMAIL PROTECTED]> writes: >> > Not totally unrelated, but in Py3k, as it seems, overflows are really >> > things of the past:

Re: An ordered dictionary for the Python library?

2007-09-14 Thread Mark Summerfield
On 14 Sep, 21:23, James Stroud <[EMAIL PROTECTED]> wrote: > Mark Summerfield wrote: > > I guess I'll have to rename my module (although unfortunately, my book > > has just gone into production and I have a (simpler) example of what I > > considered to be an ordered dict, so I will be adding to the

Re: Possible suggestion for removing the GIL

2007-09-14 Thread Bryan Olson
Prateek wrote: [...] > Mainly it revolves around dedicating one core for executing > synchronized code and doing context switches instead of acquiring/ > releasing locks. > > http://www.brainwavelive.com/blog/index.php?/archives/12-Suggestion-for-removing-the-Python-Global-Interpreter-Lock.html C

Re: Python 3K or Python 2.9?

2007-09-14 Thread David Trudgett
TheFlyingDutchman <[EMAIL PROTECTED]> writes: > The confusing way about the current Python method when you first > encounter it is > why is "self" being passed in when you write the function but not > when you call it. If the compiler is smart enough to know that > > a = MyClass() > a.Som

Re: [Tutor] Is there some sort of Python Error log.

2007-09-14 Thread Luke Paireepinart
Lamonte Harris wrote: > Command prompt is a pain and it would be pretty nice to have this feature. If you're on windows, try using an IDE for your code editing. Then the errors will show up in the interactive shell that the IDE runs, and you won't have to deal with starting a DOS command prompt

Re: [pygame] Re: Just bought Python in a Nutshell

2007-09-14 Thread Luke Paireepinart
Lamonte Harris wrote: > Wow I just got it, and its nice doesn't even look used god damn. :D. It's generally considered rude to curse in technical forums such as this. Also, please use more punctuation. You're hard to understand sometimes. -Luke -- http://mail.python.org/mailman/listinfo/python-li

Re: [Tutor] Is there some sort of Python Error log.

2007-09-14 Thread Rikard Bosnjakovic
On 15/09/2007, Lamonte Harris <[EMAIL PROTECTED]> wrote: > Command prompt is a pain and it would be pretty nice to have this feature. If you are using a Unixish system, do "python myscript.py 2> error.log". -- - Rikard - http://bos.hack.org/cv/ -- http://mail.python.org/mailman/listinfo/pytho

Re: reading xls file from python

2007-09-14 Thread Gabriel Genellina
En Fri, 14 Sep 2007 18:56:34 -0300, <[EMAIL PROTECTED]> escribi�: > I have installed python 2.5 for windows in my pc, I have a file xls say > "file.xls" in c:/python25. How I can read this files from Python. Many > thanks in advance. Try xlrd: http://www.python.org/pypi/xlrd -- Gabriel Gene

Re: List append

2007-09-14 Thread mouseit
On Sep 14, 11:42 pm, Stephen <[EMAIL PROTECTED]> wrote: > In your code, "array" is a class attribute, so it is shared among all > instances. You need to use the __init__ method to define instance > (data) attributes instead: > > def __init__(self): > self.array = [] > > On Sep 14, 11:25 pm, mou

Re: List append

2007-09-14 Thread Stephen
In your code, "array" is a class attribute, so it is shared among all instances. You need to use the __init__ method to define instance (data) attributes instead: def __init__(self): self.array = [] On Sep 14, 11:25 pm, mouseit <[EMAIL PROTECTED]> wrote: > I'm trying to add an element to a li

List append

2007-09-14 Thread mouseit
I'm trying to add an element to a list which is a property of an object, stored in an array. When I append to one element, all of the lists are appended! Example Code: class Test: array = [] myTests = [Test() , Test() , Test()] print len(myTests[1].array) myTests[0].array.append( 5 ) print l

Re: subclass of integers

2007-09-14 Thread Gabriel Genellina
En Fri, 14 Sep 2007 20:16:36 -0300, Dan Bishop <[EMAIL PROTECTED]> escribi�: > On Sep 14, 9:30 am, Mark Morss <[EMAIL PROTECTED]> wrote: >> I would like to construct a class that includes both the integers and >> None. I desire that if x and y are elements of this class, and both >> are integer

Re: Python 3K or Python 2.9?

2007-09-14 Thread Ricardo Aráoz
Bruno Desthuilliers wrote: > TheFlyingDutchman a écrit : >> Well I'm with Bruce Eckel - there shouldn't be any argument for the >> object in the class method parameter list. > > def fun(obj, *args, **kw): ># generic code here that do something with obj > > import some_module > some_module.Som

Re: How to avoid overflow errors

2007-09-14 Thread Eduardo O. Padoan
On 14 Sep 2007 18:08:00 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > "Eduardo O. Padoan" <[EMAIL PROTECTED]> writes: > > Not totally unrelated, but in Py3k, as it seems, overflows are really > > things of the past: > > > > > > Python 3.0a1 (py3k:58061, Sep 9 2007, 13:18:37) > > [GCC

Re: regexp search on infinite string?

2007-09-14 Thread James Stroud
Paddy wrote: > Lets say i have a generator running that generates successive > characters of a 'string' >>From what I know, if I want to do a regexp search for a pattern of > characters then I would have to 'freeze' the generator and pass the > characters so far to re.search. > It is expensive to

Re: vi and python

2007-09-14 Thread Danyelle Gragsone
Thanks for the link, Apparently when I added python into my use list. Python support was added it :D. I <3 gentoo. -- http://mail.python.org/mailman/listinfo/python-list

Re: vi and python

2007-09-14 Thread BartlebyScrivener
On Sep 14, 7:35 pm, "Danyelle Gragsone" <[EMAIL PROTECTED]> wrote: > Good Evening, > > I am running gentoo. I want to use vi to program in python. I > wondered are there any other gentooovians out there who know if python > support is already installed. http://tinyurl.com/2mzakm rd -- http://

Re: How to avoid overflow errors

2007-09-14 Thread James Stroud
Steven D'Aprano wrote: > I thought that overflow errors would be a thing of the past now that > Python automatically converts ints to longs as needed. Unfortunately, > that is not the case. > class MyInt(int): > ... pass > ... MyInt(sys.maxint) > 2147483647 MyInt(sys.maxint+1)

Re: How to avoid overflow errors

2007-09-14 Thread Paul Rubin
"Eduardo O. Padoan" <[EMAIL PROTECTED]> writes: > Not totally unrelated, but in Py3k, as it seems, overflows are really > things of the past: > > > Python 3.0a1 (py3k:58061, Sep 9 2007, 13:18:37) > [GCC 4.1.3 20070831 (prerelease) (Ubuntu 4.1.2-16ubuntu1)] on linux2 > Type "help", "copyright", "

Re: How to avoid overflow errors

2007-09-14 Thread Eduardo O. Padoan
On 9/14/07, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > I thought that overflow errors would be a thing of the past now that > Python automatically converts ints to longs as needed. Unfortunately, > that is not the case. > > >>> class MyInt(int): > ... pass > ... > >>> MyInt(sys.maxint) > 2147

vi and python

2007-09-14 Thread Danyelle Gragsone
Good Evening, I am running gentoo. I want to use vi to program in python. I wondered are there any other gentooovians out there who know if python support is already installed. Thanks, LadyNikon -- http://mail.python.org/mailman/listinfo/python-list

How to avoid overflow errors

2007-09-14 Thread Steven D'Aprano
I thought that overflow errors would be a thing of the past now that Python automatically converts ints to longs as needed. Unfortunately, that is not the case. >>> class MyInt(int): ... pass ... >>> MyInt(sys.maxint) 2147483647 >>> MyInt(sys.maxint+1) Traceback (most recent call last): Fi

Python Papers Reader Survey

2007-09-14 Thread [EMAIL PROTECTED]
Greetings, readers. I have put together a survey designed to capture a little information about how I can better target "The Python Papers" towards the needs of its readers. This survey has been created as a part of my "Marketing Management" assignment for my Masters of Business Administration stud

Re: Https conversation - debug?

2007-09-14 Thread Bjoern Schliessmann
Johny wrote: > Is there any good sniffer for https protocol? Yes. > How can be watched https conversation? As a matter of principle, with every working sniffer. I'd use wireshark's "follow TCP stream" function. Regards, Björn -- BOFH excuse #198: Post-it Note Sludge leaked into the monito

Re: Car-ac-systems

2007-09-14 Thread Arne Vajhøj
[text reordered from top post to standard newsgroup style] John Timney (MVP) wrote: > <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> On Sep 11, 9:35 am, "John Timney \(MVP\)" >> <[EMAIL PROTECTED]> wrote: >>> How do I control one with C# then! Thats not on your site, clearly no

Is there some sort of Python Error log.

2007-09-14 Thread Lamonte Harris
Command prompt is a pain and it would be pretty nice to have this feature. -- http://mail.python.org/mailman/listinfo/python-list

Re: Extended slicing and Ellipsis - where are they used?

2007-09-14 Thread James Stroud
Paddy wrote: > And the ellipses ... ? ;) py> class Bob(dict): ... def __getitem__(self, k, *args, **kwargs): ... if k is Ellipsis: ... return sorted(self.keys()) ... else: ... return dict.__getitem__(self, k, *args, **kwargs) ... def __setitem__(self, k, *args, **kwargs):

Re: subclass of integers

2007-09-14 Thread Dan Bishop
On Sep 14, 9:30 am, Mark Morss <[EMAIL PROTECTED]> wrote: > I would like to construct a class that includes both the integers and > None. I desire that if x and y are elements of this class, and both > are integers, then arithmetic operations between them, such as x+y, > return the same result as

Re: List Comprehension Question: One to Many Mapping?

2007-09-14 Thread beginner
On Aug 24, 5:35 am, Boris Borcic <[EMAIL PROTECTED]> wrote: > Paul Rubin wrote: > > beginner <[EMAIL PROTECTED]> writes: > >> For example, if I have x=[ [1,2], [3,4] ] > > >> What I want is a new list of list that has four sub-lists: > > >> [[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]] > > > [[a, map(

Re: Python 3K or Python 2.9?

2007-09-14 Thread George Sakkis
On Sep 12, 1:35 pm, TheFlyingDutchman <[EMAIL PROTECTED]> wrote: > On Sep 12, 4:40 am, Bjoern Schliessmann <[EMAIL PROTECTED]> wrote: > > Ivan Voras wrote: > > > What does "self" have to do with an object model? It's an > > > function/method argument that might as well be hidden in the > > > compi

Re: Spaces from string specifier

2007-09-14 Thread Ian Clark
Gabriel Genellina wrote: > En Fri, 14 Sep 2007 01:57:43 -0300, Gavin Tomlins <[EMAIL PROTECTED]> > escribi�: > >> I'm trying to work out when using a format specifier I get spaces in the >> resulting string. Eg. Looking at the outputted string you can see that >> there are spaces after T5LAT,

Re: subclass of integers

2007-09-14 Thread Ian Clark
Ian Clark wrote: > Mark Morss wrote: >> I would like to construct a class that includes both the integers and >> None. I desire that if x and y are elements of this class, and both >> are integers, then arithmetic operations between them, such as x+y, >> return the same result as integer addition.

reading xls file from python

2007-09-14 Thread hassen62
hi friends, I have installed python 2.5 for windows in my pc, I have a file xls say "file.xls" in c:/python25. How I can read this files from Python. Many thanks in advance. Hassen.-- http://mail.python.org/mailman/listinfo/python-list

Re: recursion

2007-09-14 Thread John Machin
On Sep 15, 3:06 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > > There have been languages, for instance, Fortran IV, where local variables > were part of the function 'object' and which therefore prohibited recursion > because of the very problem you alluded to in your question. (My guess is > th

Re: Python 3K or Python 2.9?

2007-09-14 Thread John Roth
On Sep 12, 11:35 am, TheFlyingDutchman <[EMAIL PROTECTED]> wrote: > On Sep 12, 4:40 am, Bjoern Schliessmann <[EMAIL PROTECTED]> wrote: > > Ivan Voras wrote: > > > What does "self" have to do with an object model? It's an > > > function/method argument that might as well be hidden in the > > > compi

Re: where is help file?

2007-09-14 Thread PaulS
Thanks everyone. Paul "Neil Cerutti" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 2007-09-14, Carsten Haese <[EMAIL PROTECTED]> wrote: >> On Fri, 2007-09-14 at 18:20 +0200, Martin Blume wrote: >>> AFAIK you have to import the module first, before you can get >>> help on that

Re: Just bought Python in a Nutshell

2007-09-14 Thread Danyelle Gragsone
Luckily that site still had one left .. so i brought it :D. I can always use another good and CHEAP book. Danyelle -- http://mail.python.org/mailman/listinfo/python-list

Re: why does Configparser change names to lowercase ?

2007-09-14 Thread Rob Wolfe
stef mientki <[EMAIL PROTECTED]> writes: > hello, > > Why does Configparser change names to lowercase ? > > As Python is case sensitive (which btw I don't like at all ;-) > but now when really need the casesensitivity, > because it handles about names which should be recognized by human, > it cha

Re: 2 daemons write to a single file /w python file IO

2007-09-14 Thread Steven W. Orr
On Tuesday, Sep 11th 2007 at 21:17 -0700, quoth Andrey: =>i have a newbie question about the file() function. =>I have 2 daemons running on my linux box. => =>1 will record the IDs to a file - logs.txt =>other 1 will open this file, read the IDs, and then "Clean up the =>file" -logs.txt => =>Sin

regexp search on infinite string?

2007-09-14 Thread Paddy
Lets say i have a generator running that generates successive characters of a 'string' >From what I know, if I want to do a regexp search for a pattern of characters then I would have to 'freeze' the generator and pass the characters so far to re.search. It is expensive to create successive charac

Re: subclass of integers

2007-09-14 Thread Ian Clark
Mark Morss wrote: > I would like to construct a class that includes both the integers and > None. I desire that if x and y are elements of this class, and both > are integers, then arithmetic operations between them, such as x+y, > return the same result as integer addition. However if either x o

Make money to share your videos

2007-09-14 Thread earnloads007
Goodtolove.com is sharing their 50% adsense revenue with you to post videos of anything. Just keep up logging in and start posting now to make money... -- http://mail.python.org/mailman/listinfo/python-list

Re: why does Configparser change names to lowercase ?

2007-09-14 Thread James Stroud
stef mientki wrote: > hello, > > Why does Configparser change names to lowercase ? Because it is an annoying module and should be tossed for something better? Try this instead (and never look back): http://www.voidspace.org.uk/python/configobj.html > As Python is case sensitive (which btw

Re: An ordered dictionary for the Python library?

2007-09-14 Thread James Stroud
Mark Summerfield wrote: > I guess I'll have to rename my module (although unfortunately, my book > has just gone into production and I have a (simpler) example of what I > considered to be an ordered dict, so I will be adding to the > terminology confusion). That notwithstanding, given that it is a

why does Configparser change names to lowercase ?

2007-09-14 Thread stef mientki
hello, Why does Configparser change names to lowercase ? As Python is case sensitive (which btw I don't like at all ;-) but now when really need the casesensitivity, because it handles about names which should be recognized by human, it changes everything to lowercase thanks, Stef Mientki

Re: Just bought Python in a Nutshell

2007-09-14 Thread Lamonte Harris
Right, I like reading books it comes handier then reading ebooks, less programs and its right there in your hands. Main reason I'm going to use it for is to find questions without asking them on the python list or tutor list for a quicker referrence. On 9/14/07, [EMAIL PROTECTED] <[EMAIL PROTECT

Re: An ordered dictionary for the Python library?

2007-09-14 Thread Mark Summerfield
On 14 Sep, 20:25, James Stroud <[EMAIL PROTECTED]> wrote: > Mark Summerfield wrote: [snip] > May I also make one more suggestion, to call it a "sort_ordered_dict" > (or "sortordereddict", or even better a "sorteddict"--where the "ed" > comes from "ordered")? Its hard for me to move past the establi

Re: Https conversation - debug?

2007-09-14 Thread Jarek Zgoda
Johny napisał(a): > Is there any good sniffer for https protocol? > How can be watched https conversation? Any packet sniffer will do. Then you have to decrypt the stream. ;) -- Jarek Zgoda http://jpa.berlios.de/ -- http://mail.python.org/mailman/listinfo/python-list

Re: How to Start

2007-09-14 Thread James Stroud
Paul McGuire wrote: > Do "neophytes" just dive in and try stuff? I think a lot of us coming from other fields actually slithered in, in true python style. -- http://mail.python.org/mailman/listinfo/python-list

Https conversation - debug?

2007-09-14 Thread Johny
Is there any good sniffer for https protocol? How can be watched https conversation? Thanks for reply L. -- http://mail.python.org/mailman/listinfo/python-list

Re: Rename multiple files using names in a text file

2007-09-14 Thread James Stroud
rémi wrote: > Hi, > > I would like to rename files (jpg's ones) using a text file containing the > new names... > Below is the code that doesn't work : > * > #!/usr/bin/python > #-*- coding: utf-8 -*- > from os import listdir, getcwd, rename > import re > list_names=['new_name1','new_name2'] >

Re: An ordered dictionary for the Python library?

2007-09-14 Thread James Stroud
Mark Summerfield wrote: > So to clarify, here's the entire API I'm proposing for ordereddict. In > all cases the ordereddict is always in (and kept in) key order, and > any method that returns a list or iterator always returns that list or > iterator (whether of keys or values) in key order: > > o

Re: subclass of integers

2007-09-14 Thread Bruno Desthuilliers
Mark Morss a écrit : > I would like to construct a class that includes both the integers and > None. I desire that if x and y are elements of this class, and both > are integers, then arithmetic operations between them, such as x+y, > return the same result as integer addition. However if either

Rename multiple files using names in a text file

2007-09-14 Thread rémi
Hi, I would like to rename files (jpg's ones) using a text file containing the new names... Below is the code that doesn't work : * #!/usr/bin/python #-*- coding: utf-8 -*- from os import listdir, getcwd, rename import re list_names=['new_name1','new_name2'] list_files = listdir(getcwd()) filt

Re: subclass of integers

2007-09-14 Thread Bruno Desthuilliers
Zentrader a écrit : > This would accept ints, floats, and decimal types. It doesn't... > import decimal Useless > class Nint(int): > def __add__(self, x, y): The prototype for __add__ is __add__(self, other) > try: > return x+y > except: > return No

Re: subclass of integers

2007-09-14 Thread Michael Spencer
Mark Morss wrote: > I would like to construct a class that includes both the integers and > None. I desire that if x and y are elements of this class, and both > are integers, then arithmetic operations between them, such as x+y, > return the same result as integer addition. However if either x o

Re: Coming from Perl - SOLVED

2007-09-14 Thread I V
On Thu, 13 Sep 2007 23:49:32 -0400, Amer Neely wrote: > In trying to track down why this script would not run on my host, it has > to come to light that Python is installed, however the Apache module is > not. So, short story is - I was flogging a dead horse. Which Apache module? You don't need an

Re: recursion

2007-09-14 Thread Terry Reedy
"Marc 'BlackJack' Rintsch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |f([1, 2, 3]) | r1 f([2, 3]) + [1] | r2 f([3]) + [2] + [1] | r3 f([]) + [3] + [2] + [1] | r4 [] + [3] + [2] + [1] I might help to note that the above is effectively parenthesized ( ( ([]+{3]) + [2]) +

Re: where is help file?

2007-09-14 Thread Neil Cerutti
On 2007-09-14, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Fri, 2007-09-14 at 18:20 +0200, Martin Blume wrote: >> AFAIK you have to import the module first, before you can get >> help on that module. > > While that is true of the help(module_name) form, this is not > necessary in the interactive

Re: where is help file?

2007-09-14 Thread Carsten Haese
On Fri, 2007-09-14 at 18:20 +0200, Martin Blume wrote: > AFAIK you have to import the module first, before you can get help > on that module. While that is true of the help(module_name) form, this is not necessary in the interactive helper you start by calling help(). -- Carsten Haese http://inf

Re: An ordered dictionary for the Python library?

2007-09-14 Thread Mark Summerfield
On 14 Sep, 15:35, Antoon Pardon <[EMAIL PROTECTED]> wrote: [snip] > I wish you all the luck you can get. Maybe if you succeed I'll change > my mind about writing a PEP myself. > > However I think your chances will increase if you write your module > and have it available in the cheese shop. If peop

Re: Python 3K or Python 2.9?

2007-09-14 Thread Terry Reedy
"Bjoern Schliessmann" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] That's interesting. BTW, do you know something (apart from the dis docs) that's worth reading if you're interested in Python byte code? -- That is the only Python specific thing I remember reading.

Re: where is help file?

2007-09-14 Thread Martin Blume
"Carsten Haese" schrieb > > new to Fedora7, typed python in interactive interpreter, then help(). > > Then modules to get a list of modules. Then module name to get info > > on a module but no help file. What is the help file name? > > Is there an environmental variable I have to set? > > There i

Re: How to Start

2007-09-14 Thread DouhetSukd
On Sep 13, 4:02 pm, Nikita the Spider <[EMAIL PROTECTED]> wrote: > My $.02 for someone such as yourself > is to deal with Python and as little else as possible. So write your > code in a simple text editor like UltraEdit or Notepad Second that opinion. Use _your_ favorite basic text editor and ru

Re: Just bought Python in a Nutshell

2007-09-14 Thread DouhetSukd
I respectfully disagree with Shawn, in this case. Don't skim Nutshell, unless you know very little Python, and even then it is really the wrong book. It is rather dry reading and provides very little of the usual user-friendly introductions to language features by solving simple problems. Doesn'

Re: "once" assigment in Python

2007-09-14 Thread Alex Martelli
Lorenzo Di Gregorio <[EMAIL PROTECTED]> wrote: > When employing Python it's pretty straightforward to translate the > instance to an object. > > instance = Component(input=wire1,output=wire2) > > Then you don't use "instance" *almost* anymore: it's an object which > gets registered with the simu

Re: newbee: Simple Backend Python Script Question

2007-09-14 Thread Steve Holden
joe shoemaker wrote: > I need to create python script that is threaded. So the main program > will run in infinite loop and just retrieving messages and putting them > in a queue. (Main thread) > > I need child threads from a pool to process the queue. When there is no > stuff in the queue, the

Re: automatic parallelization

2007-09-14 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Mikhail Teterin <[EMAIL PROTECTED]> wrote: . . . >> I'm fond of Linda > http://www.unixreview.com/documents/s=10125/ur0704l/ >, Parallel >> Python http://www.parallelpython.com/ > only one of s

Re: subclass of integers

2007-09-14 Thread Zentrader
This would accept ints, floats, and decimal types. import decimal class Nint(int): def __add__(self, x, y): try: return x+y except: return None if __name__=='__main__': N=Nint() print N.__add__( 1, 2 ) print N.__add__( 1, None ) print N

Re: recursion

2007-09-14 Thread Steve Holden
Gigs_ wrote: > Steve Holden wrote: [...] >> >> regards >> Steve > >>> def factorial(n): > print "n =", n > if n==0: > return 1 > else: > return n * factorial(n-1) > > >>> factorial(3) > n = 3 > n = 2 > n = 1 > n = 0 > 6 > > > now i understand. but one question at t

Re: subclass of integers

2007-09-14 Thread Zentrader
I would do something along the lines of the following, although it only tests for integers and not floats, so would return 'None' for a float. class Nint(int): def __add__(self, x, y): if isinstance(x, int) and isinstance(y, int): return x+y return None if __name__

RE: How to Start

2007-09-14 Thread Sells, Fred
I like eclipse+pydev; although I did pay my dues learning the basics of eclipse. F9 saves file and runs it. If you're an emacs dude, emacs + python mode is pretty good. ctrl-c ctrl-c runs the active buffer. Of course if you don't already know emacs, avoid it like the plague. > -Original Mes

Re: An ordered dictionary for the Python library?

2007-09-14 Thread Antoon Pardon
On 2007-09-14, Mark Summerfield <[EMAIL PROTECTED]> wrote: >> > Also, it does not provide the key(), value(), and item() methods that >> > the API I proposed can support (because in an ordereddict, index >> > positions make sense). >> >> At the time I wrote my module I never had a need for these. D

Re: recursion

2007-09-14 Thread Marc 'BlackJack' Rintsch
On Fri, 14 Sep 2007 15:58:39 +0200, Gigs_ wrote: > >>> def factorial(n): > print "n =", n > if n==0: > return 1 > else: > return n * factorial(n-1) > > >>> factorial(3) > n = 3 > n = 2 > n = 1 > n = 0 > 6 > > > now i understand. but one question at the end this fun

Re: subclass of integers

2007-09-14 Thread Mark Morss
On Sep 14, 10:30 am, Mark Morss <[EMAIL PROTECTED]> wrote: > I would like to construct a class that includes both the integers and > None. I desire that if x and y are elements of this class, and both > are integers, then arithmetic operations between them, such as x+y, > return the same result as

subclass of integers

2007-09-14 Thread Mark Morss
I would like to construct a class that includes both the integers and None. I desire that if x and y are elements of this class, and both are integers, then arithmetic operations between them, such as x+y, return the same result as integer addition. However if either x or y is None, these operati

newbee: Simple Backend Python Script Question

2007-09-14 Thread joe shoemaker
I need to create python script that is threaded. So the main program will run in infinite loop and just retrieving messages and putting them in a queue. (Main thread) I need child threads from a pool to process the queue. When there is no stuff in the queue, they go to the pool and become availabl

Re: Install Mac OS X - Idle doesn't show up

2007-09-14 Thread Dominique
Kevin Walzer codebykevin.com> writes: > > > > How did you install/build Python? On the Mac, you really aren't supposed > to start it from the terminal unless you are running it under X11 or are > using a non-framework build. If you built it the standard Mac way, or if > you use the binary in

Re: recursion

2007-09-14 Thread Neil Cerutti
On 2007-09-14, John Machin <[EMAIL PROTECTED]> wrote: > On Sep 14, 10:04 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> On Fri, 14 Sep 2007 13:40:17 +0200, Gigs_ wrote: >> > sorry i think that i express wrong. having problem with english >> >> > what i mean is how python knows to add al

Re: where is help file?

2007-09-14 Thread Carsten Haese
On Fri, 2007-09-14 at 10:00 -0400, PaulS wrote: > new to Fedora7, typed python in interactive interpreter, then help(). Then > modules to get a list of modules. Then module name to get info on a module > but no help file. What is the help file name? Is there an environmental > variable I hav

Re: recursion

2007-09-14 Thread J. Clifford Dyer
On Fri, Sep 14, 2007 at 01:40:17PM +0200, Gigs_ wrote regarding Re: recursion: > > what i mean is how python knows to add all thing at the end of recursion > > >>> def f(l): > if l == []: > return [] > else: > return f(l[1:]) + l[:1] > The following script does exa

where is help file?

2007-09-14 Thread PaulS
new to Fedora7, typed python in interactive interpreter, then help(). Then modules to get a list of modules. Then module name to get info on a module but no help file. What is the help file name? Is there an environmental variable I have to set? Thanks, Paul -- http://mail.python.org/ma

Re: recursion

2007-09-14 Thread Gigs_
Steve Holden wrote: > Gigs_ wrote: >> sorry i think that i express wrong. having problem with english >> >> >> what i mean is how python knows to add all thing at the end of recursion >> >> >>> def f(l): >> if l == []: >> return [] >> else: >> return f(l[1:]) + l[:1] >>

Re: An ordered dictionary for the Python library?

2007-09-14 Thread Mark Summerfield
On 14 Sep, 12:46, Antoon Pardon <[EMAIL PROTECTED]> wrote: > On 2007-09-14, Mark Summerfield <[EMAIL PROTECTED]> wrote: > > > > > On 14 Sep, 10:49, Antoon Pardon <[EMAIL PROTECTED]> wrote: > >> > # some time later > >> > d["e"] = 15 > >> > # later still > >> > d["b"] = 70 > >> > d.keys() # returns

Re: [Tutor] list iteration question for writing to a file on disk

2007-09-14 Thread Shawn Milochik
When you use "print," it automatically adds a newline (\n). You can avoid this by following the print line with a comma: print j, Or rstrip() the line before printing. Either way. -- http://mail.python.org/mailman/listinfo/python-list

Re: [Tutor] Just bought Python in a Nutshell

2007-09-14 Thread Shawn Milochik
My best advice: Skim it -- just flip the pages, glancing at each one without really reading it -- maybe just read the bold type. You'll find that very rewarding when you run into a problem in your coding and remember that you saw *something* which could be related. You will probably notice some bu

Re: Install Mac OS X - Idle doesn't show up

2007-09-14 Thread Kevin Walzer
Dominique wrote: > Hello, > > Sorry bothering you with such a trivial problem. > > I installed python on a new mac at office. > It seems everything is fine: in the console, I access to python. > But I just can't start Idle. It seems to open but closes immediately (it > appears > in the dock and

Re: How to Start

2007-09-14 Thread Shawn Milochik
On 9/14/07, James Stroud <[EMAIL PROTECTED]> wrote: > > Here's your recipe: > >1. begin coding until you hit a wall >2. read official tutorial until you figure out a solution >3. experiment in interactive interpreter >4. goto 1. > > I know this sounds obvious, but its the best way t

Re: extract text from log file using re

2007-09-14 Thread Paul McGuire
On Sep 13, 4:09 pm, Fabian Braennstroem <[EMAIL PROTECTED]> wrote: > Hi, > > I would like to delete a region on a log file which has this > kind of structure: > How about just searching for what you want. Here are two approaches, one using pyparsing, one using the batteries-included re module. -

Re: recursion

2007-09-14 Thread John Machin
On Sep 14, 10:04 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Fri, 14 Sep 2007 13:40:17 +0200, Gigs_ wrote: > > sorry i think that i express wrong. having problem with english > > > what i mean is how python knows to add all thing at the end of recursion > > Because you have written

Re: recursion

2007-09-14 Thread Steve Holden
Gigs_ wrote: > sorry i think that i express wrong. having problem with english > > > what i mean is how python knows to add all thing at the end of recursion > > >>> def f(l): > if l == []: > return [] > else: > return f(l[1:]) + l[:1] > > > f([1,2,3]) > > recursi

Re: Install Mac OS X - Idle doesn't show up

2007-09-14 Thread Dominique
Dominique gmail.com> writes: > > One precision: When I go in the console and type idle, it works: idle appears. But I would like to be able to launch idle from the dock Dominique -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >