tiff/pbm in pyplot (ubuntu)

2011-10-19 Thread Hans Georg Schaathun
Does anyone know how to get support for tiff/pbm in pyplot on Ubuntu (11.04)? This used to work for me, on some system, but when I attempt to regenerate my TIFF files on a new system, it all crashes. The error message is clear; TIFF and PBM are not supported, and the exception occurs in a call

Re: English Idiom in Unix: Directory Recursively

2011-05-20 Thread Hans Georg Schaathun
On 20 May 2011 06:55:35 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : On Thu, 19 May 2011 22:13:14 -0700, rusi wrote: : : [I agree with you Xah that recursion is a technical word that should not : be foisted onto lay users.] : : I think that is a patronizing remark

Re: obviscating python code for distribution

2011-05-20 Thread Hans Georg Schaathun
On 20 May 2011 07:04:27 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : On Fri, 20 May 2011 05:48:50 +0100, Hans Georg Schaathun wrote: : : Either way, the assumption that your system will not be handled by : idiots is only reasonable if you yourself is the only user

Re: obviscating python code for distribution

2011-05-19 Thread Hans Georg Schaathun
On 19 May 2011 08:47:28 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : The real barrier to cracking Oyster cards is not that the source code is : unavailable, but that the intersection of the set of those who know how : to break encryption, and the set of those who want

Re: obviscating python code for distribution

2011-05-19 Thread Hans Georg Schaathun
On Thu, 19 May 2011 10:23:47 -0700, geremy condra debat...@gmail.com wrote: : Let me get this straight: your argument is that operating *systems* : aren't systems? You referred to the kernel and not the system. The complexities of the two are hardly comparable. There probably are different

Re: obviscating python code for distribution

2011-05-19 Thread Hans Georg Schaathun
On Thu, 19 May 2011 17:56:12 -0700, geremy condra debat...@gmail.com wrote: : TL;DR version: large systems have indeed been verified for their : security properties. : (...) : Yup. Nothing is safe from idiots. The difficult part is mapping those properties to actual requirements and threat

Re: English Idiom in Unix: Directory Recursively

2011-05-19 Thread Hans Georg Schaathun
On Thu, 19 May 2011 23:21:30 +0200, Rikishi42 skunkwo...@rikishi42.net wrote: : On 2011-05-18, Hans Georg Schaathun h...@schaathun.net wrote: : Now Mac OS X has maintained the folder concept of older mac generations, : and Windows has cloned it. They do not want the user to understand

Re: obviscating python code for distribution

2011-05-18 Thread Hans Georg Schaathun
On Mon, 16 May 2011 23:42:40 +0100, Rhodri James rho...@wildebst.demon.co.uk wrote: : ...which is, of course, not exactly secure either. A sufficiently : determined hacker won't have much trouble disassembling a shared library : even if you do strip out all the debug information. By

Re: English Idiom in Unix: Directory Recursively

2011-05-18 Thread Hans Georg Schaathun
On Tue, 17 May 2011 15:26:42 -0700 (PDT), Xah Lee xah...@gmail.com wrote: : If you look at Windows or Mac OS X world, i don't think they ever : refer to dealing with whole dir as “recursive” in user interface. That's purely due to a difference in the level of abstraction. Mac OS introduced

Re: English Idiom in Unix: Directory Recursively

2011-05-18 Thread Hans Georg Schaathun
[Followup-To: header set to comp.lang.python.] On 17 May 2011 23:42:20 -0700, Thomas A. Russ t...@sevak.isi.edu wrote: : Tree walks are the canonical example of what can't be done in an : iterative fashion without the addition of an explicitly managed stack Of course you can do it. It isn't

Re: obviscating python code for distribution

2011-05-18 Thread Hans Georg Schaathun
On Wed, 18 May 2011 09:54:30 -0700, geremy condra debat...@gmail.com wrote: : On Wed, May 18, 2011 at 12:36 AM, Hans Georg Schaathun h...@schaathun.net wrote: : But then, nothing is secure in any absolute sense. : : If you're talking security and not philosophy, there is such a thing

Re: English Idiom in Unix: Directory Recursively

2011-05-18 Thread Hans Georg Schaathun
[Followup-To: header set to comp.lang.python.] On 18 May 2011 09:16:26 -0700, Thomas A. Russ t...@sevak.isi.edu wrote: : Well, unless you have a tree with backpointers, you have to keep the : entire parent chain of nodes visited. Otherwise, you won't be able to : find the parent node when

