Re: John Carmack glorifying functional programing in 3k words

2012-05-03 Thread Pascal J. Bourguignon
Tim Bradshaw writes: > On 2012-05-02 14:44:36 +, jaialai.technol...@gmail.com said: > >> He may be nuts > > But he's right: programmers are pretty much fuckwits[*]: if you think > that's not true you are not old enough. > > [*] including me, especially. You need to watch: http://blog.ted.co

Re: key/value store optimized for disk storage

2012-05-03 Thread Steve Howell
On May 2, 11:48 pm, Paul Rubin wrote: > 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 st

Re: key/value store optimized for disk storage

2012-05-03 Thread Kiuhnm
On 5/3/2012 10:42, Steve Howell wrote: On May 2, 11:48 pm, Paul Rubin wrote: 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 loa

What is the use of python.cache_ubuntu?

2012-05-03 Thread Fayaz Yusuf Khan
My Ubuntu 11.04 server ran out of inodes due to too many files in '/tmp/python.cache_ubuntu'. Does anyone know what it does? -- Cloud architect and hacker, Dexetra, India fayaz.yusuf.khan_AT_gmail_DOT_com fayaz_AT_dexetra_DOT_com +91-9746-830-823 -- http://mail.python.org/mailman/listinfo/python

docstrings for data fields

2012-05-03 Thread Ulrich Eckhardt
Hi! My class Foo exports a constant, accessible as Foo.MAX_VALUE. Now, with functions I would simply add a docstring explaining the meaning of this, but how do I do that for a non-function member? Note also that ideally, this constant wouldn't show up inside instances of the class but only inside

Re: try/except in a loop

2012-05-03 Thread Jean-Michel Pichavant
Chris Kaynor wrote: On Wed, May 2, 2012 at 12:51 PM, J. Mwebaze wrote: I have multiple objects, where any of them can serve my purpose.. However some objects might not have some dependencies. I can not tell before hand if the all the dependencies exsit. What i want to is begin processing fro

Re: try/except in a loop

2012-05-03 Thread Peter Otten
Jean-Michel Pichavant wrote: > Chris Kaynor wrote: >> On Wed, May 2, 2012 at 12:51 PM, J. Mwebaze wrote: >> >>> I have multiple objects, where any of them can serve my purpose.. >>> However some objects might not have some dependencies. I can not tell >>> before hand if the all the dependencie

Re: try/except in a loop

2012-05-03 Thread Jean-Michel Pichavant
Peter Otten wrote: Jean-Michel Pichavant wrote: Chris Kaynor wrote: On Wed, May 2, 2012 at 12:51 PM, J. Mwebaze wrote: I have multiple objects, where any of them can serve my purpose.. However some objects might not have some dependencies. I can not tell before hand if the

Re: Create directories and modify files with Python

2012-05-03 Thread deltaquattro
I'm leaving the thread because I cannot read any posts, apart from Irmen's. Anyway, I would like to publicly thank all who contributed, in particular rurpy who solved my problem (and kindly sent me a personal email, so that I could see his/her post :) Best Regards Sergio Rossi -- http://mail.

c-based version of pyPdf?

