Re: What is different with Python ?

2005-06-12 Thread George Sakkis
"Andrea Griffini" wrote: > I think that if you don't understand memory, > addresses and allocation and deallocation, or > (roughly) how an hard disk works and what's > the difference between hard disks and RAM then > you're going to be a horrible programmer. > > There's no way you will remember wh

Re: Java to Python - how to??

2005-06-13 Thread George Sakkis
[EMAIL PROTECTED] wrote: > Hello > > I just start programing in Python. > I've got a qestion, how translate the example code writen in Java to > Python?? > > > public class ConnectionManager { > > public ConnectionManager() { > super(); > } > public void sendAgent(Agent anAgent, Workplac

Back to the future - python to C++ advice wanted

2005-06-17 Thread George Sakkis
During the last 18 months or so I have indulged in the joy of learning and using python for almost everything, but I may have to go back to C/C++ at work. Suddenly I found myself transliterating (or translating at least) common python idioms and patterns, looking for libraries to replace python's "

Re: OO approach to decision sequence?

2005-06-18 Thread George Sakkis
"Chinook" wrote: > I understand what you are saying. The point I'm messing up my head with > though, is when the entity (tree node in my case or variable record content > deconstructing in the aspect example I noted) is not an instance of a class > already - it is obtained from an external source

Re: Comments appreciated on Erlang inspired Process class.

2007-06-01 Thread George Sakkis
On Jun 1, 2:20 pm, "Brian L. Troutwine" <[EMAIL PROTECTED]> wrote: > >http://wiki.python.org/moin/ParallelProcessing > > Ah, I'd forgotten about that page of the wiki; I hadn't seen it for a few > months. > > > Do you have any opinions about those projects listed on the above page > > that are sim

Re: file reading by record separator (not line by line)

2007-06-02 Thread George Sakkis
On Jun 1, 7:00 am, Steve Howell <[EMAIL PROTECTED]> wrote: > --- Tijs <[EMAIL PROTECTED]> wrote: > > > Yes, or a single one that takes a wide range of > > construction possibilities, > > like strings, lambdas or regexes in various keyword > > parameters. > > > BlockReader(f, start='>') > > BlockRea

Re: Python rocks

2007-06-02 Thread George Sakkis
On Jun 2, 12:31 pm, Steve Howell <[EMAIL PROTECTED]> wrote: > --- Mark Carter <[EMAIL PROTECTED]> wrote: > > > Well, I know I'm preaching to the converted - but > > Python rocks. > > [...] > > A few questions from the choir: > > As a recent newcomer to the language, did you > encounter any traps or

Re: Python rocks