Re: English Idiom in Unix: Directory Recursively

2011-05-18 Thread Hans Georg Schaathun
[Followup-To: header set to comp.lang.python.] On Wed, 18 May 2011 20:20:01 +0200, Raymond Wiker raw@RAWMBP-2.local wrote: : I don't think anybody mentioned *binary* trees. The context was : directory traversal, in which case you would have nodes with an : arbitrary (almost) number of

Re: obviscating python code for distribution

2011-05-18 Thread Hans Georg Schaathun
On Wed, 18 May 2011 12:07:49 -0700, geremy condra debat...@gmail.com wrote: : I was playing around with an HSM the other day that had originally : targeted FIPS 140-3 level 5, complete with formal verification models : and active side-channel countermeasures. I'm quite confident that it :

Re: English Idiom in Unix: Directory Recursively

2011-05-18 Thread Hans Georg Schaathun
[Followup-To: header set to comp.lang.python.] On Wed, 18 May 2011 21:09:15 +0200, Raymond Wiker raw@RAWMBP-2.local wrote: : In the sense that the tree itself is a stack, yes. But if we : consider the tree (or one of its branches) to be a stack, then : the original claim becomes a tautology.

Re: English Idiom in Unix: Directory Recursively

2011-05-18 Thread Hans Georg Schaathun
[Followup-To: header set to comp.lang.python.] On Wed, 18 May 2011 22:40:28 +0200, Raymond Wiker raw@RAWMBP-2.local wrote: : I said tree operations, not tree walks. A tree operation might : involve several tree walks. OK. The original claim under dispute regarded tree walks. :

Re: obviscating python code for distribution

2011-05-18 Thread Hans Georg Schaathun
On Wed, 18 May 2011 14:34:46 -0700, geremy condra debat...@gmail.com wrote: : Systems can be designed that are absolutely secure under reasonable : assumptions. The fact that it has assumptions does not make your : statement true. : (...) : I can't tell if you're trying to play word games

Re: checking if a list is empty

2011-05-13 Thread Hans Georg Schaathun
On Thu, 12 May 2011 23:20:20 +1000, Chris Angelico ros...@gmail.com wrote: : Writing a program requires expertise both in programming and in the : purpose for which it's being written. Ultimately, a programmer is a : translator; without proper comprehension of the material he's :

Re: checking if a list is empty

2011-05-12 Thread Hans Georg Schaathun
On 11 May 2011 21:47:27 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : On Wed, 11 May 2011 20:13:35 +0100, Hans Georg Schaathun wrote: : One principle of object oriented programming is to bestow the objects : with properties reflecting known properties from the domain

Re: checking if a list is empty

2011-05-12 Thread Hans Georg Schaathun
On Wed, 11 May 2011 20:16:01 -0700 (PDT), alex23 wuwe...@gmail.com wrote: : Hans Georg Schaathun h...@schaathun.net wrote: : Revolutionary indeed, so why don't we exploit the revolution : and write the programs to be as accessible as possible? : : Where do you draw the line, though? I said

Re: checking if a list is empty

2011-05-12 Thread Hans Georg Schaathun
On Thu, 12 May 2011 17:44:07 +1200, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: : Roy Smith wrote: : Hans Georg Schaathun h...@schaathun.net wrote: : If both are numbers, they are converted to a common type. Otherwise, : objects of different types always compare unequal Actually, I did

Re: checking if a list is empty

2011-05-12 Thread Hans Georg Schaathun
On Thu, 12 May 2011 01:49:05 -0400, D'Arcy J.M. Cain da...@druid.net wrote: : That's not programming. That's using a canned app that a programmer : wrote that takes your unstructured input and does something useful with : it. Spreadsheets are a primitive example of that. Google is a more :

Re: checking if a list is empty

2011-05-12 Thread Hans Georg Schaathun
On 11 May 2011 21:42:10 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : *Potentially* different tests. Which is exactly the point. Given an : arbitrary object, the developer doesn't know what test is appropriate. : Should I write len(x) == 0 or list(x) == [] or x.next is

Re: checking if a list is empty

2011-05-12 Thread Hans Georg Schaathun
On Wed, 11 May 2011 20:31:45 -0700 (PDT), alex23 wuwe...@gmail.com wrote: : On May 12, 7:24 am, harrismh777 harrismh...@charter.net wrote: :  We need to move away from 'canned apps' to a new day where : the masses can sit down to their computer and solve new problems with it : through

