Re: Fast forward-backward (write-read)

2012-10-23 Thread Paul Rubin
Tim Chase writes: > Again, the conversion to/from decimal hasn't been a great cost in my > experience, as it's overwhelmed by the I/O cost of shoveling the > data to/from disk. I've found that cpu costs both for processing and conversion are significant. Also, using a binary format makes the fil

Re: Fast forward-backward (write-read)

2012-10-23 Thread Paul Rubin
Virgil Stokes writes: > Yes, I do wish to inverse the order, but the "forward in time" file > will be in binary. I really think it will be simplest to just write the file in forward order, then use mmap to read it one record at a time. It might be possible to squeeze out a little more performan

Re: Fast forward-backward (write-read)

2012-10-24 Thread Paul Rubin
Emile van Sebille writes: >> probably somewhere close to 400-500Gb in memory > I went looking for a machine capable of this and got about halfway > there with http://www.tech-news.com/publib/pl2818.html which allows up > to 248Gb memory -- near as I can tell the price for the maxed out > syste

Re: while expression feature proposal

2012-10-24 Thread Paul Rubin
Dan Loewenherz writes: > VAR = EXPR > while VAR: > BLOCK > VAR = EXPR for VAR in iter(lambda: EXPR, None): BLOCK where the termination sentinel might be False or '' or whatever instead of None. Of course if EXPR is a callable, there's no lambda. > while EXPR as VAR: > BLOCK Thi

Re: while expression feature proposal

2012-10-24 Thread Paul Rubin
Cameron Simpson writes: > if re_FUNKYPATTERN.match(test_string) as m: > do stuff with the results of the match, using "m" class memo: def __call__(f, *args, **kw): self.result = f(*args, **kw) m = memo() if result(re_FUNKYPATTERN.match, test_string): do stuff wit

Re: while expression feature proposal

2012-10-24 Thread Paul Rubin
Paul Rubin writes: > class memo: > def __call__(f, *args, **kw): > self.result = f(*args, **kw) obviously add return self.result -- http://mail.python.org/mailman/listinfo/python-list

Re: while expression feature proposal

2012-10-24 Thread Paul Rubin
Ian Kelly writes: > j = int(random() * n) > while j in selected: > j = int(random() * n) from itertools import dropwhile j = dropwhile(lambda j: j in selected, iter(lambda: int(random() * n), object())) .next() kind of ugly, makes me wish for a few more itertoo

Re: while expression feature proposal

2012-10-25 Thread Paul Rudin
Paul Rubin writes: > kind of ugly, makes me wish for a few more itertools primitives JOOI, do you have specific primitives in mind? -- http://mail.python.org/mailman/listinfo/python-list

Re: while expression feature proposal

2012-10-25 Thread Paul Rubin
Dan Loewenherz writes: > In this case, profile_id is "None" when the loop breaks. It would be > much more straightforward (and more Pythonic, IMO), to write: > > client = StrictRedis() > while client.spop("profile_ids") as profile_id: > print profile_id That is pretty loose, in my

Re: while expression feature proposal

2012-10-26 Thread Paul Rubin
Dan Loewenherz writes: > We also don't special case things like this just because x is an empty > string. If this "while EXPR as VAR" thing were to move forward, we > shouldn't treat the truth testing any differently than how we already > do. IMO we should write our applications with the understan

Re: while expression feature proposal

2012-10-26 Thread Paul Rubin
Steven D'Aprano writes: > There's no need for it *inside* of while expressions. It doesn't add to > the expressiveness of the language, or increase the power of the > language, or help people write correct code. It saves one trivial line of > code in some, but not all, while loops, at the cost

Re: Negative array indicies and slice()

2012-10-28 Thread Paul Rubin
Andrew writes: > So: Why does python choose to convert them to positive indexes, and > have slice operate differently than xrange There was a thread a few years back, I think started by Bryan Olson, that made the case that slice indexing is a Python wart for further reasons than the above, and s

Re: Immutability and Python