2012-05-03 Thread Chris Curvey
I'm a long-time user of the pyPdf library, but now I'm having to work with bigger volumes -- larger PDFs and thousands of them at a shot. So performance is starting to become a problem. Does anyone know of an analogue to pyPdf that is faster? (Maybe something based on C with Python bindings?

Re: docstrings for data fields

2012-05-03 Thread Jean-Michel Pichavant
Ulrich Eckhardt wrote: Hi! My class Foo exports a constant, accessible as Foo.MAX_VALUE. Now, with functions I would simply add a docstring explaining the meaning of this, but how do I do that for a non-function member? Note also that ideally, this constant wouldn't show up inside instances of t

Re: pyjamas / pyjs

2012-05-03 Thread Temia Eszteri
>Anyone else following the apparent hijack of the pyjs project from its >lead developer? Not beyond what the lead developer has been posting on the newsgroup, no. Still a damn shame, though. What happens when you have an unresolvable ideological seperation like that is you branch, not take over.

Re: c-based version of pyPdf?

2012-05-03 Thread Kushal Kumaran
On Thu, May 3, 2012 at 8:23 PM, Chris Curvey wrote: > I'm a long-time user of the pyPdf library, but now I'm having to work with > bigger volumes -- larger PDFs and thousands of them at a shot.  So > performance is starting to become a problem. > > Does anyone know of an analogue to pyPdf that i

Re: pyjamas / pyjs

2012-05-03 Thread Ian Kelly
On Thu, May 3, 2012 at 5:52 AM, alex23 wrote: > Anyone else following the apparent hijack of the pyjs project from its > lead developer? I've been following it but quietly since I don't use pyjs. It surprises me that nobody is talking much about it outside of the thread on pyjamas-dev. Seems to

Problems to list *all* mountedwindows partitions

2012-05-03 Thread joblack
I do have a script which shows me the mounted partitions: c = wmi.WMI ('localhost') for disk in c.Win32_DiskPartition (DriveType=3): diskspace = int(disk.FreeSpace)/100 if diskspace < mfspace: trigger = True ldisks.append(disk.Name +'\\ '+str('{0:,}'.format(diskspace).r

Algorithms in Python, cont'd

2012-05-03 Thread Antti J Ylikoski
I wrote here about some straightforward ways to program D. E. Knuth in Python, and John Nagle answered that the value of Knuth's book series to the programmer has been significantly diminished by the fact that many functionalities such as sorting and hashing have either been built in the Python la

Re: docstrings for data fields

2012-05-03 Thread mblume
Am Thu, 03 May 2012 14:51:54 +0200 schrieb Ulrich Eckhardt: > Hi! > > My class Foo exports a constant, accessible as Foo.MAX_VALUE. Now, with > functions I would simply add a docstring explaining the meaning of this, > but how do I do that for a non-function member? Note also that ideally, > this

Re: syntax for code blocks

2012-05-03 Thread Kiuhnm
On 5/3/2012 2:20, alex23 wrote: On May 2, 8:52 pm, Kiuhnm wrote: func(some_args, locals()) I think that's very bad. It wouldn't be safe either. What about name clashing locals() is a dict. It's not injecting anything into func's scope other than a dict so there's not going to be any n

Re: syntax for code blocks

2012-05-03 Thread Temia Eszteri
> if only Python wasn't so rigid. what. You realize you'd have a little more luck with Python if you weren't wielding it like a cudgel in the examples you've posted here, right? Because it looks like you're treating the language as everything it isn't and nothing it is this whole time. No wonder

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

2012-05-03 Thread someone
On 05/02/2012 11:45 PM, Russ P. wrote: On May 2, 1:29 pm, someone wrote: If your data starts off with only 1 or 2 digits of accuracy, as in your example, then the result is meaningless -- the accuracy will be 2-2 digits, or 0 -- *no* digits in the answer can be trusted to be accurate. I just

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

2012-05-03 Thread Russ P.
On May 3, 10:30 am, someone wrote: > On 05/02/2012 11:45 PM, Russ P. wrote: > > > > > On May 2, 1:29 pm, someone  wrote: > > >>> If your data starts off with only 1 or 2 digits of accuracy, as in your > >>> example, then the result is meaningless -- the accuracy will be 2-2 > >>> digits, or 0 -- *

Re: syntax for code blocks

2012-05-03 Thread Ian Kelly
On Thu, May 3, 2012 at 10:17 AM, Kiuhnm wrote: > On 5/3/2012 2:20, alex23 wrote: >> >> On May 2, 8:52 pm, Kiuhnm  wrote:      func(some_args, locals()) >>> >>> >>> I think that's very bad. It wouldn't be safe either. What about name >>> clashing >> >> >> locals() is a dict. It's not inje

Lack of whitespace between contain operator ("in") and other expression tokens doesn't result in SyntaxError: bug or feature?

2012-05-03 Thread Garrett Cooper
Hi Python folks! I came across a piece of code kicking around a sourcebase that does something similar to the following: >>> START #!/usr/bin/env python import sys def foo(): bar = 'abcdefg' foo = [ 'a' ] # Should throw SyntaxError? for foo[0]in bar: sys.stdout.

Re: Lack of whitespace between contain operator ("in") and other expression tokens doesn't result in SyntaxError: bug or feature?

2012-05-03 Thread Ian Kelly
On Thu, May 3, 2012 at 12:49 PM, Garrett Cooper wrote: >    I was wondering whether this was a parser bug or feature (seems > like a bug, in particular because it implicitly encourages bad syntax, > but I could be wrong). The grammar notes (for 2.7 at least [1]) don't > seem to explicitly require

Re: Lack of whitespace between contain operator ("in") and other expression tokens doesn't result in SyntaxError: bug or feature?

2012-05-03 Thread Garrett Cooper
On Thu, May 3, 2012 at 12:03 PM, Ian Kelly wrote: > On Thu, May 3, 2012 at 12:49 PM, Garrett Cooper wrote: >>    I was wondering whether this was a parser bug or feature (seems >> like a bug, in particular because it implicitly encourages bad syntax, >> but I could be wrong). The grammar notes (f

"

2012-05-03 Thread John Nagle
An HTML page for a major site (http://www.chase.com) has some incorrect HTML. It contains

Immediate need: Python Developer position in Waukesha, Wisconsin, USA-12 months contract with direct client with very good pay rate!

2012-05-03 Thread Preeti Bhattad
Hi there, If you have USA work visa and if you reside in USA; please send the resume to pre...@groupwaremax.com or pnbhat...@gmail.com Title Python Developer for Test Development Location: Waukesha, WI (53188) Duration: 12 months Job Description • Proficient in Python scripting and Pyunit.

Immediate need: Python Developer position in Waukesha, Wisconsin, USA-12 months contract with direct client with very good pay rate!

2012-05-03 Thread Preeti Bhattad
Please send the resume to preeti at groupwaremax dot com or pnbhattad at gmail dot com Title Python Developer for Test Development Location: Waukesha, WI (53188) Duration: 12 months Job Description • Proficient in Python scripting and Pyunit. • Proficient in Python related packages k

RE: Lack of whitespace between contain operator ("in") and other expression tokens doesn't result in SyntaxError: bug or feature?

2012-05-03 Thread Prasad, Ramit
> > Sure.. it's just somewhat inconsistent with other expectations in > > other languages, and seems somewhat unpythonic. > > Never done FORTRAN, have you... Classic FORTRAN even allows > white-space INSIDE keywords. Java tends to ignore a lot of spaces as well...though not as much as c

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

2012-05-03 Thread someone
On 05/03/2012 07:55 PM, Russ P. wrote: On May 3, 10:30 am, someone wrote: On 05/02/2012 11:45 PM, Russ P. wrote: For any practical engineering or scientific work, I'd say that a condition number of 1e6 is very likely to be completely unacceptable. So how do you explain that the natural fre

Re: Lack of whitespace between contain operator ("in") and other expression tokens doesn't result in SyntaxError: bug or feature?

2012-05-03 Thread Dan Stromberg
On Thu, May 3, 2012 at 12:21 PM, Garrett Cooper wrote: > On Thu, May 3, 2012 at 12:03 PM, Ian Kelly wrote: > > On Thu, May 3, 2012 at 12:49 PM, Garrett Cooper > wrote: > >>I was wondering whether this was a parser bug or feature (seems > >> like a bug, in particular because it implicitly en

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

2012-05-03 Thread Russ P.
Yeah, I realized that I should rephrase my previous statement to something like this: For any *empirical* engineering or scientific work, I'd say that a condition number of 1e6 is likely to be unacceptable. I'd put finite elements into the category of theoretical and numerical rather than empiric

Re: "

2012-05-03 Thread Ian Kelly
On Thu, May 3, 2012 at 1:59 PM, John Nagle wrote: >  An HTML page for a major site (http://www.chase.com) has > some incorrect HTML.  It contains > >         > which is not valid HTML, XML, or SMGL.  However, most browsers > ignore it.  BeautifulSoup treats it as the start of a CDATA section, > an

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

2012-05-03 Thread someone
On 05/04/2012 12:58 AM, Russ P. wrote: Yeah, I realized that I should rephrase my previous statement to something like this: For any *empirical* engineering or scientific work, I'd say that a condition number of 1e6 is likely to be unacceptable. Still, I don't understand it. Do you have an exa

When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-03 Thread Peng Yu
Hi, list(a_set) When convert two sets with the same elements to two lists, are the lists always going to be the same (i.e., the elements in each list are ordered the same)? Is it documented anywhere? -- Regards, Peng -- http://mail.python.org/mailman/listinfo/python-list

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-03 Thread Dan Stromberg
If you need the same ordering in two lists, you really should sort the lists - though your comparison function need not be that traditional. You might be able to get away with not sorting sometimes, but on CPython upgrades or using different Python interpreters (Pypy, Jython), it's almost certain

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-03 Thread Tim Chase
On 05/03/12 19:36, Peng Yu wrote: > list(a_set) > > When convert two sets with the same elements to two lists, are the > lists always going to be the same (i.e., the elements in each list are > ordered the same)? Is it documented anywhere? Sets are defined as unordered which the documentation[1]

Re: key/value store optimized for disk storage

2012-05-03 Thread Miki Tebeka
> I'm looking for a fairly lightweight key/value store that works for > this type of problem: I'd start with a benchmark and try some of the things that are already in the standard library: - bsddb - sqlite3 (table of key, value, index key) - shelve (though I doubt this one) You might find that f

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-03 Thread Andrew Berg
On 5/3/2012 7:36 PM, Peng Yu wrote: > When convert two sets with the same elements to two lists, are the > lists always going to be the same (i.e., the elements in each list are > ordered the same)? Is it documented anywhere? Sets are by definition unordered, so depending on their order would not b

most efficient way of populating a combobox (in maya)

2012-05-03 Thread astan.chee Astan
Hi, I'm making a GUI in maya using python only and I'm trying to see which is more efficient. I'm trying to populate an optionMenuGrp / combo box whose contents come from os.listdir(folder). Now this is fine if the folder isn't that full but the folder has a few hundred items (almost in the thousan

Re: syntax for code blocks

2012-05-03 Thread alex23
On May 4, 2:17 am, Kiuhnm wrote: > On 5/3/2012 2:20, alex23 wrote: > > locals() is a dict. It's not injecting anything into func's scope > > other than a dict so there's not going to be any name clashes. If you > > don't want any of its content in your function's scope, just don't use > > that con

Re: key/value store optimized for disk storage

2012-05-03 Thread Steve Howell
On May 3, 1:42 am, Steve Howell wrote: > On May 2, 11:48 pm, Paul Rubin wrote: > > > 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 d

Re: most efficient way of populating a combobox (in maya)

2012-05-03 Thread Steven D'Aprano
On Thu, 03 May 2012 19:07:51 -0700, astan.chee Astan wrote: > Hi, > I'm making a GUI in maya using python only and I'm trying to see which > is more efficient. I'm trying to populate an optionMenuGrp / combo box > whose contents come from os.listdir(folder). Now this is fine if the > folder isn't

Re: syntax for code blocks

2012-05-03 Thread Steven D'Aprano
On Thu, 03 May 2012 19:44:57 -0700, alex23 wrote: [snip] > My version was: > > def a(): pass > def b(): pass > > func_packet = locals() > func(arg, func_packet) > > Now, please explain how that produces name-clashes that your version > does not. I too am uncomfortable about pas

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

2012-05-03 Thread Steven D'Aprano
On Thu, 03 May 2012 19:30:35 +0200, someone wrote: > On 05/02/2012 11:45 PM, Russ P. wrote: >> On May 2, 1:29 pm, someone wrote: >> If your data starts off with only 1 or 2 digits of accuracy, as in your example, then the result is meaningless -- the accuracy will be 2-2 digits, or

Re: syntax for code blocks

2012-05-03 Thread Chris Angelico
On Fri, May 4, 2012 at 12:44 PM, alex23 wrote: > On May 4, 2:17 am, Kiuhnm wrote: >> I would've come up with something even better if only Python wasn't so rigid. > > The inability for people to add 6 billion mini-DSLs to solve any > stupid problem _is a good thing_. It makes Python consistent an

PyTextile Question

2012-05-03 Thread Josh English
I am working with an XML database and have large chunks of text in certain child and grandchildren nodes. Because I consider well-formed XML to wrap at 70 characters and indent children, I end up with a lot of extra white space in the node.text string. (I parse with ElementTree.) I thought abo

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-03 Thread Terry Reedy
On 5/3/2012 8:36 PM, Peng Yu wrote: Hi, list(a_set) When convert two sets with the same elements to two lists, are the lists always going to be the same (i.e., the elements in each list are ordered the same)? Is it documented anywhere? "A set object is an unordered collection of distinct hash

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

2012-05-03 Thread Russ P.
On May 3, 4:59 pm, someone wrote: > On 05/04/2012 12:58 AM, Russ P. wrote: > > > Yeah, I realized that I should rephrase my previous statement to > > something like this: > > > For any *empirical* engineering or scientific work, I'd say that a > > condition number of 1e6 is likely to be unacceptab

Re: syntax for code blocks

2012-05-03 Thread alex23
On May 4, 1:47 pm, Steven D'Aprano wrote: > I too am uncomfortable about passing locals() to a function, but not > because of imaginary "name clashes". The problem as I see it is that this > will give the function access to things the function has no need for. And I would never use it in the real

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: pyjamas / pyjs

2012-05-03 Thread John O'Hagan
On Thu, 3 May 2012 04:52:36 -0700 (PDT) alex23 wrote: > Anyone else following the apparent hijack of the pyjs project from its > lead developer? > -- Just read the thread on pyjamas-dev. Even without knowing anything about the lead-up to the coup, its leader's linguistic contortions trying to j

Re: key/value store optimized for disk storage

2012-05-03 Thread Steve Howell
On May 3, 9:38 pm, Paul Rubin wrote: > 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 dict

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: syntax for code blocks

2012-05-03 Thread Ben Finney
alex23 writes: > The examples here are a wonder to behold as well: > http://mtomassoli.wordpress.com/2012/04/20/code-blocks-in-python/ Wow. “What really happens is that rewrite rewrites the code, executes it and quits.” Please keep this far away from anything resembling Python. -- \ “I

Re: key/value store optimized for disk storage

2012-05-03 Thread Steve Howell
On May 3, 11:03 pm, Paul Rubin wrote: > 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 encoding

[image-SIG] img.show() does not seem to work.

2012-05-03 Thread Neru Yumekui
I am trying to get Image.show() to work, but seem to struggle with it. Thus far I have been using PIL on Windows, and it has worked fine and all - But I recently installed it on a Linux-machine, where img.show does not seem to work (All other features apart from screengrab seems to work well).

python sandbox question

2012-05-03 Thread viral shah
Hi Can anyone answer these two questions : I have two questions regarding Pysandbox: 1.) How do I achieve the functionality of eval? I understand sandbox.execute() is equivalent to exec, but I can't find anything such that if the code entered were 2 + 2, then it would return 4, or something to t