Re: checking if a list is empty

2011-05-12 Thread Hans Georg Schaathun
On Thu, 12 May 2011 16:46:38 +1000, Ben Finney ben+pyt...@benfinney.id.au wrote: : Hans Georg Schaathun h...@schaathun.net writes: : : On Wed, 11 May 2011 20:31:45 -0700 (PDT), alex23 :wuwe...@gmail.com wrote: : : On May 12, 7:24 am, harrismh777 harrismh...@charter.net wrote: : :  We

Re: checking if a list is empty

2011-05-12 Thread Hans Georg Schaathun
On Thu, 12 May 2011 22:16:10 +1000, Chris Angelico ros...@gmail.com wrote: : Anyone can join. Not everyone wants to join. Me, I'm happy here as a : priest of the software industry, and I have no desire to become a : priest of, say, automotive engineering or concrete pouring. Would an :

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On 07 May 2011 02:51:50 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : On Fri, 06 May 2011 14:57:21 -0700, scattered wrote: : : is there any problem with : : (3) if li == []: : : ? : : Seems to work when I test it and seems to clearly test what you are : trying

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On 07 May 2011 02:49:53 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : On Fri, 06 May 2011 16:05:09 -0400, Adam Tauno Williams wrote: : : I'd never accept code like if not x as an empty test. : : So much the worse for you then. : : The point of the if x idiom is that

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On Sat, 07 May 2011 21:57:13 -0700, Ethan Furman et...@stoneleaf.us wrote: : If you're going to use a language, and use it well, you have to learn : how that language works. And if the world evolves around the compiler and you, that advice suffices. However, programming is often as much

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On 11 May 2011 13:36:02 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : In this case, the interpretation of an arbitrary object as a boolean is : peculiar for python. : : Incorrect. It is widespread among many languages. Programmers have been : writing conditional

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On 11 May 2011 12:14:46 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : Not knowing that you can write if x instead of if x == [] is like not : knowing that you can write : : elif condition : : instead of : : else: : if condition My concern was

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On 11 May 2011 13:45:52 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : Do you think that we should avoid chained comparisons, class methods, : closures, co-routines, decorators, default values to functions, : delegation, doc tests, exceptions, factory functions,

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On Wed, 11 May 2011 10:33:51 -0400, D'Arcy J.M. Cain da...@druid.net wrote: : Non-programmers should be able to program? That was not really what I suggested; I was primarily talking about reading programs and commenting on formulæ and algorithms. : Should non-doctors be able to doctor? If

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On 11 May 2011 16:26:40 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : 1. My concern was not about clueless newbies. They need to :learn. My concern is about experienced scientists and engineers who :are simply new to python. : : Which makes them clueless newbies

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On Thu, 12 May 2011 02:05:21 +1000, Chris Angelico ros...@gmail.com wrote: : In a Bourne shell script, if ends with fi... case ends with esac... so : file would end with... hmm. Yeah, I think it's best to know the : language you're trying to comprehend, and/or actually look at context :

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On Wed, 11 May 2011 10:27:49 -0400, D'Arcy J.M. Cain da...@druid.net wrote: : When did we come to the idea that people should be able to program in a : language without actually learning it? The fact that Python comes so : close to that possibility is nothing short of revolutionary.

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On Wed, 11 May 2011 10:31:59 -0600, Ian Kelly ian.g.ke...@gmail.com wrote: : (x + 3 for x in xs if x % 2 == 1) Interesting. Thanks. That might come in handy some time. -- :-- Hans Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On Wed, 11 May 2011 13:50:54 -0400, Prasad, Ramit ramit.pra...@jpmchase.com wrote: : I find this argument to be flawed. Should I stop using built-in : generators instead of range/xrange for looping through lists? : Certainly for loops with loop counting are understood more widely : than

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On Wed, 11 May 2011 14:59:34 -0400, Prasad, Ramit ramit.pra...@jpmchase.com wrote: : Fair enough. I am a sheep, so I do what other (more knowledgeable) : people do. It is a fair assumption (for my specific code writing : environments) that everyone who is going to read my code understands :

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On Wed, 11 May 2011 12:17:33 -0700, Ethan Furman et...@stoneleaf.us wrote: : 'if li' *is* KISS. It /might/ be in some contexts, but a priori it is not, as it superimposes a truth value on a data type which is otherwise a pretty accurate model of real objects (outside python). One principle of