2012-10-29 Thread Paul Rubin
andrea crotti writes: > and we want to change its state incrementing the number ... > the immutability purists would instead suggest to do this: > def increment(self): > return NumWrapper(self.number + 1) Immutability purists would say that numbers don't have "state" and if you're tr

Re: Immutability and Python

2012-10-29 Thread Paul Rubin
andrea crotti writes: > Also because how doi I make an immutable object in pure Python? Numbers in Python are already immutable. What you're really looking for is a programming style where you don't bind any variable more than once. This gives rise to a programming style that Python can support

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Paul Rubin
Johannes Bauer writes: > This makes the source files largish however (they're currently split up > in different files). Can I use the nested class advantage and somehow > include the inner class from another file? You could possibly duck-punch class A: import B class A: ... A.B = B.B

Re: python and Open cv

2012-11-01 Thread Paul Rudin
Zero Piraeus writes: > There aren't any rules about gmail (except the unwritten rule that to > be a "real" geek you need to use a mail client that takes a whole > weekend to configure, and another three years to properly understand). Ha! 3 years? I've been using gnus for nearly 20 years and I st

Re: Organisation of python classes and their methods

2012-11-02 Thread Paul Rubin
Martin Hewitson writes: > So, is there a way to put these methods in their own files and have > them 'included' in the class somehow? ... Is there an official python > way to do this? I don't like having source files with 100's of lines > of code in, let alone 1000's. That code sounds kind of sme

Re: Organisation of python classes and their methods

2012-11-02 Thread Paul Rubin
Martin Hewitson writes: > Well, here we disagree. Suppose I have a class which encapsulates > time-series data. Below is a list of the absolute minimum methods one > would have to process that data. ... > 'abs' > 'acos' > 'asin' > ... Ok, THERE is your problem. Why do you have separ

Re: Organisation of python classes and their methods

2012-11-02 Thread Paul Rubin
Martin Hewitson writes: >> you want just ONE method, something like "map"... > Well, because one of the features that the framework will have is to > capture history steps (in a tree structure) so that each processing > step the user does is tracked. So while methods such as abs(), cos(), > etc wi

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-09 Thread Paul Rubin
bruceg113...@gmail.com writes: > Is there a simpler way to modify all arguments in a function before > using the arguments? Why do you want to do that? > For example, can the below code, in the modify arguments section be > made into a few statements? Whenever someone uses that many variables on

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-09 Thread Paul Rubin
Chris Angelico writes: > Contrived example: > def send_email(from, to, subj, body, whatever, other, headers, you, like): That should be a dictionary with the header names as indexes. In fact there are already some email handling modules in the stdlib that represent headers that way. -- http://m

Re: Format specification mini-language for list joining

2012-11-10 Thread Paul Rubin
Tobia Conforto writes: > Now, as much as I appreciate the heritage of Lisp, I won't deny than > its format string mini-language is EVIL. ... Still, this is the > grand^n-father of Python's format strings... Without having yet read the rest of your post carefully, I wonder the particular historica

Re: A gnarly little python loop

2012-11-11 Thread Paul Rubin
Cameron Simpson writes: > | I'd prefer the original code ten times over this inaccessible beast. > Me too. Me, I like the itertools version better. There's one chunk of data that goes through a succession of transforms each of which is very straightforward. -- http://mail.python.org/mailman/lis

Re: xml data or other?

2012-11-13 Thread shivers . paul
On Friday, November 9, 2012 12:54:56 PM UTC, Artie Ziff wrote: > Hello, > > > > I want to process XML-like data like this: > > > > > > > > ACPI (Advanced Control Power & Integration) testscript for 2.5 > kernels. > > > > <\description> > > > >

Re: Paid Python work for 30mins - 1 hour

2012-11-19 Thread Paul Rubin
blockedu...@gmail.com writes: > I have three scripts that I would like written, they are designed to > do the following: > Backup.py – Zip a folder and store it on amazon S3 ... > If you are interested get in touch! You could just type "python s3 upload" into web search and see if you can use the

Re: Paid Python work for 30mins - 1 hour

2012-11-19 Thread Paul Rubin
Mark Adam writes: > You might consider putting your request on elance.com or guru.com > where you can hire programmers for small projects like this. Even though the coding task is very small, I think it's unrealistic to scope it at less than 2-4 hours, given communication overhead etc. It would

Re: logger doesn't roll over

2012-11-21 Thread Paul Rubin
cerr writes: > 2.2MB and should've rolled over after ever 1MB. > LOGFILE, maxBytes=(1048576*10), backupCount=5 1048576*10 is 10MB, not 1MB. -- http://mail.python.org/mailman/listinfo/python-list

Re: Constructing JSON data structures from non-string key python dictionaries

2012-11-22 Thread Paul Kölle
bject literal. cheers Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Exponential arrival distribution in Python

2012-11-28 Thread Paul Rubin
Ricky writes: > I am doing a project on traffic simulation. I want to introduce > exponential arrival distribution to precede this task. Therefore I > want write a code in python for exponential arrival distribution. I've never heard of an "exponential arrival distribution" and googling fails. D

Re: Help accessing COM .dll from Python

2012-12-01 Thread Paul Kölle
. The defines for return codes used in the documentation are here http://www.id-reader.com/Support/Sample_Codes/Visual_C_Plus_Plus/header_lib.rar in SlibErrDef.h and probably others... cheers Paul The SDK revolves around a .dll file that is described as a 'COM Object' but t

Re: Secretly passing parameter to function

2012-12-06 Thread Paul Rubin
Olivier Scalbert writes: > # We ask the framework to do some work. > do(step1, param = None) from functools import partial do(partial(step1, param = None)) -- http://mail.python.org/mailman/listinfo/python-list

Re: Secretly passing parameter to function

2012-12-06 Thread Paul Rubin
Paul Rubin writes: > from functools import partial > do(partial(step1, param = None)) Or more directly: do(lambda: step1(param = None)) -- http://mail.python.org/mailman/listinfo/python-list

Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-06 Thread Paul Rubin
Nick Mellor writes: > I came across itertools.dropwhile only today, then shortly afterwards > found Raymond Hettinger wondering, in 2007, whether to drop [sic] > dropwhile and takewhile from the itertools module > Almost nobody else of the 18 respondents seemed to be using them. What? I'm am

Re: accessing an OLE Automation (IDispatch) server from python which requires the use of "out params"

2012-12-11 Thread Paul Kölle
14/pass-by-reference-parameters-in-powershell.aspx TL;DR IMHO "out" parameters are basically pointers (pass by reference) and need to be passed like GetSettingValue("name", [ref]$value)... cheers Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with unittest2

2012-12-13 Thread Paul Rudin
Thomas Bach writes: > BTW, I actually never used 'assertTypeEqual' I rather call assertEqual > and let unittest do the internals. I think assertEqual calls the right > method for you depending on the arguments type. The assertEqual methods have the advantage of checking the type of the argume

Re: Python parser problem

2012-12-13 Thread Paul Rudin
Chris Angelico writes: > On Fri, Dec 14, 2012 at 6:12 AM, RCU wrote: >> Dave, >> Thanks for the reply. >> The script was originally edited on Windows with proper \r\n endings, > > It's worth noting that many Windows-based editors and interpreters are > quite happy with \n line endings.

ANNOUNCE: pyparsing 1.5.7/2.0.0

2012-12-16 Thread Paul McGuire
With the release of version 2.0.0/1.5.7, pyparsing has now officially switched to Python 3.x support as its default installation environment. Python 2.x users can install the latest 1.5.7 release. (If you're using easy_install, do "easy_install pyparsing==1.5.7".) I'm taking this opportunity to

Re: Iterating over files of a huge directory

2012-12-17 Thread Paul Rudin
Chris Angelico writes: > On Tue, Dec 18, 2012 at 2:28 AM, Gilles Lenfant > wrote: >> Hi, >> >> I have googled but did not find an efficient solution to my >> problem. My customer provides a directory with a hge list of >> files (flat, potentially 10+) and I cannot reasonably use >> os.li

Re: Delete dict and subdict items of some name

2012-12-17 Thread Paul Rubin
Gnarlodious writes: > Hello. What I want to do is delete every dictionary key/value of the > name 'Favicon' regardless of depth in subdicts, of which there are > many. What is the best way to do it? Untested: def unfav(x): if type(x) != dict: return x return dict((k,unfav(v)) for k,v in x.it

Re: Numpy outlier removal

2013-01-06 Thread Paul Simon
g-standard-deviations > > > > -- > Steven If you suspect that the data may not be normal you might look at exploratory data analysis, see Tukey. It's descriptive rather than analytic, treats outliers respectfully, uses median rather than mean, and is very visual. Wherever I analyzed data both gaussian and with EDA, EDA always won. Paul -- http://mail.python.org/mailman/listinfo/python-list

unit selection problem

2013-01-14 Thread Paul Pittlerson
Unit selection doesn't work properly. Pygames event.pos returns a tuple of the coords within the current window, so it's not possible to select units outside of the top left corner. from pygamehelper import * from pygame import * from pygame.locals import * from vec2d import * from math import e

Re: Iterate from 2nd element of a huge list

2012-02-01 Thread Paul Rubin
Paulo da Silva writes: > process1(mylist[0]) > for el in mylist[1:]: > process2(el) > > This way mylist is almost duplicated, isn't it? I think it's cleanest to use itertools.islice to get the big sublist (not tested): from itertools import islice process1 (mylist[0]) for el in i

Registry entries set up by the Windows installer

2012-02-01 Thread Paul Moore
hich is a big plus on Windows 7, as it avoids endless elevation requests :-)) but that doesn't work completely cleanly with my all-users install. (Note: I'm not entirely sure that changing global settings like this to patch a per-console virtualenv is a good idea, but I'd like t

Re: Registry entries set up by the Windows installer

2012-02-02 Thread Paul Moore
ck them, and put the various bits in place manually... The other reason for changing the registry is the .py file associations. But as I said, I'm not yet convinced that this is a good idea in any case... Thanks for the help, Paul. -- http://mail.python.org/mailman/listinfo/python-list

Windows: How do I copy a custom build of Python into a directory structure matching an MSI install?

2012-02-02 Thread Paul Moore
ff around till it works. I might even be able to decipher msi.py and work out how the installer lays things out. But I'm lazy, and I'm hoping that someone already knows and can tell me, or point me to some documentation that I've missed. In return, I'm willing to share the script

Re: SnakeScript? (CoffeeScript for Python)

2012-02-02 Thread Paul Moore
r Python, where the syntax is already clean and simple? :-) Paul. -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] cdecimal-2.3 released

