Re: hanning python

2009-09-10 Thread pdpi
On Sep 9, 7:01 pm, sturlamolden wrote: > On 9 Sep, 16:57, pdpi wrote: > > > Raising this to 1 million, rather than 100, nodes in the window, the > > timing difference between your version and NumPy's is tiny (but numpy > > still edges you out, but just barel

Re: hanning python

2009-09-09 Thread pdpi
On Sep 9, 3:46 pm, pdpi wrote: > On Sep 9, 3:27 am, sturlamolden wrote: > > > On 9 Sep, 00:24, Steven D'Aprano > > > wrote: > > > A decent vendor-supplied implementation will include error checking that > > > you otherwise would need to implement yo

Re: hanning python

2009-09-09 Thread pdpi
On Sep 9, 3:27 am, sturlamolden wrote: > On 9 Sep, 00:24, Steven D'Aprano > > wrote: > > A decent vendor-supplied implementation will include error checking that > > you otherwise would need to implement yourself, so yes. > > Not for code like this: > > > > >>> import numpy as np > >>> n = np.ara

Re: Extracting patterns after matching a regex

2009-09-08 Thread pdpi
On Sep 8, 3:21 pm, nn wrote: > On Sep 8, 9:55 am, "Mart." wrote: > > > > > > > On Sep 8, 2:16 pm, "Andreas Tawn" wrote: > > > > > Hi, > > > > > I need to extract a string after a matching a regular expression. For > > > > example I have the string... > > > > > s = "FTPHOST: e4ftl01u.ecs.nasa.gov

Re: Extracting patterns after matching a regex

2009-09-08 Thread pdpi
On Sep 8, 1:56 pm, Martin wrote: > Hi, > > I need to extract a string after a matching a regular expression. For > example I have the string... > > s = "FTPHOST: e4ftl01u.ecs.nasa.gov" > > and once I match "FTPHOST" I would like to extract > "e4ftl01u.ecs.nasa.gov". I am not sure as to the best ap

Re: hanning python

2009-09-08 Thread pdpi
On Sep 8, 1:55 pm, sturlamolden wrote: > On 8 Sep, 13:36, Pierre wrote: > > > anyone knows what is the python equivalent of the matlab's hanning > > function. > > > Note that in matlab hann and hanning are different. > > If you don't know how to compute a von Hann window, you are not > competent

Re: hanning python

2009-09-08 Thread pdpi
On Sep 8, 12:36 pm, Pierre wrote: > Hello, > > anyone knows what is the python equivalent of the matlab's hanning > function. > > Note that in matlab hann and hanning are different. > > Thanks ! I assume you mean the tapering function mentioned here: http://mathworld.wolfram.com/HanningFunction.h

Re: Convert points to polygon shapefile

2009-07-24 Thread pdpi
On Jul 24, 11:21 am, Luis Pedro Almeida wrote: > Dear all, > > I would like to know how to convert a list of points into a polygon > shapefile (esri). > > Thanks! > > Best regards, > > Luis Pedro Almeida I think you'd be better served by asking this question in a newsgroup dedicated to GIS softwa

Re: Python Equivalent for dd & fold

2009-07-16 Thread pdpi
On Jul 16, 3:12 pm, seldan24 wrote: > On Jul 15, 1:48 pm, Emile van Sebille wrote: > > > > > > > On 7/15/2009 10:23 AM MRAB said... > > > >> On Jul 15, 12:47 pm, Michiel Overtoom wrote: > > >>> seldan24 wrote: > > what can I use as the equivalent for the Unix 'fold' command? > > >>> def fol

Re: missing 'xor' Boolean operator

2009-07-15 Thread pdpi
On Jul 15, 12:37 pm, Christian Heimes wrote: > pdpi wrote: > > On Jul 15, 12:08 am, Christian Heimes wrote: > >> Chris Rebert wrote: > >>> Using the xor bitwise operator is also an option: > >>> bool(x) ^ bool(y) > >> I prefer something like

Re: missing 'xor' Boolean operator