Re: checking if a list is empty

2011-05-11 Thread Hans Georg Schaathun
On Wed, 11 May 2011 14:44:37 -0400, Prasad, Ramit ramit.pra...@jpmchase.com wrote: : Someone who knows how to program is never clueless starting a new : language. Newbie, may be, but he knows most of the constructions : and semantic principles to look for; most of it is learning the syntax. :

Re: Overuse of try/except/else?

2011-05-10 Thread Hans Georg Schaathun
On Tue, 10 May 2011 07:36:42 -0400, Adam Tauno Williams awill...@whitemice.org wrote: : On Mon, 2011-05-09 at 19:40 -0500, Kyle T. Jones wrote: : It has been hard for me to determine what would constitute overuse. : : The chronic problem is under use; so I wouldn't worry much about it. : :

Re: What other languages use the same data model as Python?

2011-05-10 Thread Hans Georg Schaathun
On Tue, 10 May 2011 14:05:34 + (UTC), Grant Edwards invalid@invalid.invalid wrote: : Because it's easier to communicate if everybody agrees on what a word : means. Why should we agree on that particular word? Are there any other words we agree about? Other key words, such as class,

Re: What other languages use the same data model as Python?

2011-05-10 Thread Hans Georg Schaathun
On Wed, 11 May 2011 01:27:36 +1000, Chris Angelico ros...@gmail.com wrote: : Language is for communication. If we're not using the same meanings : for words, we will have problems. So if you adopt the word class to mean a type (or composite type), as in python, what word would you use for a

Re: scipy

2011-05-10 Thread Hans Georg Schaathun
On Sun, 8 May 2011 03:44:06 -0700 (PDT), pb peterthe...@yahoo.com wrote: : I', having trouble with scipy. I have followed the instructions at : scipy website and have installed the following on my mac osx 10.6.6 : (...) : I'm assuming I have the wrong version of something, would that be :

Re: vertical ordering of functions

2011-05-10 Thread Hans Georg Schaathun
On Tue, 3 May 2011 18:08:27 -0400, Jabba Laci jabba.l...@gmail.com wrote: : I'm just reading Robert M. Martin's book entitled Clean Code. In Ch. : 5 he says that a function that is called should be below a function : that does the calling. This creates a nice flow down from top to : bottom.

Re: What other languages use the same data model as Python?

2011-05-09 Thread Hans Georg Schaathun
On Sat, 07 May 2011 21:21:45 +1200, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: : You can manipulate them just fine by moving them : from one place to another: : : a = b : : You can use them to get at stuff they refer to: : : a = b.c : a[:] = b[:] Surely you can refer

Re: What other languages use the same data model as Python?

2011-05-09 Thread Hans Georg Schaathun
On Mon, 09 May 2011 12:52:27 +1200, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: : Let me save you from guessing. I'm thinking of a piece of paper with : a little box on it and the name 'a' written beside it. There is an : arrow from that box to a bigger box. : :

Re: What other languages use the same data model as Python?

2011-05-09 Thread Hans Georg Schaathun
On Mon, 9 May 2011 21:18:29 +1000, Chris Angelico ros...@gmail.com wrote: : Analogies are like diagrams. Not all of them are perfect or useful. : : The boxes are different sizes. If you really want them to look : different, do one as squares and one as circles, but don't try that in : plain

Re: What other languages use the same data model as Python?

2011-05-05 Thread Hans Georg Schaathun
On Wed, 04 May 2011 16:49:25 -0500, harrismh777 harrismh...@charter.net wrote: : Folks seem to think that because they are doing abstraction at a : high-level (well, they never maybe programmed at a lower level) that : abstraction somehow 'requires' a high level language. (not true) I

Re: What other languages use the same data model as Python?

2011-05-05 Thread Hans Georg Schaathun
On Wed, 04 May 2011 20:11:02 -0500, harrismh777 harrismh...@charter.net wrote: : A reference is a pointer (an address). : : A value is memory (not an address). Sure, and pointers (from a hardware or C perspective) are memory, hence pointers are values. -- :-- Hans Georg --

Re: What other languages use the same data model as Python?

2011-05-05 Thread Hans Georg Schaathun
On Thu, 05 May 2011 20:55:36 +1200, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: : It's not clear to me that references are any more abstract : than objects, or to put it another way, that objects are : any less abstract than references. : : After all, in normal Python usage you never

Re: What other languages use the same data model as Python?