2012-02-02 Thread Paul Rubin
Stefan Krah writes: > cdecimal is a complete implementation of IBM's General Decimal Arithmetic > Specification. With the appropriate context parameters, cdecimal will also > conform to the IEEE 754-2008 Standard for Floating-Point Arithmetic. Cool. I wonder when we'll start seeing this in non-I

Re: Killing threads, and os.system()

2012-02-03 Thread Paul Rubin
John Nagle writes: > QNX's message passing looks more like a subroutine call than an > I/O operation, How do they enforce process isolation, or do they decide they don't need to? -- http://mail.python.org/mailman/listinfo/python-list

Fabric Engine + Python benchmarks

2012-02-10 Thread Fabric Paul
t your feedback. Kind regards, Paul (I work at Fabric) -- http://mail.python.org/mailman/listinfo/python-list

Re: Fabric Engine + Python benchmarks

2012-02-10 Thread Fabric Paul
On Feb 10, 12:21 pm, Stefan Behnel wrote: > Fabric Paul, 10.02.2012 17:04: > > > Fabric is a high-performance multi-threading engine that > > integrates with dynamic languages. > > Hmm, first of all, fabric is a tool for automating > admin/deployment/whatever tasks:

Re: Fabric Engine + Python benchmarks

2012-02-10 Thread Paul Rubin
Fabric Paul writes: > Hi Stefan - Thanks for the heads up. Fabric Engine has been going for > about 2 years now. Registered company etc. I'll be sure to refer to it > as Fabric Engine so there's no confusion. We were unaware there was a > python tool called Fabric. There w