2009-07-15 Thread pdpi
On Jul 15, 12:08 am, Christian Heimes wrote: > Chris Rebert wrote: > > Using the xor bitwise operator is also an option: > > bool(x) ^ bool(y) > > I prefer something like: > >     bool(a) + bool(b) == 1 > > It works even for multiple tests (super xor): > >   if bool(a) + bool(b) + bool(c) + bool(d

Re: one-time factory in python for an experienced java guy

2009-07-14 Thread pdpi
On Jul 14, 3:03 pm, phonky wrote: > Hi > > I have searched all over and haven't found the solution > for my problem yet. I am new to python, and all the time realize I > do program python in java, which is not great. > > Besides being a real-life problem, I want to > solve it as elegant as I can,

Re: Infinite loops and synchronization

2009-07-13 Thread pdpi
On Jul 13, 6:06 am, Vincent Gulinao wrote: > lst = list() > > (lst populated by async twisted deferred callbacks) > > while True: >         if len(lst) == SOME_NUMBER: >                 return lst > > Q1: is this a common OK practice? I'm worried infinite loops hogs memory. > Q2: operating on list

Re: Implementing a cache

2009-07-12 Thread pdpi
On Jul 12, 2:01 pm, s...@pobox.com wrote: >     Nikolaus> I want to implement a caching data structure in Python that >     Nikolaus> allows me to: > >     Nikolaus>  1. Quickly look up objects using a key >     Nikolaus>  2. Keep track of the order in which the objects are accessed >     Nikolaus>

Re: tough-to-explain Python

2009-07-10 Thread pdpi
On Jul 10, 2:11 pm, Steven D'Aprano wrote: > On Fri, 10 Jul 2009 12:54:21 +0200, Hendrik van Rooyen wrote: > > "Steven D'Aprano" wrote: > > >>On Wed, 08 Jul 2009 22:05:57 -0700, Simon Forman wrote: > > persistent idea "out there" that programming is a very accessible > skill, like cooki

Re: Clarity vs. code reuse/generality

2009-07-08 Thread pdpi
On Jul 8, 2:24 am, Paul Rubin <http://phr...@nospam.invalid> wrote: > pdpi writes: > >     while abs(func(guess) - target) > epsilon: > >         guess = (lo + hi) / 2. > >         if sense * func(guess) > sense * target: > >             hi = guess >

Re: Clarity vs. code reuse/generality

2009-07-07 Thread pdpi
On Jul 7, 8:04 pm, Dave Angel wrote: > And of course your clarified function will fail if the func is > monotonically decreasing. yeah, I eventually realized that and corrected it... And the assert()/ cmp() confusion too. I blame lack of sleep. The whole sign/sense thing left a really bad taste

Re: Clarity vs. code reuse/generality

2009-07-07 Thread pdpi
On Jul 7, 7:31 pm, pdpi wrote: > On Jul 7, 7:06 pm, Paul Rubin <http://phr...@nospam.invalid> wrote: > > > pdpi writes: > > > Personally, I think the code is an unreadable mess, but that's mostly > > > because of all the micro optimizations, not the gene

Re: Clarity vs. code reuse/generality

2009-07-07 Thread pdpi
On Jul 7, 7:06 pm, Paul Rubin <http://phr...@nospam.invalid> wrote: > pdpi writes: > > Personally, I think the code is an unreadable mess, but that's mostly > > because of all the micro optimizations, not the generality of it. > > Here's my unoptimize

Re: Clarity vs. code reuse/generality

2009-07-07 Thread pdpi
On Jul 7, 7:26 pm, Andre Engels wrote: > On Tue, Jul 7, 2009 at 8:01 PM, pdpi wrote: > > He asserts: > >    assert lo < hi > > but then compares: > >    sense = cmp(func(hi), func(lo)) > > > sense can't ever be anything other than 1. > > It can

Re: Clarity vs. code reuse/generality

2009-07-07 Thread pdpi
On Jul 7, 2:16 am, Steven D'Aprano wrote: > On Mon, 06 Jul 2009 16:43:43 +0100, Tim Rowe wrote: > > 2009/7/4 kj : > > >> Precisely.  As I've stated elsewhere, this is an internal helper > >> function, to be called only a few times under very well-specified > >> conditions.  The assert statements c

Re: Why re.match()?

2009-07-07 Thread pdpi
On Jul 2, 4:49 am, kj wrote: > In Duncan Booth > writes: > > >So, for example: > re.compile("c").match("abcdef", 2) > ><_sre.SRE_Match object at 0x02C09B90> > re.compile("^c").search("abcdef", 2) > > I find this unconvincing; with re.search alone one could simply > do: > > >>>

Re: A Bug By Any Other Name ...

2009-07-06 Thread pdpi
On Jul 6, 1:12 pm, "Hendrik van Rooyen" wrote: > "Terry Reedy" wrote: > > Gabriel Genellina wrote: > > > > In this case, a note in the documentation warning about the potential > > > confusion would be fine. > > > How would that help someone who does not read the doc? > > It obviously won't. > >

Re: Passing parameters for a C program in Linux.

2009-06-30 Thread pdpi
On Jun 30, 11:46 am, "venutaurus...@gmail.com" wrote: > Hi all, >        I have to write an automted script which will test my c > program. That program when run will ask for the commands. For example: > > local-host# ./cli > Enter 1 for add > Enter 2 for sub > Enter 3 for mul > 1            -

Re: Measuring Fractal Dimension ?

2009-06-30 Thread pdpi
On Jun 29, 3:17 am, greg wrote: > Paul Rubin wrote: > > Steven D'Aprano writes: > > >>But that depends on what you call "things"... if electron shells are real > >>(and they seem to be) and discontinuous, and the shells are predicted/ > >>specified by eigenvalues of some continuous function, is t

Re: 3.2*2 is 9.6 ... or maybe it isn't?

2009-06-26 Thread pdpi
On Jun 26, 11:01 am, Steven D'Aprano wrote: > On Thu, 25 Jun 2009 12:41:13 -0600, Michael Torrie wrote: > > If you want accurate math, check out other types like what is in the > > decimal module: > > import decimal > a=decimal.Decimal('3.2') > print a * 3 > > 9.6 > > Not so. Decima

Re: Measuring Fractal Dimension ?

2009-06-25 Thread pdpi
On Jun 25, 10:38 am, Paul Rubin wrote: > Robin Becker writes: > > someone once explained to me that the set of systems that are > > continuous in the calculus sense was of measure zero in the set of all > > systems I think it was a fairly formal discussion, but my >

Re: Measuring Fractal Dimension ?

2009-06-25 Thread pdpi
On Jun 25, 12:23 pm, Robin Becker wrote: > Paul Rubin wrote: > > so does this render all the discreteness implied by quantum theory unreliable? > or is it that we just cannot see(measure) the continuity that really happens? > Certainly there are people like Wolfram who seem to think we're in some

Re: Measuring Fractal Dimension ?

2009-06-24 Thread pdpi
On Jun 24, 1:32 pm, Mark Dickinson wrote: > On Jun 24, 10:12 am, pdpi wrote: > > > Regarding inf ** 0, why does IEEE745 define it as 1, when there is a > > perfectly fine NaN value? > > Other links:  the IEEE 754 revision working group mailing list > archives are p

Re: Measuring Fractal Dimension ?

2009-06-24 Thread pdpi
On Jun 24, 2:58 pm, "Hendrik van Rooyen" wrote: > "Steven D'Aprano" wrote: > >On Mon, 22 Jun 2009 13:43:19 -0500, David C. Ullrich wrote: > > >> In my universe the standard definition of "log" is different froim what > >> log means in a calculus class > > >Now I'm curious what the difference is.

Re: Measuring Fractal Dimension ?

2009-06-24 Thread pdpi
On Jun 23, 6:49 pm, Lie Ryan wrote: > Mark Dickinson wrote: > > On Jun 23, 3:52 am, Steven D'Aprano > > wrote: > >> On Mon, 22 Jun 2009 13:43:19 -0500, David C. Ullrich wrote: > >>> In my universe the standard definition of "log" is different froim what > >>> log means in a calculus class > >> No

Re: Measuring Fractal Dimension ?

2009-06-22 Thread pdpi
On Jun 19, 8:13 pm, Charles Yeomans wrote: > On Jun 19, 2009, at 2:43 PM, David C. Ullrich wrote: > > > > > > > Evidently my posts are appearing, since I see replies. > > I guess the question of why I don't see the posts themselves > > \is ot here... > > > On Thu, 18 Jun 2009 17:01:12 -0700 (PDT),

Re: Once again, comparison wxpython with PyQt

2009-06-19 Thread pdpi
On Jun 18, 3:49 pm, "Diez B. Roggisch" wrote: > Hans Müller wrote: > > Here we have to select between wxPython and PyQt for a medium size > > project. In this project several hundred dialogs are to be created. This > > work will be done by a program generator which has to re-written. > > > The que

Re: Measuring Fractal Dimension ?

2009-06-19 Thread pdpi
On Jun 17, 1:26 pm, Jaime Fernandez del Rio wrote: > P.S. The snowflake curve, on the other hand, is uniformly continuous, right? The definition of uniform continuity is that, for any epsilon > 0, there is a delta > 0 such that, for any x and y, if x-y < delta, f(x)-f (y) < epsilon. Given that K

Re: fastest native python database?

2009-06-18 Thread pdpi
On Jun 18, 8:09 am, Pierre Quentel wrote: > On 18 juin, 05:28, per wrote: > > > > > > > hi all, > > > i'm looking for a native python package to run a very simple data > > base. i was originally using cpickle with dictionaries for my problem, > > but i was making dictionaries out of very large te

Re: Exotic Logics

2009-06-17 Thread pdpi
On Jun 17, 5:37 pm, Lie Ryan wrote: > Steven D'Aprano wrote: > > On Tue, 16 Jun 2009 22:46:14 -0700, William Clifford wrote: > > >> I was staring at a logic table the other day, and I asked myself, "what > >> if one wanted to play with exotic logics; how might one do it?" > > > This might be usefu

Re: Measuring Fractal Dimension ?

2009-06-17 Thread pdpi
On Jun 17, 4:18 pm, Mark Dickinson wrote: > On Jun 17, 3:46 pm, Paul Rubin wrote: > > > Mark Dickinson writes: > > > It looks as though you're treating (a portion of?) the Koch curve as > > > the graph of a function f from R -> R and claiming that f is > > > uniform

Re: question about a command like 'goto ' in Python's bytecode orit's just a compiler optimization?

2009-06-17 Thread pdpi
On Jun 17, 9:01 am, "Hendrik van Rooyen" wrote: >  "Diez B. Roggisch" wrote: > > > Getting a depression because of a compiler is a bit strong... > > > However, yes, bytecode is similar to assembler, and in that respect > > higher-level control-structures are created using (conditional) jumps. > >

Re: Need to know if a file as only ASCII charaters

2009-06-16 Thread pdpi
On Jun 16, 2:17 pm, Dave Angel wrote: > Jorge wrote: > > Hi there, > > I'm making  a application that reads 3 party generated ASCII files, but some > > times > > the files are corrupted totally or partiality and I need to know if it's a > > ASCII file with *nix line terminators. > > In linux I can

Re: how to stop a function execution like...

2009-06-16 Thread pdpi
On Jun 16, 12:45 pm, "Diez B. Roggisch" wrote: > Gaudha wrote: > > Is there any built-in function to stop execution of a function similar > > to stop the program execution by sys.exit? > > In the example below, I want to skip statement 2... if the 'if' > > condition is satisfied. > > Don't advice

Re: Measuring Fractal Dimension ?

2009-06-15 Thread pdpi
On Jun 15, 5:55 am, Steven D'Aprano wrote: > On Sun, 14 Jun 2009 14:29:04 -0700, Kay Schluehr wrote: > > On 14 Jun., 16:00, Steven D'Aprano > > wrote: > > >> Incorrect. Koch's snowflake, for example, has a fractal dimension of > >> log 4/log 3 ≈ 1.26, a finite area of 8/5 times that of the initia

Re: import sqlite3

2009-06-04 Thread pdpi
On Jun 4, 12:45 pm, willgun wrote: > By the way ,what does 'best regards' means at the end of a mail? "regard" means roughly "care". Its use as "best regards" closing a letter (or, in this case, email), means that you care for the person you're saying goodbye to. It's just a polite way to end a

Re: Can I get a technical explanation on the following error

2009-05-25 Thread pdpi
On May 24, 6:41 pm, grocery_stocker wrote: > How come something like '\'  causes an error? Here is what I mean. > > [cdal...@localhost ~]$ python > Python 2.6.2 (r262:71600, May  3 2009, 17:04:44) > [GCC 4.1.1 20061011 (Red Hat 4.1.1-30)] on linux2 > Type "help", "copyright", "credits" or "license

Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-20 Thread pdpi
Iou need only consider having cartesian coordinate sets as the keys for an example. A 2 dimensional list might be overly expensive if your coordinates span a large area but are relatively sparse. -- http://mail.python.org/mailman/listinfo/python-list