2011-05-04 Thread Hans Georg Schaathun
On Wed, 4 May 2011 02:56:28 -0700 (PDT), Devin Jeanpierre jeanpierr...@gmail.com wrote: : Eh, that example doesn't say what you think it does. It has the same : behavior in C: http://ideone.com/Fq09N . Python is pass-by-value in a : meaningful sense, it's just that by saying that we say that

Re: What other languages use the same data model as Python?

2011-05-04 Thread Hans Georg Schaathun
On Wed, 4 May 2011 06:12:14 -0700 (PDT), Devin Jeanpierre jeanpierr...@gmail.com wrote: : I don't think of pass-by-value involving references as being an : implementation-level thing. It's a way of thinking about Python's : behavior: a model. (...) : It isn't particularly contorted. I

Re: What other languages use the same data model as Python?

2011-05-04 Thread Hans Georg Schaathun
On Wed, 4 May 2011 09:18:56 -0700 (PDT), Devin Jeanpierre jeanpierr...@gmail.com wrote: : I'm a bit uncomfortable with the vibe here. It's one thing for me to : self-deprecatingly suggest I'm brainwashed (with a smile), and another : for you to agree in complete seriousness. I am sorry. It

Re: What other languages use the same data model as Python?

2011-05-04 Thread Hans Georg Schaathun
On Thu, 5 May 2011 00:20:34 +1000, Chris Angelico ros...@gmail.com wrote: : Sometimes, to explain Python, you need to dig down to the underlying : hardware - even deeper than C, if you like. Sometimes you may need to narrow down the scope and explain a particular implementation of python with

Re: What other languages use the same data model as Python?

2011-05-04 Thread Hans Georg Schaathun
On Wed, 04 May 2011 14:22:38 -0500, harrismh777 harrismh...@charter.net wrote: : That statement is untrue; evidenced by the very fact the CPython's : complex and abstract data modeling has been very suitably handled by C. That's an implementation. Not modelling. : You cannot

Re: What other languages use the same data model as Python?

2011-05-04 Thread Hans Georg Schaathun
On Wed, 04 May 2011 14:33:34 -0500, harrismh777 harrismh...@charter.net wrote: : Hans Georg Schaathun wrote: : In C it is pass by value, as the pointer : is explicit and do whatever you want with the pointer value. : : You clearly are not a C programmer. I am not really a programmer period

Re: What other languages use the same data model as Python?

2011-05-04 Thread Hans Georg Schaathun
On Wed, 04 May 2011 14:58:38 -0500, harrismh777 harrismh...@charter.net wrote: : True enough. If I used Jython, I would want to take a look at those : sources... as well as the Java sources... which were wrtten in, um, C. And then, suddenly, you'll be developing code which fails on

Re: What other languages use the same data model as Python?

2011-05-04 Thread Hans Georg Schaathun
On Thu, 05 May 2011 15:48:51 +1200, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: : No, it's not. With call-by-name, the caller passes a : small function (known as a thunk) that calculates the : address of the parameter. Every time the callee needs to : refer to the parameter, it

Re: Fibonacci series recursion error

2011-05-03 Thread Hans Georg Schaathun
On 03 May 2011 00:21:45 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : Python aims at acceptable performance (between 10 and 100 times slower : than C) and much easier development (between 10 and 100 times faster than : C *wink*). If that tradeoff doesn't suit you,

Re: Fibonacci series recursion error

2011-05-03 Thread Hans Georg Schaathun
On Tue, 3 May 2011 07:56:26 +1000, Chris Angelico ros...@gmail.com wrote: : often recursively.  The compiler should generate code the way the CPU : thinks (most optimally), i.e. iteratively. : : The CPU can function iteratively or recursively. I should have said 'hardware' rather than CPU.

Re: What other languages use the same data model as Python?

2011-05-03 Thread Hans Georg Schaathun
On 01 May 2011 08:45:51 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : Python uses a data model of name binding and call by object (also : known as call by sharing). I trust I don't need to define my terms, but : just in case: Without having the time to get my hand

Re: What other languages use the same data model as Python?

2011-05-03 Thread Hans Georg Schaathun
On Tue, 03 May 2011 12:33:15 -0400, Mel mwil...@the-wire.com wrote: : mwilson@tecumseth:~$ python : Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) : [GCC 4.4.3] on linux2 : Type help, copyright, credits or license for more information. : def identify_call (a_list): : ... a_list[0] =