Re: Postpone evaluation of argument

2012-02-10 Thread Paul Rubin
Righard van Roy writes: > I want to add an item to a list, except if the evaluation of that item > results in an exception. This may be overkill and probably slow, but perhaps most in the spirit that you're asking. from itertools import chain def r(x): if x > 3: rais

Re: [semi OT]: Smartphones and Python?

2012-02-15 Thread Paul Rubin
Martin Schöön writes: > A very quick internet search indicated that this should be no big > deal if I go for an Android-based phone. What about the alternatives? It works pretty well with Maemo, though phones with that are not so easy to find. My ex-officemate wrote some SL4A (Android) apps in P

Re: asynchronous downloading

2012-02-23 Thread Paul Rubin
Plumo writes: > What do you recommend? Threads. > And why is there poor support for asynchronous execution? The freenode #python crowd seems to hate threads and prefer twisted, which seems to have the features you want and probably handles very large #'s of connections better than POSIX thread

Re: A quirk/gotcha of for i, x in enumerate(seq) when seq is empty

2012-02-23 Thread Paul Rubin
Alex Willmer writes: > i = 0 > for x in seq: > # do stuff > i += 1 > print 'Processed %i records' % i > > Just thought it worth mentioning, curious to hear other options/ > improvements/corrections. Stephen gave an alternate patch, but you are right, it is a pitfall that can be easy to mi

