Re: question of style

2009-07-04 Thread Paul Rubin
Steven D'Aprano writes: > Certain people -- a tiny minority -- keep trying to argue > that the ability to say "if obj" for arbitrary objects is somehow a bad > thing, and their arguments seem to always boil down to: > "If you write code that assumes that only bools have a truth value, then > su

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-04 Thread Carl Banks
On Jul 4, 4:35 pm, John Nagle wrote: >     The temptation is to write tokenizers in C, but that's an admission > of language design failure. No it isn't. It's only a failure of Python to be the language that does everything *you* want. Carl Banks -- http://mail.python.org/mailman/listinfo/pyth

Re: Clarity vs. code reuse/generality

2009-07-04 Thread Pablo Torres N.
On Sat, Jul 4, 2009 at 18:01, Dennis Lee Bieber wrote: >        Do you really want to inflict novices with the subtleties of when > "assert" is a proper structure to use? I'll second that. This very thread is proof that assertions are polemic, so maybe you (kj) should just save your student's san

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-04 Thread Aahz
In article <4a501a5e$0$1640$742ec...@news.sonic.net>, John Nagle wrote: > >Here's some actual code, from "tokenizer.py". This is called once >for each character in an HTML document, when in "data" state (outside >a tag). It's straightforward code, but look at all those >dictionary lookups.

Pyowa is this Monday!