Re: What other languages use the same data model as Python?

2011-05-03 Thread Hans Georg Schaathun
On 03 May 2011 15:20:42 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : You get credit for not falling into the trap of thinking there are only : two, call by reference and call by value, but there are *many* more than : just three. Wikipedia lists at least 13: Ah.

Re: Fibonacci series recursion error

2011-05-02 Thread Hans Georg Schaathun
On Mon, 2 May 2011 06:49:41 +1000, Chris Angelico ros...@gmail.com wrote: : Sure. Serialize this Python object in a way that can be given to, say, PHP: : foo={asdf:qwer,zxcv:1234}; foo[self]=[1,2,3,foo] : Recurse from self into the list, recurse from there into a : dictionary... Okay, that's

Re: Fibonacci series recursion error

2011-05-02 Thread Hans Georg Schaathun
On 02 May 2011 01:09:21 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : Ah, I see where you're coming from now! You think I'm arguing *against* : the use of recursion. Not at all. Earlier in this thread, I said: Fair enough. Somebody said something about recursion mainly

Re: Fibonacci series recursion error

2011-05-02 Thread Hans Georg Schaathun
On 02 May 2011 08:56:57 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : I see your smiley, but there are a number of similar series as Fibonacci, : with the same recurrence but different starting values, or similar but : slightly different recurrences. E.g. Lucas,

Re: Fibonacci series recursion error

2011-05-02 Thread Hans Georg Schaathun
On Sun, 01 May 2011 18:24:30 -0400, Terry Reedy tjre...@udel.edu wrote: : This does not make linear recursion 'bad', just impractical for general : use on finite-memory machines. While I consider it very useful for : learning, it is unnecessary because it is easy to write an iterative :

Re: Fibonacci series recursion error

2011-05-02 Thread Hans Georg Schaathun
On 02 May 2011 16:41:37 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : You must be new to the Internet then :) OK. Maybe I heard something worse last time I was an active news users, years ago. Anyway, most of the silly things I hear do not qualify as arguments :-) :

Re: Fibonacci series recursion error

2011-05-01 Thread Hans Georg Schaathun
On Sat, 30 Apr 2011 15:40:24 +0100, Paul Rudin paul.nos...@rudin.co.uk wrote: : Anytime you have enough data... there are plenty of things that are natural to : represent as recursive data structures, and often you don't know in : advance how much data your code is going to have to deal

Re: Fibonacci series recursion error

2011-05-01 Thread Hans Georg Schaathun
On 01 May 2011 09:04:27 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : Why? You might have 4000 MB of main memory, and only 2 MB (say?) of call : stack allocated. The call stack can't grow indefinitely. If it does, you : get a stack overflow: Of course you do, but you

Re: Fibonacci series recursion error

2011-05-01 Thread Hans Georg Schaathun
On 01 May 2011 11:56:57 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: : Just google on stack overflow crash. And I get loads of examples of stack overflows, but I could not see anybody linking this to logically correct recursion. Wikipedia, for instance, mentions two common

Re: Fibonacci series recursion error

2011-04-30 Thread Hans Georg Schaathun
On Fri, 29 Apr 2011 23:45:30 -0500, harrismh777 harrismh...@charter.net wrote: : There is much debate about this generally, but general wisdom is that : recursion is to be avoided when possible. That is context dependent at best. You have given reasons to avoid recursion in /executable

Re: Development tools and practices for Pythonistas

2011-04-30 Thread Hans Georg Schaathun
On Fri, 29 Apr 2011 20:21:58 -0700 (PDT), CM cmpyt...@gmail.com wrote: : While we're on the topic, when should a lone developer bother to start : using : a VCS? At what point in the complexity of a project (say a hobby : project, but : a somewhat seriousish one, around ~5-9k LOC) is the

Re: Fibonacci series recursion error

2011-04-30 Thread Hans Georg Schaathun
On Sat, 30 Apr 2011 06:43:42 +0100, Paul Rudin paul.nos...@rudin.co.uk wrote: : Writing recurive code is acceptable and is a nice clear way of : expressing things when you have naturally recursive data structures, and : can lead to perfectly good compiled code. The problem in CPython is the :

Re: Fibonacci series recursion error

2011-04-30 Thread Hans Georg Schaathun
On Sat, 30 Apr 2011 12:29:00 +0100, Paul Rudin paul.nos...@rudin.co.uk wrote: : Clearly it makes a difference in any case where you'd hit the recursion : limit. What kind of problems make you hit the limit? Other than when you forget the base case, I mean. : It's no big deal to do