Re: A 'Python like' language

2012-03-02 Thread Paul Rubin
dreamingforw...@gmail.com writes: >> hanging out on the Prothon list now and then, at least until we get >> the core language sorted out? > > Haha, a little late, but consider this a restart. It wasn't til I saw the word "Prothon" that I scrolled back and saw you were responding to a thread from 2

Re: What's the best way to write this regular expression?

2012-03-07 Thread Paul Rubin
John Salerno writes: > The Beautiful Soup 4 documentation was very clear, and BS4 itself is > so simple and Pythonic. And best of all, since version 4 no longer > does the parsing itself, you can choose your own parser, and it works > with lxml, so I'll still be using lxml, but with a nice, clean

Re: html5lib not thread safe. Is the Python SAX library thread-safe?

2012-03-12 Thread Paul Rubin
John Nagle writes: >But html5lib calls the XML SAX parser. Is that thread-safe? > Or is there more trouble down at the bottom? According to http://xmlbench.sourceforge.net/results/features200303/index.html libxml and expat both purport to be thread-safe. I've used the python expat librar

Re: Software Engineer -

2012-03-13 Thread Paul Rudin
Chris Withers writes: > On 11/03/2012 09:00, Blue Line Talent wrote: >> Blue Line Talent is looking for a mid-level software engineer with >> experience in a combination of > > Please don't spam this list with jobs, use the Python job board instead: > > http://www.python.org/community/jobs/ Just

Fabric Engine v1.0 released under AGPL

2012-03-20 Thread Fabric Paul
abricengine.com/2012/03/pyqt-framework-for-fabric-engine/ - email b...@fabricengine.com if you'd like to take part in the testing program. Thanks for your time, Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Fabric Engine v1.0 released under AGPL

2012-03-20 Thread Paul Doyle
) - Fabric is a high-performance framework - http://documentation.fabric-engine.com/latest/FabricEngine-Overview.html - we haven't benchmarked against R, MatLab etc but we run at the same speed as multi-threaded compiled code (since that's essentially what we're doing). Hope that h

Re: Threads on google groups not on gmane?

2012-04-02 Thread Paul Rubin
Robert Kern writes: > I also don't see these on GMane. It's possible that they are getting > caught in one of GMane's several levels of spam filtering. I'm seeing some weird issues where google groups posts on another newsgroup aren't making it to the non-google nntp server that I use. The parano

What is the best way to freeze a Python 3 app (Windows)?