2009-07-04 Thread Mike Driscoll
Hi, The next Pyowa meeting is on Monday, July 6th from 7-9 p.m. We will be at the Marshall County Sheriff's Office (directions on website). Currently, the plan is to have a talk about Python at Fisher/Emerson that will segue into a general discussion of what we do with our favorite programming lan

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-04 Thread John Nagle
Paul Rubin wrote: John Nagle writes: A dictionary lookup (actually, several of them) for every input character is rather expensive. Tokenizers usually index into a table of character classes, then use the character class index in a switch statement. Maybe you could use a regexp (and then

Re: Zipped Python?

2009-07-04 Thread Benjamin Kaplan
On Sat, Jul 4, 2009 at 8:03 PM, Jeremy Cowles wrote: >>> I'm looking for a full 2.5 or 2.6 version of Python that is zipped (i.e. >>> no >>> install). My intentions are to use it for a distributed computing project >>> (PyMW) where there is no guarantee that Python is installed on the worker >>> ma

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-04 Thread Ben Finney
John Nagle writes: >A dictionary lookup (actually, several of them) for every input > character is rather expensive. Tokenizers usually index into a table > of character classes, then use the character class index in a switch > statement. > >This is an issue that comes up whenever you ha

Re: finding most common elements between thousands of multiple arrays.

2009-07-04 Thread Steven D'Aprano
On Sat, 04 Jul 2009 07:19:48 -0700, Scott David Daniels wrote: > Actually the next step is to maintain a min-heap as you run down the > sorted array. Something like: Not bad. I did some tests on it, using the following sample data: arr = np.array([xrange(i, i+7000) for i in xrange(143)] +

Re: question of style

2009-07-04 Thread Steven D'Aprano
On Sat, 04 Jul 2009 11:10:48 -0700, Paul Rubin wrote: > Anyway, Python's overloading of bool(...) is yet another misfeature and > although it's convenient, the "explicit is better than implicit" > principle indicates to avoid that sort of trick. "Overloading of bool()"? I don't understand what t

Re: Multi thread reading a file

2009-07-04 Thread Steven D'Aprano
On Sun, 05 Jul 2009 12:12:22 +1200, Lawrence D'Oliveiro wrote: > In message <1beffd94-cfe6-4cf6- > bd48-2ccac8637...@j32g2000yqh.googlegroups.com>, ryles wrote: > > # Oh... yeah. I really *did* want 'is None' and not '== None' which > # iter() will do. Sorry guys! >> >> Please don't let

Re: finding most common elements between thousands of multiple arrays.

2009-07-04 Thread Steven D'Aprano
On Sat, 04 Jul 2009 15:06:29 -0700, mclovin wrote: > like I said I need to do this 480,000 times so to get this done > realistically I need to analyse about 5 a second. It appears that the > average matrix size contains about 15 million elements. Have you considered recording the element counts a

Re: Clarity vs. code reuse/generality

2009-07-04 Thread Steven D'Aprano
On Sat, 04 Jul 2009 21:14:45 +, kj wrote: >>Technically these are known as "invariants". An assertion will always be >>True if the program is bug-free, no matter what the user might throw at >>it; it's not the same as validation. > > What *user* are you talking about??? I've stated a bazilli

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-04 Thread Nobody
On Sat, 04 Jul 2009 16:35:08 -0700, John Nagle wrote: > The temptation is to write tokenizers in C, but that's an admission > of language design failure. The only part that really needs to be written in C is the DFA loop. The code to construct the state table from regexps could be written ent

Re: multiprocessing and freezing on Windows

2009-07-04 Thread SK
To add a bit more information, I found that I needed to patch get_command_line in multiprocessing/forking.py replacing: if getattr(sys, 'frozen', False): return [sys.executable, '--multiprocessing-fork'] else: prog = 'from multiprocessing.forking import main

Re: finding most common elements between thousands of multiple arrays.

2009-07-04 Thread Emile van Sebille
On 7/4/2009 12:33 AM mclovin said... Currently I need to find the most common elements in thousands of arrays within one large array (arround 2 million instances with ~70k unique elements) so I set up a dictionary to handle the counting so when I am iterating I ** up the count on the corro

Re: Zipped Python?

2009-07-04 Thread Jeremy Cowles
> > I'm looking for a full 2.5 or 2.6 version of Python that is zipped (i.e. no >> install). My intentions are to use it for a distributed computing project >> (PyMW) where there is no guarantee that Python is installed on the worker >> machines and an interactive install is out of the question. >>

Re: Multi thread reading a file

2009-07-04 Thread Lawrence D'Oliveiro
In message <1beffd94-cfe6-4cf6- bd48-2ccac8637...@j32g2000yqh.googlegroups.com>, ryles wrote: # Oh... yeah. I really *did* want 'is None' and not '== None' which # iter() will do. Sorry guys! > > Please don't let this happen to you too ;) Strange. others have got told off for using "==

Does cProfile include IO wait time?

2009-07-04 Thread Matthew Wilson
I have a command-line script that loads about 100 yaml files. It takes 2 or 3 seconds. I profiled my code and I'm using pstats to find what is the bottleneck. Here's the top 10 functions, sorted by internal time: In [5]: _3.sort_stats('time').print_stats(10) Sat Jul 4 13:25:40 2009

Re: Zipped Python?

2009-07-04 Thread Dave Angel
Jeremy Cowles wrote: Hi all, I'm looking for a full 2.5 or 2.6 version of Python that is zipped (i.e. no install). My intentions are to use it for a distributed computing project (PyMW) where there is no guarantee that Python is installed on the worker machines and an interactive install is out

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-04 Thread Paul Rubin
John Nagle writes: > A dictionary lookup (actually, several of them) for every > input character is rather expensive. Tokenizers usually index into > a table of character classes, then use the character class index in > a switch statement. Maybe you could use a regexp (and then have -two- pro

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-04 Thread John Nagle
Paul Rubin wrote: John Nagle writes: Python doesn't have a "switch" or "case" statement, and when you need a state machine with many states, that makes for painful, slow code. ... There's a comment in the code that it would be useful to run a few billion lines of HTML through an instrumented v

Re: Is code duplication allowed in this instance?

2009-07-04 Thread Klone
Thank you all. I think I get the gist and am about trying your suggestions. -- http://mail.python.org/mailman/listinfo/python-list

Re: finding most common elements between thousands of multiple arrays.

2009-07-04 Thread MRAB
mclovin wrote: On Jul 4, 3:29 pm, MRAB wrote: mclovin wrote: [snip] like I said I need to do this 480,000 times so to get this done realistically I need to analyse about 5 a second. It appears that the average matrix size contains about 15 million elements. I threaded my program using your c

Re: Searching equivalent to C++ RAII or deterministic destructors

2009-07-04 Thread Carl Banks
On Jul 3, 5:34 am, Jack Diederich wrote: > On Thu, Jul 2, 2009 at 2:36 PM, Carl Banks wrote: > > Warning: objects with a __del__ attribute prevent reference cycle > > detection, which can potentially lead to memory (and resource) leaks. > > So you must be careful to avoid creating reference loops

Re: finding most common elements between thousands of multiple arrays.

2009-07-04 Thread Scott David Daniels
mclovin wrote: On Jul 4, 12:51 pm, Scott David Daniels wrote: mclovin wrote: OK then. I will try some of the strategies here but I guess things arent looking too good. I need to run this over a dataset that someone pickled. I need to run this 480,000 times so you can see my frustration. So it

Re: finding most common elements between thousands of multiple arrays.

2009-07-04 Thread mclovin
On Jul 4, 3:29 pm, MRAB wrote: > mclovin wrote: > > [snip] > > > like I said I need to do this 480,000 times so to get this done > > realistically I need to analyse about 5 a second. It appears that the > > average matrix size contains about 15 million elements. > > > I threaded my program using y

Re: finding most common elements between thousands of multiple arrays.

2009-07-04 Thread MRAB
mclovin wrote: [snip] like I said I need to do this 480,000 times so to get this done realistically I need to analyse about 5 a second. It appears that the average matrix size contains about 15 million elements. I threaded my program using your code and I did about 1,000 in an hour so it is stil

Re: Clarity vs. code reuse/generality

2009-07-04 Thread Paul Rubin
kj writes: > >bisection search usually just requires the function to be continuous > >and to have its value cross the target somewhere between the endpoints, > >not be monotonic. > > Try the algorithm I posted with lo = -pi/4, hi = 2*pi, func = cos, > target = -1, and see what you get... Sorry,

Re: Clarity vs. code reuse/generality

2009-07-04 Thread Simon Forman
On Jul 4, 12:30 pm, kj wrote: > In "Pablo Torres N." > writes: > > > > >On Sat, Jul 4, 2009 at 10:05, kj wrote: > >>>http://docs.python.org/reference/simple_stmts.html#grammar-token-asse... > >tmt > >>>"The current code generator emits no code for an assert statement when op= > >timization is r

Re: finding most common elements between thousands of multiple arrays.

2009-07-04 Thread mclovin
On Jul 4, 12:51 pm, Scott David Daniels wrote: > mclovin wrote: > > OK then. I will try some of the strategies here but I guess things > > arent looking too good. I need to run this over a dataset that someone > > pickled. I need to run this 480,000 times so you can see my > > frustration. So it d

Re: Clarity vs. code reuse/generality

2009-07-04 Thread kj
In MRAB writes: >Paul Rubin wrote: >> kj writes: >>> This implies that code that uses *any* assert statement (other than >>> perhaps the trivial and meaningless ones like "assert True") is >>> liable to break, because whatever it is that these assert statements >>> are checking "on some occasi

Re: Clarity vs. code reuse/generality

2009-07-04 Thread kj
In <7xzlbkti7z@ruckus.brouhaha.com> Paul Rubin writes: >kj writes: >> This implies that code that uses *any* assert statement (other than >> perhaps the trivial and meaningless ones like "assert True") is >> liable to break, because whatever it is that these as

Re: Clarity vs. code reuse/generality

2009-07-04 Thread kj
In <7x4otsux7f@ruckus.brouhaha.com> Paul Rubin writes: >kj writes: >> sense = cmp(func(hi), func(lo)) >> assert sense != 0, "func is not strictly monotonic in [lo, hi]" >bisection search usually just requires the function to be continuous >and to have

Re: Clarity vs. code reuse/generality

2009-07-04 Thread Paul Rubin
Scott David Daniels writes: > And I curse such uses, since I don't get to see the troublesome value, > or why it is troublesome. In the above case, y = sqrt(x) at least > raises ValueError('math domain error'), which is more information than > you are providing. > > How about: > if x >= 0:

Re: question of style

2009-07-04 Thread Simon Forman
On Jul 4, 2:10 pm, Paul Rubin wrote: > Simon Forman writes: > > > if not (self.higher and self.lower): > > >     return self.higher or self.lower > > > That would work too in this case, both higher and lower are expected > > to be either None or an object (that doesn

Re: Clarity vs. code reuse/generality

2009-07-04 Thread Scott David Daniels
Paul Rubin wrote: Invalid input data is not considered impossible and doesn't imply a broken program, so assert statements are not the appropriate way to check for it. I like to use a function like def check(condition, msg="data error"): if not condition: raise ValueError, msg ...

Re: finding most common elements between thousands of multiple arrays.

2009-07-04 Thread Scott David Daniels
mclovin wrote: OK then. I will try some of the strategies here but I guess things arent looking too good. I need to run this over a dataset that someone pickled. I need to run this 480,000 times so you can see my frustration. So it doesn't need to be "real time" but it would be nice it was done s

Re: mail

2009-07-04 Thread Grant Edwards
On 2009-07-04, amr...@iisermohali.ac.in wrote: > I want to know that whether using python programming is it > possible to extract chemical shift information about some > amino acids of some protein from BMRB(BioMagResBank) or > Ref-DB(referenced databank) or not. Yes. I don't know how easy it w

Re: Clarity vs. code reuse/generality

2009-07-04 Thread Alan G Isaac
On 7/4/2009 12:30 PM kj apparently wrote: > I'm beginning to think that the original "precept" was simply "cargo > cult," i.e. one of those rules that are parroted without being > fully understood. Adopting such a view is of course an alternative to attempting to understand, but perhaps less usef

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-04 Thread Paul Rubin
John Nagle writes: > Python doesn't have a "switch" or "case" statement, and when > you need a state machine with many states, that makes for painful, > slow code. ... > There's a comment in the code that it would be useful > to run a few billion lines of HTML through an instrumented version > of

Re: Clarity vs. code reuse/generality

2009-07-04 Thread MRAB
Paul Rubin wrote: kj writes: This implies that code that uses *any* assert statement (other than perhaps the trivial and meaningless ones like "assert True") is liable to break, because whatever it is that these assert statements are checking "on some occasions, ... would go unchecked, potentia

Re: finding most common elements between thousands of multiple arrays.

2009-07-04 Thread Lie Ryan
mclovin wrote: > OK then. I will try some of the strategies here but I guess things > arent looking too good. I need to run this over a dataset that someone > pickled. I need to run this 480,000 times so you can see my > frustration. So it doesn't need to be "real time" but it would be nice > it wa

Re: Clarity vs. code reuse/generality

2009-07-04 Thread Paul Rubin
kj writes: > This implies that code that uses *any* assert statement (other than > perhaps the trivial and meaningless ones like "assert True") is > liable to break, because whatever it is that these assert statements > are checking "on some occasions, ... would go unchecked, potentially > breakin

Re: Clarity vs. code reuse/generality

2009-07-04 Thread Paul Rubin
kj writes: > sense = cmp(func(hi), func(lo)) > assert sense != 0, "func is not strictly monotonic in [lo, hi]" bisection search usually just requires the function to be continuous and to have its value cross the target somewhere between the endpoints, not be monotonic. > I regard the ver

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-04 Thread Mel
John Nagle wrote: [ ... ] > Parsers have many named compile-time constants. Python doesn't support > named compile-time constants, and this is one of the places where we > have to pay the bill for that limitation. > > Something to think about when you need three more racks of servers > because th

Re: question of style

2009-07-04 Thread Paul Rubin
Simon Forman writes: > > if not (self.higher and self.lower): > >     return self.higher or self.lower > > That would work too in this case, both higher and lower are expected > to be either None or an object (that doesn't override the default all- > objects-are-true rule.) -1. Objects can supp

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-04 Thread Benjamin Kaplan
On Sat, Jul 4, 2009 at 1:33 PM, John Nagle wrote: >   As an example of code that really needs to run fast, but is > speed-limited by Python's limitations, see "tokenizer.py" in > >        http://code.google.com/p/html5lib/ > > This is a parser for HTML 5, a piece of code that will be needed > in ma

Re: finding most common elements between thousands of multiple arrays.

2009-07-04 Thread Vilya Harvey
2009/7/4 Steven D'Aprano : > On Sat, 04 Jul 2009 13:42:06 +, Steven D'Aprano wrote: > >> On Sat, 04 Jul 2009 10:55:44 +0100, Vilya Harvey wrote: >> >>> 2009/7/4 Andre Engels : On Sat, Jul 4, 2009 at 9:33 AM, mclovin wrote: > Currently I need to find the most common elements in thousand

Re: Reversible Debugging

2009-07-04 Thread Vilya Harvey
2009/7/4 Patrick Sabin : > If someone has another idea of taking a snapshot let me know. Using VMWare > is not a > very elegant way in my opinion. Someone implemented the same idea for Java a while ago. They called it "omniscient debugging"; you can find details at http://www.lambdacs.com/debu

Zipped Python?

2009-07-04 Thread Jeremy Cowles
Hi all, I'm looking for a full 2.5 or 2.6 version of Python that is zipped (i.e. no install). My intentions are to use it for a distributed computing project (PyMW) where there is no guarantee that Python is installed on the worker machines and an interactive install is out of the question. I've

Code that ought to run fast, but can't due to Python limitations.

2009-07-04 Thread John Nagle
As an example of code that really needs to run fast, but is speed-limited by Python's limitations, see "tokenizer.py" in http://code.google.com/p/html5lib/ This is a parser for HTML 5, a piece of code that will be needed in many places and will process large amounts of data. It's writ

Re: Python debugger

2009-07-04 Thread Fabio Zadrozny
> Hi, > Could you suggest some python debuggers? > > Thanks, > Srini Pydev has a debugger that supports the common debugger features (watches, multiple threads, breakpoints, conditional breakpoints, step in, out, etc -- http://fabioz.com/pydev/manual_adv_debugger.html ), and pydev extensions adds

Re: Reversible Debugging

2009-07-04 Thread Patrick Sabin
Now, if the snapshot is a feature of the Python VM, that's another matter entirely. I thought of taking a snapshot using fork, which creates a copy of the process. It may not be the most performant, but it should be quite portable. Of course there are some issues with multithreading/multiproc

mail

2009-07-04 Thread amrita
Hi, I want to know that whether using python programming is it possible to extract chemical shift information about some amino acids of some protein from BMRB(BioMagResBank) or Ref-DB(referenced databank) or not. Thanks, Amrita Kumari Research Fellow IISER Mohali Chandigarh INDIA -- http://mail

Re: Problems with using queue in Tkinter application

2009-07-04 Thread MRAB
Icarus wrote: I'm working on a serial protocol analyzer in python. We have an application written by someone else in MFC but we need something that is cross platform. I intended to implement the GUI portion in Tkinter but am having trouble. The idea is that I will read messages from the serial

Re: Where does setuptools live?

2009-07-04 Thread Floris Bruynooghe
On Jul 4, 4:50 pm, David Wilson wrote: > I'm trying to create a patch for a diabolical issue I keep running > into, but I can't seem to find the setuptools repository. Is it this > one? > >    http://svn.python.org/view/sandbox/trunk/setuptools/ It is, see http://mail.python.org/pipermail/distuti

Re: Clarity vs. code reuse/generality

2009-07-04 Thread kj
In "Pablo Torres N." writes: >On Sat, Jul 4, 2009 at 10:05, kj wrote: >>>http://docs.python.org/reference/simple_stmts.html#grammar-token-assert_s= >tmt >>>"The current code generator emits no code for an assert statement when op= >timization is requested at compile time." >> >> Sorry, this doe

Re: Problems with using queue in Tkinter application

2009-07-04 Thread Peter Otten
Icarus wrote: > On Jul 4, 3:21 am, Peter Otten <__pete...@web.de> wrote: >> Icarus wrote: >> > I'm working on a serial protocol analyzer in python. We have an >> > application written by someone else in MFC but we need something that >> > is cross platform. I intended to implement the GUI portio

Re: finding most common elements between thousands of multiple arrays.

2009-07-04 Thread mclovin
OK then. I will try some of the strategies here but I guess things arent looking too good. I need to run this over a dataset that someone pickled. I need to run this 480,000 times so you can see my frustration. So it doesn't need to be "real time" but it would be nice it was done sorting this month

Re: Reversible Debugging

2009-07-04 Thread Dave Angel
Steven D'Aprano wrote: On Sat, 04 Jul 2009 09:58:39 -0400, Dave Angel wrote: Read his suggested approach more carefully. He's not "undoing" anything. He's rolling back to the save-point, and then stepping forward to the desired spot. Except for influences outside his control (eg. file s

Where does setuptools live?

2009-07-04 Thread David Wilson
I'm trying to create a patch for a diabolical issue I keep running into, but I can't seem to find the setuptools repository. Is it this one? http://svn.python.org/view/sandbox/trunk/setuptools/ It's seen no changes in 9 months. The issue in question is its (ab)use of .svn to directly read wo

Re: question of style

2009-07-04 Thread Aahz
In article <7xws6oa862@ruckus.brouhaha.com>, Paul Rubin wrote: > >In many cases it later turns out that list really was the natural >representation and it ends up growing additional potential elements. >I saw some article about database design recently that claim

Re: Clarity vs. code reuse/generality

2009-07-04 Thread Pablo Torres N.
On Sat, Jul 4, 2009 at 10:05, kj wrote: >>http://docs.python.org/reference/simple_stmts.html#grammar-token-assert_stmt >>"The current code generator emits no code for an assert statement when >>optimization is requested at compile time." > > Sorry, this doesn't say anything like "don't use asserti

Re: Problems with using queue in Tkinter application

2009-07-04 Thread Icarus
On Jul 4, 3:21 am, Peter Otten <__pete...@web.de> wrote: > Icarus wrote: > > I'm working on a serial protocol analyzer in python.  We have an > > application written by someone else in MFC but we need something that > > is cross platform.  I intended to implement the GUI portion in Tkinter > > but

Re: Clarity vs. code reuse/generality

2009-07-04 Thread kj
In Alan G Isaac writes: >> In Alan G Isaac >> writes: >>> 1. Don't use assertions to test argument values! >On 7/3/2009 12:19 PM kj apparently wrote: >> Out of curiosity, where does this come from? >http://docs.python.org/reference/simple_stmts.html#grammar-token-assert_stmt >"The curre

Re: Clarity vs. code reuse/generality

2009-07-04 Thread kj
In <7xk52p4tgg@ruckus.brouhaha.com> Paul Rubin writes: >kj writes: >> sense = cmp(func(hi), func(lo)) >> if sense == 0: >> return None >> target_plus = sense * target + epsilon >> target_minus = sense * target - epsilon >> ... >The

Re: Reversible Debugging

2009-07-04 Thread Scott David Daniels
Dave Angel wrote: Scott David Daniels wrote: Patrick Sabin wrote: Horace Blegg schrieb: You might consider using a VM with 'save-points'. You run the program (in a debugger/ida/what have you) to a certain point (logical point would be if/ifelse/else statements, etc) and save the VM state. On

Re: question of style

2009-07-04 Thread Simon Forman
On Jul 4, 2:03 am, upwestdon wrote: > On Jul 2, 1:23 pm, Simon Forman wrote: > > > > > Hey I was hoping to get your opinions on a sort of minor stylistic > > point. > > These two snippets of code are functionally identical. Which would you > > use and why? > > The first one is easier [for me anyw

Re: finding most common elements between thousands of multiple arrays.

2009-07-04 Thread Steven D'Aprano
On Sat, 04 Jul 2009 13:42:06 +, Steven D'Aprano wrote: > On Sat, 04 Jul 2009 10:55:44 +0100, Vilya Harvey wrote: > >> 2009/7/4 Andre Engels : >>> On Sat, Jul 4, 2009 at 9:33 AM, mclovin wrote: Currently I need to find the most common elements in thousands of arrays within one large

Re: finding most common elements between thousands of multiple arrays.

2009-07-04 Thread Scott David Daniels
Vilya Harvey wrote: 2009/7/4 Andre Engels : On Sat, Jul 4, 2009 at 9:33 AM, mclovin wrote: Currently I need to find the most common elements in thousands of arrays within one large array (arround 2 million instances with ~70k unique elements)... Try flattening the arrays into a single large ar

Re: Reversible Debugging

2009-07-04 Thread Steven D'Aprano
On Sat, 04 Jul 2009 09:58:39 -0400, Dave Angel wrote: > Read his suggested approach more carefully. He's not "undoing" > anything. He's rolling back to the save-point, and then stepping > forward to the desired spot. Except for influences outside his control > (eg. file system operations), this

Re: Re: Reversible Debugging

2009-07-04 Thread Dave Angel
Scott David Daniels wrote: Patrick Sabin wrote: Horace Blegg schrieb: You might consider using a VM with 'save-points'. You run the program (in a debugger/ida/what have you) to a certain point (logical point would be if/ifelse/else statements, etc) and save the VM state. Once you've saved,

Re: finding most common elements between thousands of multiple arrays.

2009-07-04 Thread Steven D'Aprano
On Sat, 04 Jul 2009 10:55:44 +0100, Vilya Harvey wrote: > 2009/7/4 Andre Engels : >> On Sat, Jul 4, 2009 at 9:33 AM, mclovin wrote: >>> Currently I need to find the most common elements in thousands of >>> arrays within one large array (arround 2 million instances with ~70k >>> unique elements) ..

Re: finding most common elements between thousands of multiple arrays.

2009-07-04 Thread Neil Crighton
You can join all your arrays into a single big array with concatenate. >>> import numpy as np >>> a = np.concatenate(array_of_arrays) Then count the number of occurrances of each unique element using this trick with searchsorted. This should be pretty fast. >>> a.sort() >>> unique_a = np.unique(

Re: Re: question of style

2009-07-04 Thread Dave Angel
upwestdon wrote: On Jul 2, 1:23 pm, Simon Forman wrote: Hey I was hoping to get your opinions on a sort of minor stylistic point. These two snippets of code are functionally identical. Which would you use and why? The first one is easier [for me anyway] to read and understand, but slightly l

Re: question of style

2009-07-04 Thread Paul Rubin
a...@pythoncraft.com (Aahz) writes: > AFAICT, in order for Maybe and Option to work, you need to have some > kind of static typing system. Am I missing something? I'm not sure. Maybe there could be some kind of syntactic support in a dynamic language (not that I'm suggesting adding that to Pytho

Re: Calling C or C++ Functions inside Python script

2009-07-04 Thread Pablo Torres N.
On Sat, Jul 4, 2009 at 05:06, Parikshat Dubey wrote: > Hi, > > Is this possible to call C functions(inbuilt or user defined) inside python > script.If yes, please illustrate how it can be done. > Thanks, > Parikshat Dubey >From http://www.swig.org : "SWIG is a software development tool that conn

psyco V2 beta2 benchmark

2009-07-04 Thread larudwer
just out of curiosity i've downloaded the latest Version of Psyco V2 Beta 2 and run the benchmarks against the old Version of psyco 1.6 Because it might be of common interest, i am posting the results here. My machine is a Pentium D 3.2 Ghz running Windows XP SP 3 and Python 2.6.2. Psyco V2 was

Re: Reversible Debugging

2009-07-04 Thread Scott David Daniels
Patrick Sabin wrote: Horace Blegg schrieb: You might consider using a VM with 'save-points'. You run the program (in a debugger/ida/what have you) to a certain point (logical point would be if/ifelse/else statements, etc) and save the VM state. Once you've saved, you continue. If you find the

Re: question of style

2009-07-04 Thread Scott David Daniels
upwestdon wrote: if not (self.higher and self.lower): return self.higher or self.lower self.lower = 0 self.higher = 123 ??? More than just None is False -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib with x509 certs

2009-07-04 Thread Martin v. Löwis
> Thanks for the reply. I want my key to be as secure as possible. So I > will remove pass phrase if only there is no other possibility to go > through authentication. And you put the passphrase into the source code instead? How does it make that more secure? Regards, Martin -- http://mail.pytho

Re: Calling C or C++ Functions inside Python script

2009-07-04 Thread Chris Rebert
On Sat, Jul 4, 2009 at 3:06 AM, Parikshat Dubey wrote: > Hi, > > Is this possible to call C functions(inbuilt or user defined) inside python > script.If yes, please illustrate how it can be done. The `ctypes` module: http://docs.python.org/library/ctypes.html Note: does not work w/ C++ directly.

Re: urllib with x509 certs

2009-07-04 Thread Chris Rebert
2009/7/4 Lacrima : > On Jul 4, 11:24 am, Chris Rebert wrote: >> On Sat, Jul 4, 2009 at 1:12 AM, Lacrima wrote: >> > Hello! >> >> > I am trying to use urllib to fetch some internet resources, using my >> > client x509 certificate. >> > I have divided my .p12 file into mykey.key and mycert.cer files

Re: urllib with x509 certs

2009-07-04 Thread Lacrima
On Jul 4, 12:38 pm, "Martin v. Löwis" wrote: > > This works Ok! But every time I am asked to enter PEM pass phrase, > > which I specified during dividing my .p12 file. > > So my question... What should I do to make my code fetch any url > > automatically (without asking me every time to enter pass

Re: urllib with x509 certs

2009-07-04 Thread Lacrima
On Jul 4, 11:24 am, Chris Rebert wrote: > On Sat, Jul 4, 2009 at 1:12 AM, Lacrima wrote: > > Hello! > > > I am trying to use urllib to fetch some internet resources, using my > > client x509 certificate. > > I have divided my .p12 file into mykey.key and mycert.cer files. > > Then I use following

Calling C or C++ Functions inside Python script

2009-07-04 Thread Parikshat Dubey
Hi, Is this possible to call C functions(inbuilt or user defined) inside python script.If yes, please illustrate how it can be done. Thanks, Parikshat Dubey -- -Fear not the path of truth, for the lack of people walking on it. Practice yourself, for heaven's sake, in little things; and

Re: finding most common elements between thousands of multiple arrays.

2009-07-04 Thread Vilya Harvey
2009/7/4 Andre Engels : > On Sat, Jul 4, 2009 at 9:33 AM, mclovin wrote: >> Currently I need to find the most common elements in thousands of >> arrays within one large array (arround 2 million instances with ~70k >> unique elements) >> >> so I set up a dictionary to handle the counting so when I a

Re: is it possible to write USSD / SMS /SS7 apps in python

2009-07-04 Thread Banibrata Dutta
On Sat, Jul 4, 2009 at 3:20 PM, Chris Rebert wrote: > On Sat, Jul 4, 2009 at 2:47 AM, Banibrata > Dutta wrote: > > QuoteGoke Aruna > >> > >> what am saying is reading the ITU info on USSD, is it possible to use > >> python > >> > >> to write the application SS7 with support for TCAP/MAP talking

Re: is it possible to write USSD / SMS /SS7 apps in python

2009-07-04 Thread Banibrata Dutta
BTW, if you just want to be able to send/receive SMS's in a Python application, there are several alternatives. 1. Most operators, or 3rd party bulk-SMS vendors (who resell SMS capacity from operators at a premium but in smaller bundles than what an operator would sell), offer -- a. HTTP based me

Re: is it possible to write USSD / SMS /SS7 apps in python

2009-07-04 Thread Chris Rebert
On Sat, Jul 4, 2009 at 2:47 AM, Banibrata Dutta wrote: > QuoteGoke Aruna >> >> what am saying is reading the ITU info on USSD, is it possible to use >> python >> >> to write the application SS7 with support for TCAP/MAP talking to E1 card >> to do the ss7 signalling. > > As Chris mentioned "possib

Re: is it possible to write USSD / SMS /SS7 apps in python

2009-07-04 Thread Banibrata Dutta
QuoteGoke Aruna what am saying is reading the ITU info on USSD, is it possible to use python to write the application SS7 with support for TCAP/MAP talking to E1 card to do the ss7 signalling. As Chris mentioned "possible, but probably not easy". AFAIK, not much of what you might need exists in

Re: urllib with x509 certs

2009-07-04 Thread Martin v. Löwis
> This works Ok! But every time I am asked to enter PEM pass phrase, > which I specified during dividing my .p12 file. > So my question... What should I do to make my code fetch any url > automatically (without asking me every time to enter pass phrase)? > As I understand there is impossible to spe

Re: Reversible Debugging

2009-07-04 Thread Stef Mientki
Patrick Sabin wrote: Hello, I am interested if there are any python modules, that supports reversible debugging aka stepping backwards. Any links or ideas would be helpful, because I am thinking of implementing something like that. In some cases it would be nice to have something like that,

Re: Reversible Debugging

2009-07-04 Thread Patrick Sabin
Horace Blegg schrieb: You might consider using a VM with 'save-points'. You run the program (in a debugger/ida/what have you) to a certain point (logical point would be if/ifelse/else statements, etc) and save the VM state. Once you've saved, you continue. If you find the path you've taken isn'

Re: Problems with using queue in Tkinter application

2009-07-04 Thread Peter Otten
Icarus wrote: > I'm working on a serial protocol analyzer in python. We have an > application written by someone else in MFC but we need something that > is cross platform. I intended to implement the GUI portion in Tkinter > but am having trouble. > > The idea is that I will read messages from

Re: urllib with x509 certs

2009-07-04 Thread Chris Rebert
On Sat, Jul 4, 2009 at 1:12 AM, Lacrima wrote: > Hello! > > I am trying to use urllib to fetch some internet resources, using my > client x509 certificate. > I have divided my .p12 file into mykey.key and mycert.cer files. > Then I use following approach: import urllib url = 'https://exam

urllib with x509 certs

2009-07-04 Thread Lacrima
Hello! I am trying to use urllib to fetch some internet resources, using my client x509 certificate. I have divided my .p12 file into mykey.key and mycert.cer files. Then I use following approach: >>> import urllib >>> url = 'https://example.com' >>> xml = ''' ... somexml ''' >>> opener = urllib.U

Re: finding most common elements between thousands of multiple arrays.

2009-07-04 Thread Andre Engels
On Sat, Jul 4, 2009 at 9:33 AM, mclovin wrote: > Currently I need to find the most common elements in thousands of > arrays within one large array (arround 2 million instances with ~70k > unique elements) > > so I set up a dictionary to handle the counting so when I am > iterating  I up the count o

Re: Reversible Debugging

2009-07-04 Thread Patrick Sabin
Gabriel Genellina schrieb: Do you want reverse execution, like an undo function? Undo all changes made by executing some piece of code? I am not completly sure, if I really want to make exact undo, i.e. undoing commands by reversing all their effects, or just restoring the program state to an ar

  1   2   >