Re: [OT] From svn to something else? (was: VCS tools)

2011-04-29 Thread Hans Georg Schaathun
Hmmm. I am still using svn. How easy and reliable is it to import my svn version history into one of the three big DVCS-s mentioned here? I am fairly happy with svn, but then I use it more as a backup system and a means to synchronise multiple systems. Something better would not hurt, but

Re: [OT] From svn to something else?

2011-04-29 Thread Hans Georg Schaathun
On Fri, 29 Apr 2011 06:50:52 -0500, Tim Chase python.l...@tim.thechases.com wrote: : I'd say that one of the things SVN has going for it is that it's : the lingua-franca of VCSes, so just about everything (especially : the 3 big names mentioned in this thread: hg, bzr, git) can talk : to

Re: Development tools and practices for Pythonistas

2011-04-29 Thread Hans Georg Schaathun
On Wed, 27 Apr 2011 14:24:30 +0200, Jean-Michel Pichavant jeanmic...@sequans.com wrote: : I was talking about merge *issue* i.e merge resulting in conflicts that : are not easy to solve. With a single user most of the merge will be : solved automatically by any decent VCS. Exactly, and

Re: client-server parallellised number crunching

2011-04-27 Thread Hans Georg Schaathun
On Tue, 26 Apr 2011 14:31:59 -0700, geremy condra debat...@gmail.com wrote: : Without knowledge of what you're doing it's hard to comment : intelligently, I need to calculate map( foobar, L ) where foobar() is a pure function with no dependency on the global state, L is a list of tuples,

Re: client-server parallellised number crunching

2011-04-27 Thread Hans Georg Schaathun
On Tue, 26 Apr 2011 23:54:24 -0700, geremy condra debat...@gmail.com wrote: : This sounds like a hadoop job, with the caveat that you still have to : get your objects across the network somehow. Have you tried xdrlib or : the struct module? I suspect either would save you some time. Packing

Re: client-server parallellised number crunching

2011-04-27 Thread Hans Georg Schaathun
On Wed, 27 Apr 2011 11:35:16 +0200, Thomas Rachel nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa...@spamschutz.glglgl.de wrote: : As far as I understand, you acquire a job, send it to a remote host via : a socket and then wait for the answer. Is that correct? That's correct. And the client

Re: client-server parallellised number crunching

2011-04-27 Thread Hans Georg Schaathun
On Wed, 27 Apr 2011 23:35:06 +1000, Chris Angelico ros...@gmail.com wrote: : On Wed, Apr 27, 2011 at 10:21 PM, Hans Georg Schaathun : h...@schaathun.net wrote: : That's correct.  And the client initiates the connection.  At the : moment, I use one thread per connection, and don't

Re: client-server parallellised number crunching