2012-04-03 Thread Paul Moore
't (really) care about: - Stripping ununsed modules (although I'd like to omit "big" parts of the stdlib that aren't used - tkinter and test come to mind) - Space (the full stdlib is only 30M including pyc files, after all) Any suggestions gratefully accepted :-) Paul. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python randomly exits with Linux OS error -9 or -15

2012-04-10 Thread Paul Rubin
Janis writes: > I have confirmed that the signal involved is SIGKILL and, yes, > apparently OS is simply running out of memory. This is the notorious OOM killer, sigh. There are some links from http://en.wikipedia.org/wiki/OOM_Killer -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Gotcha's?

2012-04-15 Thread Paul Rubin
Steven D'Aprano writes: >> Running both Python 2 and Python 3 on Windows is painful where it >> doesn't need to be. > And how is that different from any other two versions of Python? 1. The backwards incompatibility between 2 and 3 is much more serious than between 2.x and 2.(x-1). 2. There is

Re: Python Gotcha's?

2012-04-16 Thread Paul Rubin
rusi writes: > Costs can be single-cased (s) -- basically those that can be handled > by a 2to3 module You can't really 2to3 a large python application and expect to then just start using it without further attention or testing. You may have to do a fairly complete (i.e. expensive) QA and qualif

Re: why () is () and [] is [] work in other way?

2012-04-23 Thread Paul Rubin
Kiuhnm writes: > I can't think of a single case where 'is' is ill-defined. If I can't predict the output of print (20+30 is 30+20) # check whether addition is commutative print (20*30 is 30*20) # check whether multiplication is commutative by just reading the language definition and

Re: Half-baked idea: list comprehensions with "while"

2012-04-26 Thread Paul Rubin
Roy Smith writes: > x = [a for a in iterable while a] from itertools import takewhile x = takewhile(bool, a) -- http://mail.python.org/mailman/listinfo/python-list

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Paul Rubin
Nobody writes: > All practical languages have some implementation-defined behaviour, often > far more problematic than Python's. The usual reason for accepting implementation-defined behavior is to enable low-level efficiency hacks written for specific machines. C and C++ are used for that sort

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Paul Rubin
Adam Skutt writes: >> harder to use, and far, far less popular. > Alas, these two are probably true. Haskell is kind of abstruse and has a notoriously steep learning curve, as it's mostly meant as a research testbed and as a playground for language geeks. ML/OCaml is by all accounts much easier,

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Paul Rubin
Steven D'Aprano writes: > I'm seeing code generated by the Haskell GHC compiler being 2-4 times > slower than code from the C gcc compiler, and on average using 2-3 times > as much memory (and as much as 7 times). Alioth isn't such a great comparison, because on the one hand you get very carefu

Re: hex to bin 16 bit word

2012-04-27 Thread Paul Rubin
python writes: > What to decode hex '0xC0A8' and return signed short int. Is this right? n = int('0xC0A8', 16) if n >= 0x: n -= 0x1 -- http://mail.python.org/mailman/listinfo/python-list

Re: hex to bin 16 bit word

2012-04-27 Thread Paul Rubin
Steven D'Aprano writes: >> Is this right? >> >> n = int('0xC0A8', 16) >> if n >= 0x: >>n -= 0x1 > No. Oops, I meant n >= 0x7fff. Checking the sign bit. Grant Edwards writes: > Yes, as long as the input value doesn't exceed 0x1. This is > probably better: > > n

Re: CPython thread starvation

2012-04-27 Thread Paul Rubin
John Nagle writes: >I know that the CPython thread dispatcher sucks, but I didn't > realize it sucked that bad. Is there a preference for running > threads at the head of the list (like UNIX, circa 1979) or > something like that? I think it's left up to the OS thread scheduler, Windows in yo

Re: CPython thread starvation

2012-04-27 Thread Paul Rubin
John Nagle writes: > The code that stored them looked them up with "getaddrinfo()", and > did this while a lock was set. Don't do that!! >Added a local cache in the program to prevent this. > Performance much improved. Better to release the lock while the getaddrinfo is running, if you can

Re: CPython thread starvation