2007-06-03 Thread George Sakkis
On Jun 2, 4:58 pm, [EMAIL PROTECTED] (Aahz) wrote: > In article <[EMAIL PROTECTED]>, > George Sakkis <[EMAIL PROTECTED]> wrote: > > > > >I had probably stumbled on many/most of the common pitfalls usually > >mentioned (e.g.http://www.ferg.or

Dict naming, global vs local imports, etc. [was Re: *Naming Conventions*]

2007-06-03 Thread George Sakkis
On Jun 3, 4:32 pm, Steve Howell <[EMAIL PROTECTED]> wrote: > I also still waste brain cycles on naming > dictionaries. Sometimes I name the dictionary after > the values it stores, sometimes after the keys it > uses, and sometimes after both. I was in the same boat but now I've pretty much settl

Re: Postpone creation of attributes until needed

2007-06-11 Thread George Sakkis
On Jun 11, 8:27 am, Frank Millman <[EMAIL PROTECTED]> wrote: > On Jun 11, 1:56 pm, Steven D'Aprano > > <[EMAIL PROTECTED]> wrote: > > > Unless you have thousands and thousands of instances, __slots__ is almost > > certainly not the answer. __slots__ is an optimization to minimize the > > size of ea

Re: Postpone creation of attributes until needed

2007-06-11 Thread George Sakkis
On Jun 11, 10:37 am, Frank Millman <[EMAIL PROTECTED]> wrote: > On Jun 11, 3:38 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > >The boilerplate code can be minimal too with an appropriate > > decorator, something like: > > > class A(object): > > > d

ANN: papyros 0.1

2007-06-11 Thread George Sakkis
I am pleased to announce the first alpha release of Papyros, a lightweight platform-independent package for parallel processing. Papyros provides a master-slave model: clients can submit jobs to a master object which is monitored by one or more slave objects that do the real work. Two main implemen

Re: Multiline lamba implementation in python.

2007-06-12 Thread George Sakkis
On Jun 12, 10:12 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On 12 Jun., 14:57, Facundo Batista <[EMAIL PROTECTED]> wrote: > > > Remember that the *only* difference between the two functions is that > > one is anonymous, and for other you have to came up with a name (name > > that if is well thou

Re: Multiline lamba implementation in python.

2007-06-12 Thread George Sakkis
On Jun 12, 11:36 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On 12 Jun., 16:54, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > On Jun 12, 10:12 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > > On 12 Jun., 14:57, Facundo Batista <[EMAIL P

Re: SimplePrograms challenge

2007-06-12 Thread George Sakkis
On Jun 11, 5:56 pm, Steve Howell <[EMAIL PROTECTED]> wrote: > Hi, I'm offering a challenge to extend the following > page by one good example: > > http://wiki.python.org/moin/SimplePrograms > > Right now the page starts off with 15 examples that > cover lots of ground in Python, but they're still

Re: Windows build of PostgreSQL library for 2.5

2007-06-13 Thread George Sakkis
On Jun 13, 12:57 pm, Ben Sizer <[EMAIL PROTECTED]> wrote: > On 30 May, 16:20, Ben Sizer <[EMAIL PROTECTED]> wrote: > > > On 30 May, 15:42, Frank Millman <[EMAIL PROTECTED]> wrote: > > > > On May 30, 4:15 pm,BenSizer<[EMAIL PROTECTED]> wrote: > > > > > I've been looking for a Windows version of a li

Re: Moving items from list to list

2007-06-14 Thread George Sakkis
On Jun 14, 12:30 pm, HMS Surprise <[EMAIL PROTECTED]> wrote: > Just wondered if there was some python idiom for moving a few items > from one list to another. I often need to delete 2 or 3 items from one > list and put them in another. Delete doesn't seem to have a return > value. I don't care whi

Alternative logging packages

2007-06-17 Thread George Sakkis
I've been growing increasingly weary of the javaesque awkwardness* of the standard library logging package at the point of being willing to give a chance to alternatives. Before I go and try whatever related package there is on PyPI, could anyone that has used them (or is currently using one) comme

Re: The Modernization of Emacs

2007-06-17 Thread George Sakkis
On Jun 17, 6:46 pm, Philipp Leitner <[EMAIL PROTECTED]> wrote: > Ever came to your mind that there are people (programmers and others) > who will not use emacs for their day-to-day work simply because they > have tools that suit them better for the work they have to do (Eclipse > for me, as an exa

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-06-20 Thread George Sakkis
On Jun 20, 5:22 pm, Stephen R Laniel <[EMAIL PROTECTED]> wrote: > Perhaps it would help for me to explain what I'd like. > > Under both Perl and Python, I've found myself > having/wanting to write things like so: > > def my_func( int_arg, str_arg ): > try: > int_arg = int( int_arg ) >

Inferring initial locals()

2007-06-21 Thread George Sakkis
I wonder if there is a (preferably not too-hackish) solution to the following introspection problem: given a callable and a number of positional and/or keyword arguments, infer what would be the frame's locals() right after the function is called. For example, given: def f(x, y=1, *a, **k): z

Re: Inferring initial locals()

2007-06-21 Thread George Sakkis
On Jun 21, 4:42 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Jun 21, 8:51 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > I wonder if there is a (preferably not too-hackish) solution to the > > following introspection problem: given

Re: Inferring initial locals()

2007-06-24 Thread George Sakkis
On Jun 24, 10:52 pm, Scott David Daniels <[EMAIL PROTECTED]> wrote: > So, what should your code do about this: > > def someFunction(a, b, c=43, d=14, f=12): > print locals() > > import functools > > a_funct = functools.partial(someFunction, d=13, c=5) > b_funct = functools.partial(a_funct, 14

try/finally in threads

2007-07-02 Thread George Sakkis
I posted this on the Pyro list but I'm not sure if it's related specifically to Pyro. The "finally" clause below is not executed when f() runs on on a (daemon) thread and the program exits. DAEMON here is a global Pyro.code.Daemon instance. def f(): try: DAEMON.requestLoop() finally:

Re: try/finally in threads

2007-07-03 Thread George Sakkis
On Jul 3, 5:05 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > I posted this on the Pyro list but I'm not sure if it's related > > specifically to Pyro. The "finally" clause below is not executed when > > f() r

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-05 Thread George Sakkis
On Jul 5, 3:24 pm, Donn Cave <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Paul Boddie <[EMAIL PROTECTED]> wrote: > > > However, it's interesting to consider the work that sometimes needs to > > go in to specify data structures in some languages - thinking of ML > > and friends, a

Re: Function parameter type safety?

2007-07-13 Thread George Sakkis
On Jul 12, 5:52 pm, Robert Dailey <[EMAIL PROTECTED]> wrote: > Hi, > > Is there a way to force a specific parameter in a function to be a > specific type? Yes; have a look at typecheck (http://oakwinter.com/code/typecheck/) and FormEncode (http://formencode.org/Validator.html). George -- http:

Re: Implementaion of random.shuffle

2007-07-18 Thread George Sakkis
On Jul 16, 10:51 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Mon, 16 Jul 2007 16:55:53 +0200, Hrvoje Niksic wrote: > > 2**19937 being a really huge number, it's impossible to exhaust the > > Mersenne twister by running it in sequence. > > "Impossible"? > > Surely this will do it: > > for n

Re: merge two ranges

2007-07-18 Thread George Sakkis
On Jul 17, 1:29 pm, anoweb <[EMAIL PROTECTED]> wrote: > I have two ranges of numbers and I need to determine if they overlap > or adjacent and if so return a new range containing the values. The > values are low and high for each pair, such that the first value of > the tuple is always less than o

Re: Break up list into groups

2007-07-18 Thread George Sakkis
On Jul 17, 1:48 pm, Matimus <[EMAIL PROTECTED]> wrote: > I did some more experimenting and came up with the code below. It > shows several methods. When run, the script tests the robustness of > each method (roughly), and profiles it using timeit. The results from > running on my laptop are shown b

Re: Posted messages not appearing in this group

2007-07-19 Thread George Sakkis
On Jul 18, 6:50 am, Alex Popescu <[EMAIL PROTECTED]> wrote: > Sanjay gmail.com> writes: > > > > > Hi All, > > > I tried posting in this group twice since last week, but the messages > > did not appear in the forum. Don't know why. Trying this message > > again... > > > Sanjay > > Something similar

Re: class C: vs class C(object):

2007-07-20 Thread George Sakkis
On Jul 20, 5:40 am, Bruno Desthuilliers wrote: > Aahz a écrit : > > > In article <[EMAIL PROTECTED]>, > > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > >> To make a long story short: Python 2.2 introduced a new object model > >> which is more coherent and more powerful than the original one. T

Re: Handy short cut for formatting elapsed time in floating point seconds

2007-04-21 Thread George Sakkis
On Apr 21, 9:09 pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > I am doing some simple timing of some elements of Python scripts, and > the simplest is to just call time.time() before and after key elements > of the script: > > t1 = time.time() > > # do lengthy operation > > t2 = time.time() > print

Re: Namespaces/introspection: collecting sql strings for validation

2007-04-22 Thread George Sakkis
On Apr 21, 4:16 pm, Martin Drautzburg <[EMAIL PROTECTED]> wrote: > I would like to validate sql strings, which are spread all over the > code, i.e. I run ("prepare") them against a database to see if it happy > with the statements. Spelling errors in sql have been a major pain for > me. > > The sta

Subprocess with and without shell

2007-05-14 Thread George Sakkis
I'm trying to figure out why Popen captures the stderr of a specific command when it runs through the shell but not without it. IOW: cmd = [my_exe, arg1, arg2, ..., argN] if 1: # this captures both stdout and stderr as expected pipe = Popen(' '.join(cmd), shell=True, stderr=PIPE, stdout=PIPE)

Re: Subprocess with and without shell

2007-05-15 Thread George Sakkis
On May 15, 5:30 am, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > George Sakkis <[EMAIL PROTECTED]> wrote: > > I'm trying to figure out why Popen captures the stderr of a specific > > command when it runs through the shell but not without it. IOW: > > &

Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-15 Thread George Sakkis
After 175 replies (and counting), the only thing that is clear is the controversy around this PEP. Most people are very strong for or against it, with little middle ground in between. I'm not saying that every change must meet 100% acceptance, but here there is definitely a strong opposition to it.

Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-16 Thread George Sakkis
On May 13, 11:44 am, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > (snipped) > > So, please provide feedback, e.g. perhaps by answering these > questions: > - should non-ASCII identifiers be supported? why? Initially I was on -1 but from this thread it seems that many closed (or semi-closed) env

Re: converting strings to most their efficient types '1' --> 1, 'A' ---> 'A', '1.2'---> 1.2

2007-05-20 Thread George Sakkis
On May 18, 7:07 pm, py_genetic <[EMAIL PROTECTED]> wrote: > Hello, > > I'm importing large text files of data using csv. I would like to add > some more auto sensing abilities. I'm considing sampling the data > file and doing some fuzzy logic scoring on the attributes (colls in a > data base/ cs

Re: Python assignment loop

2007-05-20 Thread George Sakkis
On May 20, 10:33 pm, "Silver Rock" <[EMAIL PROTECTED]> wrote: > i need to do something like this: > > ### > import wx > x=number > for i in range(500): >"var"+str(i)=ClassXYZ(...,x+i,...) > > # code > y=number > for i in range(y): >Class(object_called_by_the_string("var"+str(i)),...

Parallel/distributed generator

2007-05-23 Thread George Sakkis
I'm looking for any existing packages or ideas on how to implement the equivalent of a generator (in the Python sense, i.e. http://www.python.org/dev/peps/pep-0255/) in a parallel/distributed way. As a use case, imagine a function that generates a range of primes. I'd like to be able to do somethin

Re: Parallel/distributed generator

2007-05-23 Thread George Sakkis
On May 23, 2:11 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > I'm looking for any existing packages or ideas on how to implement the > > equivalent of a generator (in the Python sense, i.e. > >http://www.python.org/dev

Re: Parallel/distributed generator

2007-05-23 Thread George Sakkis
On May 23, 2:11 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > I'm looking for any existing packages or ideas on how to implement the > > equivalent of a generator (in the Python sense, i.e. > >http://www.python.org/dev

Re: Parallel/distributed generator

2007-05-23 Thread George Sakkis
On May 23, 3:35 pm, [EMAIL PROTECTED] wrote: > On May 23, 11:00 am, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > I'm looking for any existing packages or ideas on how to implement the > > equivalent of a generator (in the Python sense, > > i.e.http:

Re: Parallel/distributed generator

2007-05-23 Thread George Sakkis
On May 23, 3:35 pm, [EMAIL PROTECTED] wrote: > On May 23, 11:00 am, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > I'm looking for any existing packages or ideas on how to implement the > > equivalent of a generator (in the Python sense, > > i.e.http:

Re: Parallel/distributed generator

2007-05-23 Thread George Sakkis
On May 23, 3:35 pm, [EMAIL PROTECTED] wrote: > On May 23, 11:00 am, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > I'm looking for any existing packages or ideas on how to implement the > > equivalent of a generator (in the Python sense, > > i.e.http:

Re: Parallel/distributed generator

2007-05-23 Thread George Sakkis
On May 23, 3:35 pm, [EMAIL PROTECTED] wrote: > On May 23, 11:00 am, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > I'm looking for any existing packages or ideas on how to implement the > > equivalent of a generator (in the Python sense, > > i.e.http:

Re: Parallel/distributed generator

2007-05-23 Thread George Sakkis
On May 23, 4:22 pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > On May 23, 2:58 pm, [EMAIL PROTECTED] wrote: > > > > > On May 23, 11:00 am, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > I'm looking for any existing packages or ideas on how to implem

Re: Properties/Decorators [WAS: Can I reference 1 instance of an object by more names ? rephrase]

2007-05-23 Thread George Sakkis
On May 23, 6:22 pm, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > Diez B. Roggisch wrote: > > It is that very apply. > > > And apply takes a function as argument + additional arguments, and executes > > that function, returning the result of that function-call. It was used > > before the > > >

Re: Newbie: Struggling again 'map'

2007-05-26 Thread George Sakkis
On May 26, 7:47 am, Roel Schroeven <[EMAIL PROTECTED]> wrote: > mosscliffe schreef: > > > for x,y in map("N/A", lista, listb): ## Fails - Can not call a > > 'str' > > print "MAP:", x, "<>", y > > > def fillwith(fillchars): > > return fillchars > > > for x,y in map(fillwith("N/A"), l

Storing tracebacks

2007-05-28 Thread George Sakkis
I'm reading the docs on sys.exc_info() but I can't tell for sure whether I'm using it safely to get a snapshot of an exception and reraise it later. The use case is a class which acts like a deferred callable, a callable that will be called at some point in the future (possibly in a different threa

Re: Storing tracebacks

2007-05-29 Thread George Sakkis
On May 29, 9:46 am, [EMAIL PROTECTED] wrote: > On May 28, 10:46 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > I'm reading the docs on sys.exc_info() but I can't tell for sure > > whether I'm using it safely to get a snapshot of an exceptio

Re: Storing tracebacks

2007-05-29 Thread George Sakkis
On May 29, 1:21 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 29 May 2007 13:51:09 -0300, George Sakkis > <[EMAIL PROTECTED]> escribió: > > > The traceback module is handy if you want a text representation of the > > traceback, not the a

Re: itertools.groupby

2007-05-29 Thread George Sakkis
On May 29, 2:34 am, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > If the posters on this thread have developed an interest > in the subject, I would find it useful to hear their > ideas on new and creative ways to use groupby(). The > analogy to UNIX's uniq filter was found only after the > desi

Re: Rats! vararg assignments don't work

2007-05-29 Thread George Sakkis
On May 29, 11:33 pm, Matimus <[EMAIL PROTECTED]> wrote: > Your attemtp: > > [code] > first, rest = arglist[0], arglist[1:] > [/code] > > Is the most obvious and probably the most accepted way to do what you > are looking for. As for adding the fucntionality you first suggested, > it isn't likely t

Re: Base class for file-like objects? (a.k.a "Stream" in Java)

2007-07-25 Thread George Sakkis
On Jul 24, 6:51 pm, Boris Dušek <[EMAIL PROTECTED]> wrote: > Hello, > > (sorry to begin with Java in a Python list ;-) > in Java, when I want to pass input to a function, I pass > "InputStream", which is a base class of any input stream. > > In Python, I found that "file" objects exist. While spec

Re: is_iterable function.

2007-07-25 Thread George Sakkis
On Jul 25, 3:26 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: > Speaking of the iter builtin function, is there an example of the > use of the optional sentinel object somewhere I could see? # iterate over random numbers from 1 to 10; use 0 as a sentinel to stop the iteration for n in iter(lambda:r

Re: is_iterable function.

2007-07-26 Thread George Sakkis
On Jul 26, 2:56 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-07-26, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > > > > On Thu, 26 Jul 2007 15:02:39 +, Neil Cerutti wrote: > > >> Based on the discussions in this thread (thanks all for your > >> thoughts), I'm settling for: >

Re: Flatten a list/tuple and Call a function with tuples

2007-07-25 Thread George Sakkis
On Jul 25, 12:00 pm, [EMAIL PROTECTED] wrote: > On Jul 25, 10:46 am, beginner <[EMAIL PROTECTED]> wrote: > > > > > On Jul 25, 10:19 am, Stargaming <[EMAIL PROTECTED]> wrote: > > > > On Wed, 25 Jul 2007 14:50:18 +, beginner wrote: > > > > Hi, > > > > > I am wondering how do I 'flatten' a list or

Re: first, second, etc line of text file

2007-07-25 Thread George Sakkis
On Jul 25, 3:44 pm, "Daniel Nogradi" <[EMAIL PROTECTED]> wrote: > A very simple question: I currently use a cumbersome-looking way of > getting the first, second, etc. line of a text file: > > for i, line in enumerate( open( textfile ) ): > if i == 0: > print 'First line is: ' + line >

Re: Important Research Project

2007-09-01 Thread George Sakkis
On Sep 1, 7:13 am, "E.D.G." <[EMAIL PROTECTED]> wrote: > "E.D.G." <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > Important Research Project (Related to computer programming) > > > Posted by E.D.G. on August 30, 2007 [EMAIL PROTECTED] > > This effort was not successful.

Re: Python is overtaking Perl

2007-09-04 Thread George Sakkis
On Sep 4, 8:35 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Tue, 04 Sep 2007 00:32:23 -, Ben <[EMAIL PROTECTED]> wrote: > >Here are the statistics from Google Trends: > > >http://benyang22a.blogspot.com/2007/09/perl-vs-python.html > > >From the graph, it seems more accurate to say th

Re: Passing a tuple to a function as multiple arguments

2007-09-06 Thread George Sakkis
On Sep 6, 11:02 pm, Ben Warren <[EMAIL PROTECTED]> wrote: > Hello, > > Let's say I have a function with a variable number of arguments (please > ignore syntax errors): > > def myfunc(a,b,c,d,...): > > and I have a tuple whose contents I want to pass to the function. The number > of elements in t

Re: Text processing and file creation

2007-09-06 Thread George Sakkis
On Sep 5, 5:17 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Sep 5, 1:28 pm, Paddy <[EMAIL PROTECTED]> wrote: > > > On Sep 5, 5:13 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > wrote: > > > > I have a text source file of about 20.000 lines.>From this file, I like > > > to write the fir

Re: Speed of Python

2007-09-07 Thread George Sakkis
On Sep 7, 12:42 pm, "wang frank" <[EMAIL PROTECTED]> wrote: > Is my conclusion correct that Python is slower than matlab? Are there any > way to speed it up? Yes, use Numpy for any non trivial number-crunching task: http://numpy.scipy.org/. Even if you don't, you can speed up the original functi

Re: Descriptor/Decorator challenge

2007-03-05 Thread George Sakkis
On Mar 5, 2:31 am, "Raymond Hettinger" <[EMAIL PROTECTED]> wrote: > I had an idea but no time to think it through. > Perhaps the under-under name mangling trick > can be replaced (in Py3.0) with a suitably designed decorator. > Your challenge is to write the decorator. > Any trick in the book (met

Debugging segmentation faults

2007-03-07 Thread George Sakkis
I have a pure python program (no C extensions) that occasionally core dumps in a non-reproducible way. The program is started by a (non- python) cgi script when a form is submitted. It involves running a bunch of other programs through subprocess in multiple threads and writing its output in severa

Re: Bug in python!? persistent value of an optional parameter in function!

2007-03-07 Thread George Sakkis
On Mar 7, 10:14 pm, John Nagle <[EMAIL PROTECTED]> wrote: > Paul Rubin wrote: > > "C Barr Leigh" <[EMAIL PROTECTED]> writes: > > >>Help! Have I found a serious bug? > >>This seems like highly undesired behaviour to me. From the program > >>below, I get output: > > > It is intentional, not a bug, se

Re: Bug in python!? persistent value of an optional parameter in function!

2007-03-07 Thread George Sakkis
On Mar 7, 10:24 pm, Paul Rubin wrote: > John Nagle <[EMAIL PROTECTED]> writes: > > True. It would make sense to disallow mutable values as > > initial values for optional arguments. The present behavior is silly. > > That would be the worst of both worlds. The main

Re: Debugging segmentation faults

2007-03-07 Thread George Sakkis
On Mar 7, 4:15 pm, John Nagle <[EMAIL PROTECTED]> wrote: > You're using Python on a web server to do something > complicated. You must suffer. > > Are you trying to fork off a subprocess in a multithreaded > program? That's unlikely to work. The sematics differ > from OS to OS (Solaris

Automagically log changes in table

2007-03-17 Thread George Sakkis
This is more in the context of Turbogears/SQLAlchemy, but if anyone has implemented something similar with other packages it might be useful to know. I'd like to have a way to make a table "loggable", meaning it would get, say, two fields "last_modified" and "modified_by", and every write operatio

Re: Automagically log changes in table

2007-03-17 Thread George Sakkis
On Mar 17, 7:59 pm, "aspineux" <[EMAIL PROTECTED]> wrote: > Hi > > You can get this using "triggers" and "stored procedures". > These are SQL engine dependent! This is available for long time with > postgress and only from version 5 with mysql. > This let you write SQL code (Procedure) that will b

Re: list comprehension help

2007-03-18 Thread George Sakkis
On Mar 18, 1:40 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > On 3/18/07, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > > In <[EMAIL PROTECTED]>, Daniel Nogradi > > > wrote: > > > > >> f = open('file.txt','r') > > > >> for line in f: > > >

Re: list comprehension help

2007-03-18 Thread George Sakkis
On Mar 18, 12:11 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi > I need to process a really huge text file (4GB) and this is what i > need to do. It takes for ever to complete this. I read some where that > "list comprehension" can fast up things. Can you point out how to do > it in this

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: simple regular expression problem

2007-09-17 Thread George Sakkis
On Sep 17, 9:00 am, duikboot <[EMAIL PROTECTED]> wrote: > Hello, > > I am trying to extract a list of strings from a text. I am looking it > for hours now, googling didn't help either. > Could you please help me? > > >>>s = """ > >>>\n\n28996\n\n\n28997\n""" > >>> regex = re.compile(r'', re.S) >

Re: Extracting xml from html

2007-09-18 Thread George Sakkis
On Sep 18, 3:31 pm, [EMAIL PROTECTED] wrote: > On Sep 17, 4:51 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: > > > > > En Mon, 17 Sep 2007 17:31:19 -0300, <[EMAIL PROTECTED]> escribi?: > > > > I am attempting to extract some XML from an HTML document that I get > > > returned from a form bas

Re: I could use some help making this Python code run faster using only Python code.

2007-09-20 Thread George Sakkis
On Sep 20, 7:13 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Sep 20, 5:46 pm, Paul Hankin <[EMAIL PROTECTED]> wrote: > > > > > On Sep 20, 10:59 pm, Python Maniac <[EMAIL PROTECTED]> wrote: > > > > I am new to Python however I would like some feedback from those who > > > know more about

Re: I could use some help making this Python code run faster using only Python code.

2007-09-21 Thread George Sakkis
On Sep 21, 1:00 pm, Python Maniac <[EMAIL PROTECTED]> wrote: > My best runtime with Ruby using the same machine and OS was 67.797 > secs which is 29.8x slower than the fastest Python runtime. This > makes Ruby almost as slow as Python was made faster. The irony with > Ruby was that the use of a

Re: Getting rid of bitwise operators in Python 3?

2007-09-22 Thread George Sakkis
On Sep 22, 3:29 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Sat, 22 Sep 2007 14:50:12 +, Paddy wrote: > > Sorry Carl, > > I think *you* may not have much need for bitwise operators but others, > > including myself do. No matter what the usage found, I would think > > replacing bitwise operat

Re: Factory function with keyword arguments

2007-09-22 Thread George Sakkis
On Sep 22, 10:53 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > I'm writing a factory function that needs to use keywords in the produced > function, not the factory. Here's a toy example: > > def factory(flag): > def foo(obj, arg): > if flag: > # use th

Re: ValueError: too many values to unpack

2007-09-27 Thread George Sakkis
On Sep 27, 12:46 pm, Shawn Minisall <[EMAIL PROTECTED]> wrote: > I am trying to read a few lines of a file with multiple values, the rest > are single and are reading in fine. > > With the multiple value lines, python says this "ValueError: too many > values to unpack" > > I've googled it and it sa

Re: Python 3.0 migration plans?

2007-09-28 Thread George Sakkis
On Sep 28, 3:29 pm, TheFlyingDutchman <[EMAIL PROTECTED]> wrote: > One issue I have with this group and that I encountered many years ago > in the Perl group is that there is no separate group > comp.lang.python.beginner where you can ask questions without getting > hit with RTFM! and the like. W

Re: Python 3.0 migration plans?

2007-09-28 Thread George Sakkis
On Sep 28, 11:53 am, John Nagle <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > John Nagle <[EMAIL PROTECTED]> wrote: > > >> TheFlyingDutchman wrote: > >>> It seems that Python 3 is more significant for what it removes than > >>> what it adds. > > >>> What are the additions that people find

Re: question about for cycle

2007-09-29 Thread George Sakkis
On Sep 29, 10:34 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > > On 29 sep, 12:04, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > >> for i in generator_a: # the first "for" cycle > >> for j in generator_b: > >> if something_happen: > >>

Re: Program inefficiency?

2007-09-29 Thread George Sakkis
On Sep 29, 2:32 pm, [EMAIL PROTECTED] wrote: > It think he's saying it should look like this: > > (line noise snipped) Or you can let BeautifulSoup do the dirty job for you and forget all this ugliness: from BeautifulSoup import BeautifulSoup soup = BeautifulSoup(text) for a in soup.findAll('a

Re: Can you please give me some advice?

2007-09-30 Thread George Sakkis
On Sep 30, 6:22 am, Byung-Hee HWANG <[EMAIL PROTECTED]> wrote: > Hi there, > > What is different between Ruby and Python? I am wondering what language > is really mine for work. Somebody tell me Ruby is clean or Python is > really easy! Anyway I will really make decision today what I have to > stud

Re: Can you please give me some advice?

2007-09-30 Thread George Sakkis
On Sep 30, 2:54 pm, Ricardo Aráoz <[EMAIL PROTECTED]> wrote: > > Errhhh. guys.. I think .kr means Korea so he would speak > Korean, not Chinese In this case, http://kr.diveintopython.org/html/index.htm might be more useful ;-) George -- http://mail.python.org/mailman/listinfo/python

Re: Using fractions instead of floats

2007-09-30 Thread George Sakkis
On Sep 30, 9:35 pm, andresj <[EMAIL PROTECTED]> wrote: > I was doing some programming in Python, and the idea came to my mind: using > fractions instead of floats when doing 2/5. > (...) > I would like to get some feedback on this idea. Has this been posted > before? If so, was it rejected? and fo

Re: Combine two dictionary...

2007-10-02 Thread George Sakkis
On Oct 1, 2:01 pm, Abandoned <[EMAIL PROTECTED]> wrote: > I want to total score.. > For example > > > > dict1={1: 4, 3: 5}... and 2 millions element > > > dict2={3: 3, 8: 6}... and 3 millions element > > result should be dict3={1:4, 3:8, 8:6} Unless you have some prior knowledge about the dicts

Re: spam kontrol

2007-10-03 Thread George Sakkis
On Oct 3, 12:59 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > hii > ý think you know spam page is the most pest for net user. ...closely followed in the second position by incoherent misspelled posts in silly IM-speak. -- http://mail.python.org/mailman/listinfo/python-list

Re: Class design question

2007-10-03 Thread George Sakkis
On Oct 3, 1:04 pm, Adam Lanier <[EMAIL PROTECTED]> wrote: > Relatively new to python development and I have a general question > regarding good class design. > > Say I have a couple of classes: > > Class Foo: > params = [ ] > __init__( self, param ): >

Re: Class design question

2007-10-03 Thread George Sakkis
On Oct 3, 2:27 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Oct 3, 1:04 pm, Adam Lanier <[EMAIL PROTECTED]> wrote: > > > > > Relatively new to python development and I have a general question > > regarding good class design. > > > Say I have

Re: racism kontrol

2007-10-03 Thread George Sakkis
On Oct 3, 6:47 pm, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > Steve Holden wrote: > > Wildemar Wildenburger wrote: > >> (I aplogize for that last remark. I have nothing against turkish > >> people, I just couldn't let the opportunity for a mean joke slip.) > > > Does this mean you are an eq

Re: Problem of Readability of Python

2007-10-07 Thread George Sakkis
On Oct 7, 2:14 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > Licheng Fang wrote: > > Python is supposed to be readable, but after programming in Python for > > a while I find my Python programs can be more obfuscated than their C/C > > ++ counterparts sometimes. Part of the reason is that with >

Re: property question

2007-10-08 Thread George Sakkis
On Oct 9, 1:20 am, "Manu Hack" <[EMAIL PROTECTED]> wrote: > hi all, > > If I have a class A with A.x, A.y, A.z. A.y and A.z are property and > in order to compute the value of them, A.y depends on A.x while A.z > depends on A.y and A.x. If I call A.y, and A.z, the value A.y would > be computed tw

Re: Fwd: NUCULAR fielded text searchable indexing

2007-10-10 Thread George Sakkis
On Oct 10, 11:08 am, [EMAIL PROTECTED] wrote: > Why apologize? If someone doesn't like the name given to a piece of > software by its author(s), screw them. If I find the software useful, > I'll use it. Even if its called 'bouncingBetty'. Or 'BeautifulSoup' for that matter ;-) George -- htt

Re: for loop question

2007-10-10 Thread George Sakkis
On Oct 10, 4:12 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > test = u"Hello World" > > > for cur,next in test: > > print cur,next > > > Ideally, this would output: > > > 'H', 'e' > > 'e', 'l' > > 'l', 'l' > > 'l', 'o' > > etc... > > > Of course, the for loop above isn't valid at all. I am just

Re: Keeping track of subclasses and instances?

2007-10-10 Thread George Sakkis
On Oct 10, 9:19 pm, Karlo Lozovina <[EMAIL PROTECTED]> wrote: > Larry Bates wrote: > > I'm not completely sure I understand the question but here goes. > > Instances of > > classes are classes can be stored in lists or dictionaries. In lists you > > reference them via their index (or iterate over

Re: Declarative properties

2007-10-11 Thread George Sakkis
On Oct 11, 7:48 am, Artur Siekielski <[EMAIL PROTECTED]> wrote: > I know about 'property' function in Python, but it's normal usage > isn't declarative, because I have to code imperatively getters and > setters: > > class Person(object): >def __init__(self, name): > self._name = name >

<    1   2   3   4   5   6   7   8   9   10   >