2011-04-27 Thread Hans Georg Schaathun
On Thu, 28 Apr 2011 00:58:22 +1000, Chris Angelico ros...@gmail.com wrote: : thousand threads? a couple of million? In Python, it'll probably end : up pretty similar; chances are you won't be taking much advantage of : multiple CPUs/cores (because the threads will all be waiting for : socket

client-server parallellised number crunching

2011-04-26 Thread Hans Georg Schaathun
I wonder if anyone has any experience with this ... I try to set up a simple client-server system to do some number crunching, using a simple ad hoc protocol over TCP/IP. I use two Queue objects on the server side to manage the input and the output of the client process. A basic system running

Re: De-tupleizing a list

2011-04-26 Thread Hans Georg Schaathun
On Wed, 27 Apr 2011 04:30:01 +1000, Algis Kabaila akaba...@pcug.org.au wrote: : I would prefer that to using a ready made module, as it would : be quicker than learning about the module, OTH, learning about : a module may be useful for other problems. A standard dilema... More

Re: client-server parallellised number crunching

2011-04-26 Thread Hans Georg Schaathun
On Tue, Apr 26, 2011 at 1:20 PM, Chris Angelico ros...@gmail.com wrote: But question: Why are you doing major number crunching in Python? On your quad-core machine, recode in C and see if you can do the whole job without bothering the unreliable boxen at all. The reason is very simple. I

Re: De-tupleizing a list

2011-04-26 Thread Hans Georg Schaathun
On Tue, 26 Apr 2011 13:37:40 -0700, Ethan Furman et...@stoneleaf.us wrote: : Hans Georg Schaathun wrote: : List comprehension is understood even by readers with no experience : with python. : : There's nothing magically understandable about a list comp -- the first : time I saw one (which

Re: About threads in python

2011-04-25 Thread Hans Georg Schaathun
On Fri, 22 Apr 2011 12:19:56 -0700 (PDT), sturlamolden sturlamol...@yahoo.no wrote: : To optimise computational code, notice that Python itself : gives you a 200x performance penalty. That is much more : important than not using all 4 cores on a quadcore processor. : In this case, start by

sockets: bind to external interface

2011-04-25 Thread Hans Georg Schaathun
Is there a simple way to find the external interface and bind a socket to it, when the hostname returned by socket.gethostname() maps to localhost? What seems to be the standard ubuntu configuration lists the local hostname with 127.0.0.1 in /etc/hosts. (I checked this on two ubuntu boxen, on

Re: sockets: bind to external interface

2011-04-25 Thread Hans Georg Schaathun
On Tue, 26 Apr 2011 05:49:07 +1000, Chris Angelico ros...@gmail.com wrote: : You can run 'ifconfig' without being root, so there must be a way. At : very worst, parse ifconfig's output. Of course, but I am not sure that's simpler than the manual solution. Especially since there is more than

Re: sockets: bind to external interface

2011-04-25 Thread Hans Georg Schaathun
On Mon, 25 Apr 2011 21:14:51 +0100, Hans Georg Schaathun h...@schaathun.net wrote: : : The way you talk of the external interface, I'm assuming this : : computer has only one. Is there a reason for not simply binding to : : INADDR_ANY aka 0.0.0.0? : : Ah. That's what I really wanted

Re: sockets: bind to external interface

2011-04-25 Thread Hans Georg Schaathun
On Mon, 25 Apr 2011 23:18:05 +0200, Thomas Rachel nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa...@spamschutz.glglgl.de wrote: : That is right, but I cannot see where he mentions the direction of the : socket. My fist thought was that he tries to have a server socket... Quite right. I thought

Re: Literate Programming

2011-04-09 Thread Hans Georg Schaathun
On Fri, 8 Apr 2011 12:58:34 -0400, Tim Arnold tim.arn...@sas.com wrote: : If you already know LaTeX, you might experiment with the *.dtx docstrip : capability. Hi. Hmmm. That's a new thought. I never thought of using docstrip with anything but LaTeX. It sounds like a rather primitive

Re: Literate Programming

2011-04-09 Thread Hans Georg Schaathun
On Sat, 9 Apr 2011 03:45:55 -0700 (PDT), Jim jim.heffe...@gmail.com wrote: : I'm sorry; I don't understand commenting code within a block but I : wondered if it meant you were not fully familiar with the idea of the : web-type programs. The idea was pretty clear from the web page you cited.

Re: Python 3.2 vs Java 1.6

2011-04-09 Thread Hans Georg Schaathun
On Sat, 9 Apr 2011 01:32:17 +1000, Chris Angelico ros...@gmail.com wrote: : On Sat, Apr 9, 2011 at 1:21 AM, km srikrishnamo...@gmail.com wrote: : How does python 3.2 fare compared to Java 1.6 in terms of performance ? : any pointers or observations ? : : How do apples compare to oranges in

Re: Literate Programming

2011-04-08 Thread Hans Georg Schaathun
On Thu, 07 Apr 2011 16:21:52 -0500, Robert Kern robert.k...@gmail.com wrote: : http://sphinx.pocoo.org/markup/code.html : : As far as I can tell, it just works. See here for an example: : : http://ipython.scipy.org/doc/nightly/html/interactive/reference.html Maybe I did not express myself

Re: Literate Programming

2011-04-08 Thread Hans Georg Schaathun
On Fri, 8 Apr 2011 05:22:01 -0700 (PDT), Jim jim.heffe...@gmail.com wrote: : On Apr 7, 2:09 pm, Hans Georg Schaathun h...@schaathun.net wrote: : Has anyone found a good system for literate programming in python? : : Are you aware of pyweb http://sourceforge.net/projects/pywebtool

Literate Programming

2011-04-07 Thread Hans Georg Schaathun
Has anyone found a good system for literate programming in python? I have been trying to use pylit/sphinx/pdflatex to generate technical documentation. The application is scientific/numerical programming, so discussing maths in maths syntax in between python syntax is important. While I like

  1   2   >