2012-04-27 Thread Paul Rubin
John Nagle writes: >I may do that to prevent the stall. But the real problem was all > those DNS requests. Parallizing them wouldn't help much when it took > hours to grind through them all. True dat. But building a DNS cache into the application seems like a kludge. Unless the number of

Re: CPython thread starvation

2012-04-28 Thread Paul Rubin
Roy Smith writes: > I agree that application-level name cacheing is "wrong", but sometimes > doing it the wrong way just makes sense. I could whip up a simple > cacheing wrapper around getaddrinfo() in 5 minutes. Depending on the > environment (both technology and bureaucracy), getting a cach

Re: numpy (matrix solver) - python vs. matlab

2012-04-29 Thread Paul Rubin
someone writes: >> A is not just close to singular: it's singular! > Ok. When do you define it to be singular, btw? Singular means the determinant is zero, i.e. the rows or columns are not linearly independent. Let's give names to the three rows: a = [1 2 3]; b = [11 12 13]; c = [21 22 23].

Re: numpy (matrix solver) - python vs. matlab

2012-05-01 Thread Paul Rubin
someone writes: > Actually I know some... I just didn't think so much about, before > writing the question this as I should, I know theres also something > like singular value decomposition that I think can help solve > otherwise illposed problems, You will probably get better advice if you are a

Re: numpy (matrix solver) - python vs. matlab

2012-05-02 Thread Paul Rubin
"Russ P." writes: > The SVD can be thought of as factoring any linear transformation into > a rotation, then a scaling, followed by another rotation. Ah yes, my description was backwards, sorry. -- http://mail.python.org/mailman/listinfo/python-list

Re: numpy (matrix solver) - python vs. matlab

2012-05-02 Thread Paul Rubin
someone writes: >> You will probably get better advice if you are able to describe what >> problem (ill-posed or otherwise) you are actually trying to solve. SVD > I don't understand what else I should write. I gave the singular > matrix and that's it. Nothing more is to say about this problem,

Re: key/value store optimized for disk storage

2012-05-02 Thread Paul Rubin
Steve Howell writes: > keys are file paths > directories are 2 levels deep (30 dirs w/100k files each) > values are file contents > The current solution isn't horrible, Yes it is ;-) > As I mention up top, I'm mostly hoping folks can point me toward > sources they trust, whether it be ot

Re: key/value store optimized for disk storage

2012-05-02 Thread Paul Rubin
Steve Howell writes: > Thanks. That's definitely in the spirit of what I'm looking for, > although the non-64 bit version is obviously geared toward a slightly > smaller data set. My reading of cdb is that it has essentially 64k > hash buckets, so for 3 million keys, you're still scanning throug

Re: key/value store optimized for disk storage

2012-05-02 Thread Paul Rubin
Steve Howell writes: > Doesn't cdb do at least one disk seek as well? In the diagram on this > page, it seems you would need to do a seek based on the value of the > initial pointer (from the 256 possible values): Yes, of course it has to seek if there is too much data to fit in memory. All I'm

Re: key/value store optimized for disk storage

2012-05-02 Thread Paul Rubin
Paul Rubin writes: >looking at the spec more closely, there are 256 hash tables.. ... You know, there is a much simpler way to do this, if you can afford to use a few hundred MB of memory and you don't mind some load time when the program first starts. Just dump all the data sequentiall

Re: key/value store optimized for disk storage

2012-05-03 Thread Paul Rubin
Steve Howell writes: > My test was to write roughly 4GB of data, with 2 million keys of 2k > bytes each. If the records are something like english text, you can compress them with zlib and get some compression gain by pre-initializing a zlib dictionary from a fixed english corpus, then cloning it

Re: key/value store optimized for disk storage

2012-05-03 Thread Paul Rubin
Steve Howell writes: > Sounds like a useful technique. The text snippets that I'm > compressing are indeed mostly English words, and 7-bit ascii, so it > would be practical to use a compression library that just uses the > same good-enough encodings every time, so that you don't have to write > t

Re: key/value store optimized for disk storage

2012-05-04 Thread Paul Rubin
Steve Howell writes: > compressor = zlib.compressobj() > s = compressor.compress("foobar") > s += compressor.flush(zlib.Z_SYNC_FLUSH) > > s_start = s > compressor2 = compressor.copy() I think you also want to make a decompressor here, and initialize it with s and then clone it

Re: key/value store optimized for disk storage

2012-05-04 Thread Paul Rubin
Steve Howell writes: > Makes sense. I believe I got that part correct: > > https://github.com/showell/KeyValue/blob/master/salted_compressor.py The API looks nice, but your compress method makes no sense. Why do you include s.prefix in s and then strip it off? Why do you save the prefix and

Re: key/value store optimized for disk storage

2012-05-04 Thread Paul Rubin
Steve Howell writes: >> You should be able to just get the incremental bit. > This is fixed now. Nice. > It it's in the header, wouldn't it be part of the output that comes > before Z_SYNC_FLUSH? Hmm, maybe you are right. My version was several years ago and I don't remember it well, but I hal

Re: Creating a directory structure and modifying files automatically in Python

2012-05-06 Thread Paul Rubin
Javier writes: > Or not... Using directories may be a way to do rapid prototyping, and > check quickly how things are going internally, without needing to resort > to complex database interfaces. dbm and shelve are extremely simple to use. Using the file system for a million item db is ridiculou

Re: key/value store optimized for disk storage

2012-05-06 Thread Paul Rubin
John Nagle writes: >That's awful. There's no point in compressing six characters > with zlib. Zlib has a minimum overhead of 11 bytes. You just > made the data bigger. This hack is about avoiding the initialization overhead--do you really get 11 bytes after every SYNC_FLUSH? I do remember

Re: How do I run a python program from an internet address?

2012-05-09 Thread Paul Rubin
Albert writes: > I have a small text based python program that I want to make available > to people who might be behind a firewall or can't install python on > their office computers, but can access the internet. What kind of people? I.e. is it something you're doing for work, where the users

Re: Real time event accuracy

2012-05-09 Thread Paul Rubin
Tobiah writes: > I'd like to send MIDI events from python to another > program. I'd like advice as to how to accurately > time the events. I'll have a list of floating point > start times in seconds for the events, and I'd like to send them > off as close to the correct time as possible. I don'

Instrumenting a class to see how it is used

2012-05-14 Thread Paul Moore
estions, I'd be interested. Thanks, Paul. -- http://mail.python.org/mailman/listinfo/python-list

Re: serial module

2012-05-18 Thread Paul Simon
(serial.py?) with good results. Paul Simon "Ron Eggler" wrote in message news:jp6gcj$1rij$1...@adenine.netfront.net... > Hoi, > > I'm trying to connect to a serial port and always get the error > "serial.serialutil.SerialException: Port is already open." w

Re: serial module

2012-05-22 Thread Paul Rubin
John Nagle writes: >If a device is registered as /dev/ttyUSBnn, one would hope that > the Linux USB insertion event handler, which assigns that name, > determined that the device was a serial port emulator. Unfortunately, > the USB standard device classes > (http://www.usb.org/developers/defi

Re: Help doing it the "python way"

2012-05-24 Thread Paul Rubin
Scott Siegler writes: > is there a way to do something like: >[(x,y-1), (x,y+1) for zzz in coord_list] > or something along those lines? You should read the docs of the itertools module on general principles, since they are very enlightening in many ways. Your particular problem can be hand

Re: Help doing it the "python way"

2012-05-24 Thread Paul Rubin
Paul Rubin writes: > new_list = chain( ((x,y-1), (x,y+1)) for x,y in coord_list ) Sorry: new_list = list(chain( ((x,y-1), (x,y+1)) for x,y in coord_list)) -- http://mail.python.org/mailman/listinfo/python-list

Re: Email Id Verification

2012-05-24 Thread Paul Rubin
Steven D'Aprano writes: > Why do you want to write buggy code that makes your users hate your > program? ... > The only way to validate an email address is to ACTUALLY SEND AN EMAIL TO > IT. Of course spamming people will make them hate you even more. Insisting that people give you a valid em

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