Re: question about speed of sequential string replacement vs regex or
Willem wil...@toad.stack.nl writes: Eli the Bearded wrote: ) In comp.lang.perl.misc, Willem wil...@toad.stack.nl wrote: ) In Perl, it would be applicable. You see, in Perl, you can call a function ) in the replacement of the regex substitution, which can then look up the ) html entity and return the wanted unicode literal. ) ) A function? I'd use a hash. A function can return a sensible value for unknown substitutions. You can do that also in the RHS of the substitution and still keep it readable if you use something like s{..}{ your code goes here }ge; However, a function can be easier on the eye: s{...}{ some_good_name( ... ) }ge; -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: http://castleamber.com/ Perl for books:http://johnbokma.com/perl/help-in-exchange-for-books.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Why did Quora choose Python for its development?
Ben Finney b...@benfinney.id.au writes: Get a life. Or better, just fuck off and die. It will improve both the world and the Python community, of which you are nothing but a little, smelly shitstain. That abuse is entirely unwelcome in this community, against any person. Please desist. You should have spoken up sooner, especially as the spokes person of this community. But every bully has is fan club. -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: http://castleamber.com/ Perl for books:http://johnbokma.com/perl/help-in-exchange-for-books.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Why did Quora choose Python for its development?
Dennis Lee Bieber wlfr...@ix.netcom.com writes: Python books than after six months of trying to understand PERL... And Perl is the language, and perl is what runs Perl. -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: http://castleamber.com/ Perl for books:http://johnbokma.com/perl/help-in-exchange-for-books.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Why did Quora choose Python for its development?
Thorsten Kampe thors...@thorstenkampe.de writes: * Chris Angelico (Wed, 25 May 2011 08:01:38 +1000) On Wed, May 25, 2011 at 3:39 AM, D'Arcy J.M. Cain da...@druid.net wrote: One of my favorite quotes (not sure if it was about Perl or APL) is I refuse to use a programming language where the proponents of it stick snippets under each other's nose and say 'I bet you can't guess what this does.' Yes, I believe that was Perl. And an amusing quote. But most of the point of it comes from the fact that Perl uses punctuation for most of its keywords, whereas (say) Python uses English words; it's a lot more fun to crunch something down when you can use $| and friends than when you have to put x and y, complete with spaces, for a simple boolean. But that says nothing about which language is actually better for working with... [...] It does say something about readibility. And yes, readability counts. And yes, readability says a lot about how good a language is for reading and working with. To people used to the latin alphabet languages using a different script are unreadable. So readability has a lot to do with what one is used to. Like I already stated before: if Python is really so much better than Python readability wise, why do I have such a hard time dropping Perl and moving on? -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: http://castleamber.com/ Perl for books:http://johnbokma.com/perl/help-in-exchange-for-books.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Why did Quora choose Python for its development?
Ethan Furman et...@stoneleaf.us writes: Terry Reedy wrote: On 5/25/2011 8:01 AM, John Bokma wrote: to. Like I already stated before: if Python is really so much better than Python readability wise, why do I have such a hard time dropping Perl and moving on? [you meant 'than Perl'] You are one of the people whose brain fits Perl (or vice versa) better than most. So enjoy it. Ignore anyone who says otherwise. +1 If everybody's brain worked the same, we wouldn't have so many different languages to choose from. So, this means that in general language readability is not as clear cut as some seem to advertise ;-). -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: http://castleamber.com/ Perl for books:http://johnbokma.com/perl/help-in-exchange-for-books.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Why did Quora choose Python for its development?
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: On Wed, 25 May 2011 07:01:07 -0500, John Bokma wrote: if Python is really so much better than Python [Perl] readability wise, why do I have such a hard time dropping Perl and moving on? My guess is that you have an adversarial view of computer languages, Well, it's clear that you are indeed the fuckwit I suspected you are. What's a pity is that you are so vocal in this group and to me at least makes it a way less pleasant experience to read this group. Get a life. Or better, just fuck off and die. It will improve both the world and the Python community, of which you are nothing but a little, smelly shitstain. -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: http://castleamber.com/ Perl for books:http://johnbokma.com/perl/help-in-exchange-for-books.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Why did Quora choose Python for its development?
Teemu Likonen tliko...@iki.fi writes: * 2011-05-24T06:05:35-04:00 * D'Arcy J. M. Cain wrote: On Tue, 24 May 2011 09:00:14 +0300 Octavian Rasnita orasn...@gmail.com wrote: %d = @l; Please tell me if Python has a syntax which is more clear than this for doing this thing. How is that clear? Shorter != clearer. A Python programmer looking at that sees line noise. I'm a Lisp programmer who sees (some) Python code as line noise. Exactly, and glad to see there are also non-extremists in this group. I have been programming Perl for well over 17 years. I've been trying to switch to Python /several times/ but yet, with all its shortcomings Perl somehow still suits me better. To D'Arcy and other Pythonistas -- doesn't that sound like an extermistic organization or what -- it might look like a cat had an accident involving a keyboard but to me, and all those other people who do enjoy coding Perl it's beauty. The whole Python is so beatiful perfect sounds to me like people who have embraced the latin alphabet calling Devanagari unreadable chicken scratches made by backwards and poor people. To me it's a writing system of beauty. I don't know but from the point of view of a Lisp programmer Python has the same obsession. Not trolling, I just wanted to point out that these are just point of views. I don't actually care that much about these things. Wise words. And I agree. To me Python vs. Perl has nothing to do with being a fanboy (unlike many other posters here). I like both languages, I have invested a lot of time in learning Python and I am really not dense. Yet, even though I can program in Python sufficient enough very often I just pick Perl. Now why is that? -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: http://castleamber.com/ Perl for books:http://johnbokma.com/perl/help-in-exchange-for-books.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Why did Quora choose Python for its development?
D'Arcy J.M. Cain da...@druid.net writes: On Tue, 24 May 2011 00:17:55 -0500 John Bokma j...@castleamber.com wrote: $d = @a; That will give you the number of elements in @a. What you (probably) mean is %hash = @array; If I was even considering using Perl, this one exchange would send me screaming in the opposite direction. To me as silly as all those people who give Python a wide berth because of significant whitespace. I am glad that I am not so limited in that respect. To me programming languages are like writing systems used by humans; each has its short comings and each has its beauty. -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: http://castleamber.com/ Perl for books:http://johnbokma.com/perl/help-in-exchange-for-books.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Why did Quora choose Python for its development?
Chris Angelico ros...@gmail.com writes: On Wed, May 25, 2011 at 2:50 AM, John Bokma j...@castleamber.com wrote: Wise words. And I agree. To me Python vs. Perl has nothing to do with being a fanboy (unlike many other posters here). I like both languages, I have invested a lot of time in learning Python and I am really not dense. Yet, even though I can program in Python sufficient enough very often I just pick Perl. Now why is that? To me, a language is a tool. To me, and to a lot of Perl programmers it's not different. The more tools you have competence with, the easier it will be to select the right one for any job. There are very few tools that have no use whatsoever; even Ook might be useful (although I have yet to be asked to port any code to OrangutanOS). This differs from the notion of having ten paradigms in one language, If this is referring to Perl: the myths surrounding there is more than one way are even more crazy than there is only one way, maybe because more than one makes it so much easier to make those myths up? On top of that: how many paradigms does Python support? And which paradigms does Perl support and Python doesn't? Roughly there are two dialects of Perl [1]: what people who never took the time to learn it write, and the rest. Also, having more than one way to code something doesn't mean that there are no preferrences. Python has also several ways to do certain things; yet most skilled programmers have a preference for one way. It's not that different with Perl; in my experience exactly the same even. Of course one can say a lot about Perl; I can. But I have never had a rough time reading someone else's code, unless the person had no clue about programming to begin with [2]. If Perl is really such a disaster, why are people using it? Or are they all short-sighted idiots who don't know better? Several Perl programmers I know, including myself, are fully aware of Python and other programming languages. Yet, somehow they still program in Perl... [1] http://www.bofh.org.uk/2010/07/25/a-tale-of-two-languages [2] I once had to port a piece of Pascal code and after some studying it turned out that the 100+ lines or so did some variant of bubble sort and near the end reversed the order in a separate loop. -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: http://castleamber.com/ Perl for books:http://johnbokma.com/perl/help-in-exchange-for-books.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Why did Quora choose Python for its development?
D'Arcy J.M. Cain da...@druid.net writes: On Tue, 24 May 2011 11:52:39 -0500 John Bokma j...@castleamber.com wrote: $d = @a; That will give you the number of elements in @a. What you (probably) mean is %hash = @array; If I was even considering using Perl, this one exchange would send me screaming in the opposite direction. To me as silly as all those people who give Python a wide berth because of significant whitespace. I am glad that I am not so limited in that respect. To me programming languages are like writing systems used by humans; each has its short comings and each has its beauty. My point was that even proponents of the language can make a significant error based on the way the variable is named. And someone can't misspell dict, for example? Are we now going to judge a language on a typo someone just made? When I first looked at Perl it looked like line noise. When I first looked at Python it looked like pseudo-code. When people who are used to a latin alpabeth look at Devanagari they probably see scratches make by chickens. I saw beauty (and still see it). To someone fluent in Devanagari the latin alpabeth might look like Perl ;-). Anyway, I have been exposed to pseudo-code a lot before I picked up Perl, and yet, Perl somehow stuck with me. I learned about Python a little later (IIRC), and have tried to pick it up several times over the years that followed. Last year I have been more serious about picking it up; and I even did some paid for work in it. I /can/ program in Python, I do /like/ Python, but somehow I like Perl more; even when I am fully aware of its shortcommings each time I use it. As for line noise: very often it turns out that people mean the regular expressions by this. But a similar dialect is used by many other programming languages that I know of. The difference is that Perl has dedicated operators for it. A Perl programmer will call this line noise: double_word_re = re.compile(r\b(?Pword\w+)\s+(?P=word)(?!\w), re.IGNORECASE) for match in double_word_re.finditer(text): print ({0} is duplicated.format(match.group(word)) (p500 of Programming in Python 3, 2nd edition, any typos by me). Look, I couldn't care less what other people use. In that case you're an exception here. Or maybe the weekly Perl bashers are way more vocal here and drown people like you out. One thing I hate about comp.lang.perl.misc is the ivory tower attitude there. One thing I hate about comp.lang.python is the weekly Perl bashing; to me it makes those people look like extremists (Pythonistas, what's in a word), and to be honest, it does affect how I view Python. I just don't see any reason for someone to come into a Python group and start proselytizing about why their tool is better than ours any more than I would feel any need to go to a Perl group and start trying to convert them. Yet it seems to be accepted behavoir here to weekly bash Perl... Bottom line - they did a study once (sorry, can't point to it any more) to determine the best tool for development. Turns out that the most productive tool was generally the one that the user believed was the most productive. In hindsight I think that that was rather obvious. Doesn't surprise me. I did switch to Emacs a few years back (used Textpad for many years) but I don't think I now produce more code / hour. But I am able to do some things way easier compared to using Textpad, and that gives me pleasure. -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: http://castleamber.com/ Perl for books:http://johnbokma.com/perl/help-in-exchange-for-books.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Why did Quora choose Python for its development?
Chris Angelico ros...@gmail.com writes: On Wed, May 25, 2011 at 3:56 AM, John Bokma j...@castleamber.com wrote: Chris Angelico ros...@gmail.com writes: To me, a language is a tool. To me, and to a lot of Perl programmers it's not different. The more tools you have competence with, the easier it will be to select the right one for any job. There are very few tools that have no use whatsoever; even Ook might be useful (although I have yet to be asked to port any code to OrangutanOS). This differs from the notion of having ten paradigms in one language, If this is referring to Perl: the myths surrounding there is more than one way are even more crazy than there is only one way, maybe because more than one makes it so much easier to make those myths up? On top of that: how many paradigms does Python support? And which paradigms does Perl support and Python doesn't? You miss my point. Could be, English is my second language. But to me ten paradigms in one language smelled of Perl bashing (or maybe Falcon bashing). My apologies if that was not the intent. To me, BOTH Perl AND Python are tools; there is a time and a place for each. Also in my toolkit are C, C++, Pike, REXX, c, c, c. Even Java and ActionScript/Flash (both of which I detest for several reasons) have their place - browser-based applications that aren't limited to HTTP (try writing an in-browser MUD client in Javascript). Every language has its downsides; every language has its unique feature that makes it special. And every language I've ever used has taught me something. Know both. Bash both (if you feel so inclined). Use both. Can't agree more with you, thanks for the clarification. -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: http://castleamber.com/ Perl for books:http://johnbokma.com/perl/help-in-exchange-for-books.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Why did Quora choose Python for its development?
Chris Angelico ros...@gmail.com writes: On Wed, May 25, 2011 at 3:39 AM, D'Arcy J.M. Cain da...@druid.net wrote: My point was that even proponents of the language can make a significant error based on the way the variable is named. It's like the old Fortran IV that I first learned where the name of the variable determined whether it was an integer or a floating point. I believe that's the origin of one of the proofs that God is real (unless declared integer). And hey, I can't hate something that gave us the classic use of i, j, k as loop indices! One of my favorite quotes (not sure if it was about Perl or APL) is I refuse to use a programming language where the proponents of it stick snippets under each other's nose and say 'I bet you can't guess what this does.' Yes, I believe that was Perl. And an amusing quote. But most of the point of it comes from the fact that Perl uses punctuation for most of its keywords, For example? whereas (say) Python uses English words; it's a lot more fun to crunch something down when you can use $| That's not a keyword but a special (global) variable. On top of that, you don't have to use it [1] and most people most likely encounter this in (badly) written CGI scripts originating in the last century. Yes, Perl is fantastic for writing hard to read obfuscated code. And yes, newbies are great at writing this from the very start, especially since they seem to copy paste examples written by other newbies (often written in the previous century...). But Perl doesn't force one to write unreadable code. If Perl was really so unreadable, why haven't I /still/ not switched to Python? What keeps me going back to Perl? and friends than when you have to put x and y, complete with spaces, for a simple boolean. Perl has also the and logical operator. This is legal Perl: if ( $x and $y ) { print yes\n; } [1] You can use $OUTPUT_AUTOFLUSH (use English;), or use IO::Handle and use the autoflush method [2]. [2] In Perl 5.14 IO::File is now loaded on demand: http://search.cpan.org/dist/perl/pod/perldelta.pod#Filehandle_method_calls_load_IO::File_on_demand -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: http://castleamber.com/ Perl for books:http://johnbokma.com/perl/help-in-exchange-for-books.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Why did Quora choose Python for its development?
Chris Angelico ros...@gmail.com writes: On Wed, May 25, 2011 at 9:16 AM, John Bokma j...@castleamber.com wrote: Chris Angelico ros...@gmail.com writes: Yes, I believe that was Perl. And an amusing quote. But most of the point of it comes from the fact that Perl uses punctuation for most of its keywords, For example? whereas (say) Python uses English words; it's a lot more fun to crunch something down when you can use $| That's not a keyword but a special (global) variable. On top of that, you don't have to use it [1] and most people most likely encounter this in (badly) written CGI scripts originating in the last century. Okay, poor example. But there's a lot of Perl that uses concise notation for things that in Python are keyworded; for instance, regular expressions. Perl does have indeed operators for matching and substitution. It's: ( my $foo = $bar ) =~ s/ ... / ... /; versus foo = re.sub(r ... , ... , bar ) and: my $foo = qr/ ... /xi; versus: foo = re.compile(r ... , re.IGNORECASE|re.VERBOSE) It's just a matter of taste IMO. The regular expression noise stays the same ;-). and friends than when you have to put x and y, complete with spaces, for a simple boolean. Perl has also the and logical operator. This is legal Perl: if ( $x and $y ) { print yes\n; } That's at a completely different precedence level, isn't it? Yes, /but/ in this case it doesn't matter. Of course there are cases that it /does/ matter: For instance: $a = $b $c ? $e : $f; # versus $a = $b and $c ? $e : $f; The first one is an assignment to $a, conditional on two variables. The second is an unconditional assignment to $a, and then based on that, evaluates either $e or $f and does nothing with it. Python: a = e if b and c else f Yes, recently added to the language, before that you had to and or your way out of it (or use lambdas). It's pretty similar, actually (although, coming from a C background, I do prefer to have the condition first); but I could crunch the first one down a lot, while the last one is almost as tight as it can be. $a=$b$c?$e:$f; a=e if b and c else f It's that crunched appearance that makes Perl look like line noise, So you just agree with what I earlier wrote: one /can/ write harder to read in Perl, like you can jump off a cliff. And I have seen a lot of extremely badly written Perl code, but never seen a disaster like the one above ;-). and the open keyworded appearance that makes Python look like pseudocode. But that's not necessarily a good thing; a courteous programmer can space out Perl to keep it readable, and he then has the option of crunching pieces that are 'logically one' and spacing out the parts that aren't: $a= $b$c ? $e : $f; Silly, contrived example, but in production code I've often had situations where it makes sense to space out one part of an expression and crunch another. And when everything's an English word, that's not an available option. I would write it like $a = ( $b and $c ) ? $e : $f; That said, though, I do find Python a lot easier for reading other people's code in. A LOT easier. Like I wrote earlier: I find Perl easier to read. And honestly, I don't know why. Partially it might have a lot to do with having been exposed to it much more. But many years back, when I could pick between several languages, Perl was the one that stuck with me. And that was before everybody and his mom was hacking CGI scripts in Perl (badly). And while I do want to switch to Python (or use it more often), for one reason or another it's hard. Maybe it's for similar reasons that one loves Spanish but hates German as a second language (or vice versa)? Both Perl and Python are evolving. Perl has a lot of bagage from the beginning, and more so since a lot got slapped on later on. Things are changing, but you just can't make major changes since people, like me I guess, are used to how things are right now. I now and then have peeks at Perl 6 and each time my first reaction is: this is Perl only in name; it's very, very different. On the other hand it still shares what I consider warts with Perl 5. -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: http://castleamber.com/ Perl for books:http://johnbokma.com/perl/help-in-exchange-for-books.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Why did Quora choose Python for its development?
Chris Angelico ros...@gmail.com writes: That said, though, I still do not believe in Python's philosophy of significant whitespace. I like to be able, if I choose, to put one entire logical unit on one line, such that it can be commented out with a single comment marker, Use an editor that can with a single command comment out a selection (and revert this), like Emacs. -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: http://castleamber.com/ Perl for books:http://johnbokma.com/perl/help-in-exchange-for-books.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Why did Quora choose Python for its development?
Octavian Rasnita orasn...@gmail.com writes: From: Daniel Kluev dan.kl...@gmail.com a = [1,2] dict([a]) Yes, but d = dict([a]) is not so nice as $d = @a; That will give you the number of elements in @a. What you (probably) mean is %hash = @array; -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: http://castleamber.com/ Perl for books:http://johnbokma.com/perl/help-in-exchange-for-books.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Why did Quora choose Python for its development?
Terry Reedy tjre...@udel.edu writes: I forget the exact question you asked, but this list is not the doc. The doc section on dicts gives dict(list_of_key_value_pairs) as the one true way, given such an input. The Perl way cannot be clearer and can only be shorted if it uses something shorter that dict(). my %hash = @list_of_key_value_pairs; -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: http://castleamber.com/ Perl for books:http://johnbokma.com/perl/help-in-exchange-for-books.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Abandoning Python
John J Lee j...@pobox.com writes: /troll I still like Python after using it for over a decade, but there are things I don't like. What are your favourite up-and-coming languages of the moment? Here's my wishlist (not really in any order): * A widely used standard for (optional) interface declaration -- or something better. I want it to be easier to know what interface an object has when reading code, and which objects provide that interface. * Lower memory usage and faster execution speed. Yes, this has been a price worth paying. But I do want jam on it, please: give me a language where I get most of Python's advantages but don't have to pay it. * Better support for writing correct programs in the form of better support for things like non-imperative programming, DBC, etc. (with the emphasis on etc). * Perhaps better built-in support for common tasks in common application domains. Concurrency, persistence, database queries come to mind. * Better refactoring tools, better code analysis tools (lint, search, etc.). * An even larger user base, contributing more and better free and commercial software. I'm prepared to compromise on the last one. Obviously, it should do all that while preserving all the nice features of Python -- surely an easy task. A language I want to give a serious try the coming months is Haskell. -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: http://castleamber.com/ Perl for books:http://johnbokma.com/perl/help-in-exchange-for-books.html -- http://mail.python.org/mailman/listinfo/python-list
Re: obviscating python code for distribution
Chris Angelico ros...@gmail.com writes: On Thu, May 19, 2011 at 2:54 AM, 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 as a secure system. As a developer you should aim for it. Agreed. Things can be secure if you accept caveats. A good server might be secure as long as attackers cannot, say: * Get physical access to the server, remove the hard disk, and tamper with it * Hold a gun to the developer and say Log me in as root or you die * Trigger a burst of cosmic rays that toggle some bits in memory You forgot the most important one: * if none of the software running on it has exploitable issues Personally, I think it's best to understand that no server is ever secure and hence one must always be prepared that a breach can happen. -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: http://castleamber.com/ Perl for books:http://johnbokma.com/perl/help-in-exchange-for-books.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Hello Friends
Alister Ware alister.w...@ntlworld.com writes: On Thu, 05 May 2011 21:55:22 -0700, Ashraf Ali wrote: Do you need legal help.If so Please visit sorry I would only use a reputable firm (spaming a news group makes you disreputable by default) Does it make you disreputable? Since you just repeated the spamvertized URL... -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: vertical ordering of functions
Ben Finney ben+pyt...@benfinney.id.au writes: Jabba Laci jabba.l...@gmail.com writes: Is there a convention for this? Should main() be at the top and called function below? No, it's Python convention for both of those to be at the end of the module. I follow the convention described by Guido van Rossum in URL:http://www.artima.com/weblogs/viewpost.jsp?thread=4829. Thanks Ben, very useful link. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Teaching Python
Passiday passi...@gmail.com writes: Hello, I am planning to teach Python to a group of high school students, who have in-depth interest in programming, hacking etc. I am looking for some good material, what I could use as a basic guide when preparing the classes plan for the course - website or book, what would roll out the topic methodologically gradually. The target audience is someone who knows most basics of the programming, but doesn't mind being reminded about them now and then. So you want them to Dive into Python [1]? ;-) [1] Google for it, it's an online book, free downloadable for both 2.x and 3.x -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python IDE/text-editor
rusi rustompm...@gmail.com writes: [ Notepad - Emacs ] If all one seeks is 'notepad-equivalence' why use any key-binding? All this basic ('normal') stuff that other editors do, emacs can also do from menus alone. OK, true. Anyway, I highly doubt anyone using Notepad as an editor is going to switch to Emacs to begin with :-D. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python IDE/text-editor
Bastian Ballmann ba...@chaostal.de writes: Am Sat, 16 Apr 2011 22:22:19 -0500 schrieb John Bokma j...@castleamber.com: Yeah, if you bring it down to open a file, save a file, and move the cursor around, sure you can do that in a day or two (two since you have to get used to the weird key bindings). Sorry but learning the basic stuff doesnt take any longer than 10 to 30 minutes and if one doesnt want to learn the shortcuts one can use GNU/Emacs GUI and click around. My experience is different, but I am sure that we define basic stuff different. Things like how copy paste works, deleting, and undo (and redo!) will take certainly more than 10-30 minutes. Unless you don't want to use those features, that is. Even if you do everything via the menus (and who reads here is going to do that) there are still surprises (where is redo?). Configuring it to do Python optimal could took some hours / days some time ago, but now it just takes setting up Emacs for Python and you have syntax highlighting, code templates, refactoring and auto-completion support. Yeah, sure. And learning Python takes also just 5 days... Like I wrote, I am still learning Emacs (and Python). And I don't think I am more dense than you. Just more honest about learning ;-). -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python IDE/text-editor
Alec Taylor alec.tayl...@gmail.com writes: Emacs and vim are good, however I often find myself on a workstation without direct console access. Emacs and vim can also work in a GUI enviroment. GVim leaves a lot aesthetically desired. Ditto for Emacs. It misses the bling bling. But are you really looking at all those shiny GUI elements when editing? I've turned off the icon bar in Emacs (pointless) and rarely use the menu if ever. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python IDE/text-editor
Alec Taylor alec.tayl...@gmail.com writes: Thanks, but non of the IDEs so far suggested have an embedded python interpreter Emacs has. Well, it's not embedded as *in* Emacs, but I don't think there are many editors that have that besides the ones written in Python. AND tabs... Emacs has no tabs per se (although it wouldn't surprise me if there is an extension that does this) but can show a list of buffers. Also, you can switch very easily between buffers. I used to work a lot with Textpad /because/ of the tabs, but don't miss them with Emacs. Another feature I love is the ability to /split/ a window in 2 parts to have 2 views on the same buffer. And being able to open another window with another view on the same buffer. a few of the editors (such as Editra) have really nice interfaces, however are missing the embedded interpreter... emacs having the opposite problem, missing tabs (also, selecting text with my mouse is something I do often). You can select text just fine with a mouse in Emacs. Anyway, checked for tabs. http://www.emacswiki.org/emacs/TabBarMode The remark at the bottom states: Aquamacs tabbar work with standard emacs.Just check it out. - Emmett What I love so much about Emacs is that each feature I've wanted so far is either part of it, or can be installed. Sometimes I have to change how I think about the feature a bit, but so far, so good. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python IDE/text-editor
Jorgen Grahn grahn+n...@snipabacken.se writes: If you cannot stand non-tabbed interfaces, you probably can't stand other non-Windows-like features of these two, like their menu systems. Emacs just has a menu system. Although I rarely use it :-). One of the things one learns after some time with either vim or Emacs is that using the mouse delays things. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python IDE/text-editor
candide candide@free.invalid writes: Le 16/04/2011 15:50, Adam Tauno Williams a écrit : gedit provides a Python interpreter/console 'embedded' in the GUI (provided the plugin is enabled). I agree, cf. this screenshot : http://i52.tinypic.com/snj7a0.jpg The name Terminal suggests something different, and that can be achieved in Emacs as well. Just split a window vertical horizontal, enable tabbar-mode[1], and open a shell in the bottom one, overview of the buffers to the left, and your hello_world.py to the top right. [1] which is part of the Emacs version I am using, I just learned. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python IDE/text-editor
rusi rustompm...@gmail.com writes: On Apr 16, 9:13 pm, Chris Angelico ros...@gmail.com wrote: Based on the comments here, it seems that emacs would have to be the editor-in-chief for programmers. I currently use SciTE at work; is it reasonable to, effectively, bill my employer for the time it'll take me to learn emacs? It takes a day or two to learn emacs. That's an extremely bold statement. I still haven't learned Emacs and have read most of the Emacs manual, some parts twice. Unless you mean openening a file, saving a file, and some basic cursor movements. It takes forever to set it up. If you mean to make work optimally for your way of editing, probably true. You can keep fine tuning, adding/testing stuff, etc. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python IDE/text-editor
Chris Angelico ros...@gmail.com writes: On Sun, Apr 17, 2011 at 2:32 AM, Andrea Crotti andrea.crott...@gmail.com wrote: That of course is an issue, but since you code in many languages I think is really a pretty good investment for your future. And I don't think that you would be unproductive the first weeks with emacs, just a bit slower maybe, and it's not that you can't use anything else in the meanwhile... Sure, that was a *slight* exaggeration :) but thanks for the advice. I'll poke around with it some time. I tried that several times over years, and never worked. What did the trick for me was just switching to Emacs, and read the GNU Emacs Manual thoroughly and making notes. And the next day try what I read the day before. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python IDE/text-editor
rusi rustompm...@gmail.com writes: On Apr 17, 3:19 am, John Bokma j...@castleamber.com wrote: rusi rustompm...@gmail.com writes: On Apr 16, 9:13 pm, Chris Angelico ros...@gmail.com wrote: Based on the comments here, it seems that emacs would have to be the editor-in-chief for programmers. I currently use SciTE at work; is it reasonable to, effectively, bill my employer for the time it'll take me to learn emacs? It takes a day or two to learn emacs. That's an extremely bold statement. I still haven't learned Emacs and have read most of the Emacs manual, some parts twice. Unless you mean opening a file, saving a file, and some basic cursor movements. Aren't there people (many in fact) who use notepad or equivalent to write programs? How many features do they use? How long would it take to make a map of those same features in emacs? Yeah, if you bring it down to open a file, save a file, and move the cursor around, sure you can do that in a day or two (two since you have to get used to the weird key bindings). And add a handful more to make the switchover worthwhile? That's somewhat I did: I used TextPad a lot, and at first I looked for how to do what I could in TextPad in Emacs (hence reading the book). But that took longer than a day. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python IDE/text-editor
Ben Finney ben+pyt...@benfinney.id.au writes: Alec Taylor alec.tayl...@gmail.com writes: I'm looking for an IDE which offers syntax-highlighting, code-completion, tabs, an embedded interpreter and which is portable (for running from USB on Windows). Either of Emacs URL:http://www.gnu.org/software/emacs/ or Vim URL:http://www.vim.org/ are excellent general-purpose editors that have strong features for programmers of any popular language or text format. I second Emacs or vim. I currently use Emacs the most, but I think it's good to learn both. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Guido rethinking removal of cmp from sort method
Terry Reedy tjre...@udel.edu writes: But the Perl 6 fiasco Perl 6 a complete failure? Wow, must be coming from a clueless Python zealot. If Perl 6 is a fiasco, so is Python 3. Both are not considered production ready, and both can be downloaded and used today: http://rakudo.org/ Next release is planned for later this month. Did Perl 6 take a long time? Sure. But confusing it with Python 2 - Python 3 is just plainly stupid. It's a complete rewrite of Perl, and it's much easier to think of it as a complete new language instead of similar to Perl 4 - 5 and comparable to Python 2 - 3. But if you had any idea what you were talking about, you already knew that. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: call php function from python
CrabbyPete pete.do...@gmail.com writes: I have a python script that automatically loads wordpress, up to the point that it asks for the admin password. that is a php function call function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '' ) Is there a way to call this function from python? What do you mean with loads wordpress? I think the easiest thing to do, and what I've done in the past, is to call Wordpress via its web interface. I.e. instead of trying to find out how to call wp_install, use the post method with the right data and the right URL. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Learn Python the Hardway exercise 11 question 4
Chris Angelico ros...@gmail.com writes: On Fri, Apr 1, 2011 at 8:57 AM, geremy condra debat...@gmail.com wrote: I know it's tongue-in-cheek, but please, please, please don't do this. It would be more secure to base64 it and then rot13 the output. Rot-13 twice, to make it even more secure ;-) -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem with re module
John Harrington beartiger@gmail.com writes: I'm trying to use the following substitution, lineList[i]=re.sub(r'(\\begin{document})([^$])',r'\1\n\n \2',lineList[i]) I intend this to match any string \begin{document} that doesn't end in a line ending. If there's no line ending, then, I want to place two carriage returns between the string and the non-line end character. However, this places carriage returns even when the string is followed directly after with a line ending. Can someone explain to me why this match is not behaving as I intend it to, especially the ([^$])? [^$] matches: not a $ character You might want [^\n] -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: ImSim: Image Similarity
n00m n...@narod.ru writes: http://www.nga.gov/search/index.shtm http://deyoung.famsf.org/search-collections etc Seems they all offer search only by keywords and this kind. What about to submit e.g. roses2.jpg (copy) and to find its original? Assume we don't know its author neither its title Title: TinEye, author: http://ideeinc.com/ Search: http://www.tineye.com/ Example: http://www.tineye.com/search/2b3305135fa4c59311ed58b41da5d07f213e4d47/ Notice how it finds modified images. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: ImSim: Image Similarity
n00m n...@narod.ru writes: On Mar 6, 10:17 pm, n00m n...@narod.ru wrote: On Mar 6, 8:55 pm, John Bokma j...@castleamber.com wrote: n00m n...@narod.ru writes: http://www.nga.gov/search/index.shtm http://deyoung.famsf.org/search-collections etc Seems they all offer search only by keywords and this kind. What about to submit e.g. roses2.jpg (copy) and to find its original? Assume we don't know its author neither its title Title: TinEye, author:http://ideeinc.com/ Search:http://www.tineye.com/ Example: http://www.tineye.com/search/2b3305135fa4c59311ed58b41da5d07f213e4d47/ Notice how it finds modified images. -- John Bokma j3b Blog:http://johnbokma.com/ Facebook:http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development:http://castleamber.com/ It's for kids. Such trifles can easily be cracked by e.g. Jorgen Grahn's algo (see his message) Even his algo will be an overhead. Comparing meta-data/EXIF of image files will be enough in 99% cases. Yes, yes, we get it. You're so much smarter (but not smart enough to not quote a signature...). Anyway, I guess that's the reason big names use tineye and not your algorithm... -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: ImSim: Image Similarity
n00m n...@narod.ru writes: As for proper quoting: I read/post to this group via my web-browser. And for me everything looks OK. I don't even quite understand what exactly do you mean by your remark. I'm not a facebookie/forumish/twitterish thing. Exactly. It's Usenet, something I've been using for, oh, just over 20 years now, and even then it was not new. You know, before the web thing you're talking about... -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python programming books
David Keeler dkeeler2...@sbcglobal.net writes: I am relatively new to python. I've been reading online docs and tutorials for 4-5 weeks now, but I like actual books. I am not new to programming and I have worked with quite a few languages. I'd like a good reference with basic stuff including classes and maybe some web programming, sockets, tkinter, good explanation of classes and all that OO stuff. I want to work with version 3 since 3.2 was just released. Can anyone suggest a recent book that might fit the bill? A book that I can't recommend enough is: Programming in Python 3. Make sure that you buy the 2nd edition. http://www.amazon.com/Programming-Python-Complete-Introduction-Language/dp/0321680561/ I also own Dive into Python 3. Haven't read it yet, but I liked Dive into Python a lot, and I am sure that DiP3 is even better. I notice that Amazon has a CreateSpace edition (you can download DiP3 from the author's website). I own the APress edition. As for the reviews: Someone gave the 2nd edition of PiP3 3 stars because (s)he is upset that the 2nd edition came out shortly after the 1st edition. In general: some reviewers give bad reviews because of Amazon shipping late, shipping a damaged book, or just because they didn't do enough research and got the wrong book. I also like the Python Essential Reference a lot. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Creating Long Lists
alex23 wuwe...@gmail.com writes: On Feb 22, 12:57 pm, Kelson Zawack zawack...@gis.a-star.edu.sg wrote: I did not bother to further analyze or benchmark it. Since the answers in the above forums do not seem very definitive I thought I would inquire here about what the reason for this decrease in performance is, and if there is a way, or another data structure, that would avoid this problem. The first link is 6 years old and refers to Python 2.4. Unless you're using 2.4 you should probably ignore it. The first answer on the stackoverflow link was accepted by the poster as resolving his issue. Try disabling garbage collection. I just read http://bugs.python.org/issue4074 which discusses a patch that has been included 2 years ago. So using a recent Python 2.x also doesn't have this issue? -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: sqlite autoincrement of primary key
tinauser tinau...@libero.it writes: however, if in python i try to execute a script like: cur.execute( ''' INSERT INTO 'foo' VALUES (?,?) ''' ,('NULL','yyy')) ,(None, 'yyy')) Or use VALUES(NULL, ?) as suggested in another post. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: IMAP support
pakalk pak...@gmail.com writes: Hello, Can anyone help me find GOOD IMAP library for python? Imaplib is.. ekhm... nevermind... Is there any good library? Instead of pissing on something it helps to actually state what's missing from it. Or give a list of what you're looking for. Nevermind is so ekhm... nevermind... -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Crummy BS Script
flebber flebber.c...@gmail.com writes: On Oct 2, 4:24 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Fri, 01 Oct 2010 21:05:09 -0700, flebber wrote: On Oct 2, 9:27 am, MRAB pyt...@mrabarnett.plus.com wrote: On 01/10/2010 23:29, Burton Samograd wrote: flebberflebber.c...@gmail.com writes: But where is this saving the imported file and under what name? Looks like samples.csv: f = open('samples.csv', 'w') How do change where output goes and what its called f = open('samples.csv', 'w') were else? Maybe read a beginners book on Python before you start on a path of Cargo Cult Coding? -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: toy list processing problem: collect similar terms
Xah Lee xah...@gmail.com writes: can you stop this? Can you stop crossposting? And if there is really, really a need to crosspost, can you please set the follow-up to? doesn't seems fruitful to keep on this. if you don't like my posts, ignore them? i don't post in comp.lang.python or comp.lang.perl.misc that often... maybe have done so 5 times this year. Which is enough to disrupt those groups for days. i visited your home page http://johnbokma.com/mexit/2010/08/15/ and there are really a lot beautiful photos. Thanks Xah. Like I wrote, your site /does/ have good information, it's so sad that you somehow think it's necessary to spam Usenet to get visitors. Or maybe you've another reason, don't know. But it /is/ Usenet abuse. this isn't bribery or something like that. I've been annoyed by you, of course, but it's not fruitful to keep going on this. Well, you annoy me, I annoy you. It's in your hands to make it stop. My advice is: 1) remove all the excessive swearing from your site. If you have a point, you don't need it. Your argument(s) without the swearing should speak for themselves 2) Stop abusing Usenet. Instead focus on writing more good stuff on your site. 1) 2) will keep me from linking to your site, ever. And I am sure I am not alone in this. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: toy list processing problem: collect similar terms
Paul Rubin no.em...@nospam.invalid writes: John Bokma j...@castleamber.com writes: Xah Lee xah...@gmail.com writes: ... Can you stop crossposting? John, can you ALSO stop crossposting? Since the issue is on-topic in all groups: no. I did set a follow-up header, which you ignored and on top of that redirected the thing to comp.lang.python. So: Paul, can you ALSO stop acting like a complete ass? -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
How to Deal with Xah Lee Spam/Abuse (was: toy list processing problem: collect similar terms)
Seebs usenet-nos...@seebs.net writes: On 2010-09-26, Xah Lee xah...@gmail.com wrote: On Sep 25, 11:17??pm, Paul Rubin no.em...@nospam.invalid wrote: Python solution follows (earlier one with an error cancelled). ??All crossposting removed since crossposting is a standard trolling tactic. btw, i disagree about your remark on crossposting. You're wrong. FYI: Xah Lee is well known for his abuse of cross posting. Be happy that Google Groups limits the number of groups to crosspost to five. Related: his spamming behaviour has already resulted in Xah Lee having to look for another hosting provider [1]. Currently 1and1 provides him shelter, most likely carefully selected by Xah (as Google Groups) since 1and1 is not known for their spam fighting reputation nor clue. But one can only hope, so if you want to do something about this Xah thing, please report it with 1and1 and ab...@google.com. He won't learn respect from it, but maybe you end up being honored [2] on his collection of drivel [3]. In short: = don't reply to Xah Lee: at best it's a waste of time = if his post is abusive (crossposting to 5 groups just because you can is) report it with /and/ his hosting provider (since most of his posts are copy paste jobs of articles on his site just to drive traffic) and Google Groups (his Usenet provider of choice since they hardly do a thing about spam). [1] http://www.mail-archive.com/python-list@python.org/msg91631.html [2] http://www.google.com/search?q=site%3Axahlee.org%20bokma [3] What's sad is that some of its stuff is actually good/not bad. But tainted: Xah Lee is a spammer and a Usenet abuser. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: toy list processing problem: collect similar terms
Seebs usenet-nos...@seebs.net writes: On 2010-09-26, J?rgen Exner jurge...@hotmail.com wrote: It was livibetter who without any motivation or reasoning posted Python code in CLPM. Not exactly; he posted it in a crossposted thread, which happened to include CLPM and other groups, including comp.lang.python. It is quite possible that he didn't know about the crossposting. Oh, he does. It has been Xah's game for years. while I would agree that this would constitute a form of ignorance, I'd think that, especially with how well some newsreading interfaces hide that detail, I don't think it's really worth getting angry over. You think wrong. And Jurgen should have known better than to reply several times (but like too many people in cplm he posts for posting's sake, the main reason why I don't follow that group anymore). Xah has been doing this for many years and most of his posts are just made to drive traffic to his site (hence they are copy paste of articles on his site + link(s) to his site). It's Usenet abuse, on purpose. The reason it pisses off people is that nearly weekly it causes a lot of noise in newsgroups that are really better off without the noise (IMNSHO). See my other post on how to deal with this spammer. If you've missed it: report him for spamming, since that's what he does. It already made him have to move hosting providers once. While it's not going to stop him, it will cost him money. See: http://www.google.com/search?q=site%3Axahlee.org%20bokma While I am named in that article be assured that I was not the only one contacting dreamhost (+10 for doing this, btw). Quite some people contacted me via email that they also talked with Dreamhost. Just keep reporting this spammer, and maybe 1and1 will kick it out. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: toy list processing problem: collect similar terms
Seebs usenet-nos...@seebs.net writes: fup set to poster On 2010-09-28, John Bokma j...@castleamber.com wrote: Seebs usenet-nos...@seebs.net writes: On 2010-09-26, J?rgen Exner jurge...@hotmail.com wrote: It was livibetter who without any motivation or reasoning posted Python code in CLPM. Not exactly; he posted it in a crossposted thread, which happened to include CLPM and other groups, including comp.lang.python. It is quite possible that he didn't know about the crossposting. Oh, he does. It has been Xah's game for years. But did livibetter know about it? I wasn't defending Xah, who is indeed at the very least clueless and disruptive. Heh, he's not clueless, the problem is that he knows exactly what he's doing. And like most spammers, very hard to get rid off. But I was sort of defending the poster who was accused of posting Python code in CLPM, because that poster may not have understood the game. Ah, clear. Well, the problem is somewhat also in CLPM where people somehow have to reply to messages like this :-(. And I am sure Xah laughes his ass off each time it happens. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: toy list processing problem: collect similar terms
Jürgen Exner jurge...@hotmail.com writes: livibetter livibet...@gmail.com wrote: Here is mine for Python: What the f*** does Python have to do with Perl? Clueless fuck. I unsubscribed from comp.lang.perl.misc to avoid the retards like you and now you come in via the backdoor. If you have a problem with Xah report him with Google Groups and with his hosting provider 11 like I do. Dreamhost kicked him out that way. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Down with tinyurl!
Steven D'Aprano steve-remove-t...@cybersource.com.au writes: You know, I'd give my right arm -- well, perhaps somebody else's right arm -- for the opportunity to some day to be interviewing an ex-RIAA executive, just so I can say: I see from your CV that you took millions of customers and made them so mad at you that not only did they break the law to give you the finger, but they promised to never, ever pay a cent for your products again. So tell me, how did that business strategy work out for you? I guess he will smile at you and blind you with his diamond teeth :-D. Also, the RIAA has been breaking the law as well. They do it via hired sneeky companies, but in my book they are still responsible. (dDOS of torrent sites/clients) -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Too much code - slicing
Steven D'Aprano steve-remove-t...@cybersource.com.au writes: For completeness sake: code = side == 'l' ? dir[int(num):] : dir[:-1*int(num)] code = if side == 'l' then dir[int(num):] else dir[:-1*int(num)] code = side == 'l' if dir[int(num):] else dir[:-1*int(num)] code = dir[int(num):] if side == 'l' else dir[:-1*int(num)] If you ask me, the *least* hard to read is the last. For me the (newly added) first one, because it has (for me) less noise. But I can certainly live with the last one. Or all for that matter. Or maybe: since the results are already somewhat complex (or noisy) I probably would use a normal if else. What surprises me is that this is still discussed. It's like argueing about significant whitespace. :-) -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Too much code - slicing
Seebs usenet-nos...@seebs.net writes: I dunno. I like the next if /^$/ idiom, I don't (as a Perl programmer), I prefer: $line =~ /^$/ and next; Or: $line ne '' or next; which I read as: line must not be empty -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Down with tinyurl!
geremy condra debat...@gmail.com writes: It's a joke. Admittedly it's a bit pointed, but it's a joke nonetheless, and it does at least provide what I consider to be two valuable pieces of information: that you should have googled this before asking, and what you should have googled for. If I miss and you've done your homework already, well, at least you get the smug satisfaction of knowing that I was too stupid to understand your question. It makes you a patronizing fuck in my book. And no, that's not a joke. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Down with tinyurl!
Steven D'Aprano steve-remove-t...@cybersource.com.au writes: I prefer the old fashioned version: Google Is Your Friend followed by a URL to the appropriate google's search results page. Or even more to the point: Did you bother to google for the answer first? Because the very first page that comes up gives exactly the answer you want. Although sometimes people genuinely don't know what search terms they should be using, or if they're too generic. Yes, exactly. I agree 100% with you (including the microsecond amusement value of lmgtfy). Besides the link to the SERP I also provide a link to what I consider the best result found on that page. Sometimes people were able to find the result, and thought it was not right. Or were not able to find the best solution out of the hundreds offered by Google. And some people are ashamed of telling that they have used Google, and couldn't find it. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Down with tinyurl!
Dennis Lee Bieber wlfr...@ix.netcom.com writes: On 21 Sep 2010 05:01:45 GMT, Steven D'Aprano steve-remove-t...@cybersource.com.au declaimed the following in gmane.comp.python.general: Hey, that would be an *awesome* google bombing project... to get lmgtfy to come up as the first link for self-righteous dicks. 4chan, where are you when we need you??? I think the news reports are that they are wasting time on a DDoS attack on the RIAA... While I don't agree with the RIAA's methods, I also think a DDoS is definitely NOT an action to endear one to that one's views... It is/was, from what I understand, a back at ya since the RIAA hired a company in India to DDoS torrent related sites. The Indian company is/was also under DDoS. I do agree that it's somewhat pointless. They better could block access to movie theaters all over the world by chaining themselves to the entry. But, hey, then they have to get out of the couch and get out of the house. And their moms might start to ask questions... -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Down with tinyurl!
Dennis Lee Bieber wlfr...@ix.netcom.com writes: On Mon, 20 Sep 2010 20:12:01 -0500, John Bokma j...@castleamber.com declaimed the following in gmane.comp.python.general: I never saw the point of the whole X-No-Archive: Yes thing. What happens if I quote such a message? It's archived, right? Compliant clients (like Agent) will echo the X-No-Archive: Yes in YOUR reply -- so it too will be deleted at some point in time. Ouch, while asking me first, I hope? -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Down with tinyurl!
Lawrence D'Oliveiro l...@geek-central.gen.new_zealand writes: In message 87aanbx5lq@castleamber.com, John Bokma wrote: I never saw the point of the whole X-No-Archive: Yes thing. What happens if I quote such a message? It's archived, right? Where did they come from? Posting fragments, followed up-- Originals? No more. L a s p ENTER -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Down with tinyurl!
Tim Harig user...@ilthio.net writes: I question first whether most tinyurl links are really of such an intransient nature that they need to be long lasting. I personally use them most when writing paper notes. They only need to last long enough for me, or whoever I made the note for, to get back to them. As an additional note: tinyurl allows one to enter a postfix to use, so instead of /xc4ax7 you can have /something-more-readable. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Too much code - slicing
Seebs usenet-nos...@seebs.net writes: On 2010-09-20, John Bokma j...@castleamber.com wrote: I didn't mean that there are spoilers in the first 70 pages, just that to me the excercise would spoil the book, so, I wouldn't do it. I consider a book like a meal, I wouldn't gobble down food, regurgitate it, and eat it again at a slower pace. Books, movies, family, walks are the things I prefer to do at a normal mudane pace, or even slower, if I can bring myself to it. My favourite books I try to read slow, and enjoy. ;-). Too much of my life is already in overdrive. Now that you explain it like this, that makes a fair bit of sense. I often wonder whether reading slowly would be more pleasant. I have no idea how to do it, so the question remains theoretical. By practicing ;-). I have it worse with movies, but in my case, for several reasons, it's really important (to me) that I watch the movie at it's normal pace and try to enjoy it at that speed. Talking about reading: if you have any suggestions, feel free to email me (since this is already way off topic). I read mostly in my second language, English, and live in a country where English books are hard to find, so browsing in bookshops is not much of an option :-(. And most of my (online) friends don't read much, if at all. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: [OT] Speed-reading
Steven D'Aprano st...@remove-this-cybersource.com.au writes: spelling or grammatical errors and clumsy writing. *Especially* the spelling errors, they have about the same effect on her reading speed as a tree trunk lying across a Formula 1 race track. Spelling errors are a disaster, somehow they stand out like they use Comic Sans Bold and red ink. Most likely because they break the pattern. I seem to find them more and more often in the books I read, maybe because I use English (my second language) more and more. As for speed reading, there are many levels to do this: one can call scanning a page really fast left-right, moving as fast to the bottom as possible speed-reading, or reading each and every sentence just as fast as possible speed reading. The faster one goes, the more is lost. The total # of pages in Harry Potter seems to be just over 4000 [1]. If an afternoon is 4 hrs, this means 1000 pages an hour, or 17 pages/minute. One has to do skimming to read that fast. With 250 words/page the reading speed would be over 4K words/minute, which would make your wife a serious competitor for Anna Jones (4.7K words/minute, 67% comprehension, see [2]) In my native language I read just above 1 page a minute, if the pages are not too dense I can do sometimes 2. In English I can often get close to 1 page a minute, except with books that are quite dense (think fantasy). So I guess around 300-350 wpm in Dutch, 250 wpm in English (normal pace). [1] http://wiki.answers.com/Q/What_is_the_total_number_of_pages_in_the_%27Harry_Potter%27_series [2] http://en.wikipedia.org/wiki/Speed_reading#Claims_of_speed_readers -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Too much code - slicing
Terry Reedy tjre...@udel.edu writes: On 09/19/2010 10:32 PM, John Bokma wrote: the spoiler. Do you fast forward movies as well? I sometimes watch movies (or parts thereof) on 1.5x, especially if it has a lot of 'filler' scenes. But only when my wife is not watching, as she hates it. Heh, my question was somewhat rhetorical. I watch movies to slow myself down, so 1.5x is not an option. Same reason I read books slow (well, at a normal pace). If I don't I end up not being able to sleep and things go downhill from there. Also, I notice that if I want to run everything on 1.5x (or more) that I become quite annoying to the rest of my family and I want to enjoy them now, when I can. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Down with tinyurl!
Steven D'Aprano st...@remove-this-cybersource.com.au writes: On Mon, 20 Sep 2010 17:25:09 +, Tim Harig wrote: And as a datapoint on the topic of archiving, I search usenet archives regularly when faced with a problem. Usernet users also have the right to use the X-No-Archive header field. They do? Is that right enshrined by law somewhere? Can I go to jail for human rights abuses if I archive X-No-Archive posts? I think they do have the right to use it as you have the right to ignore it ;-) I never saw the point of the whole X-No-Archive: Yes thing. What happens if I quote such a message? It's archived, right? -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Down with tinyurl!
Tim Chase python.l...@tim.thechases.com writes: On 09/20/10 20:12, John Bokma wrote: Steven D'Apranost...@remove-this-cybersource.com.au writes: On Mon, 20 Sep 2010 17:25:09 +, Tim Harig wrote: Usernet users also have the right to use the X-No-Archive header field. They do? Is that right enshrined by law somewhere? Can I go to jail for human rights abuses if I archive X-No-Archive posts? I think they do have the right to use it as you have the right to ignore it ;-) I never saw the point of the whole X-No-Archive: Yes thing. What happens if I quote such a message? It's archived, right? The point? It's much shorter than X-Stick-your-fingers-in-your-ears-close-your-eyes-and-yell-la-la-la-ignorantly-hoping-people-will-delete-this-message-after-some-arbitrary-period-of-time: Yes. Well, X-Archive: No is even shorter ;-). What I mean is, it's just a request, nothing more and nothing less. DejaNews honored it, and Google still does. But it doesn't stop other people from archiving posts. I can imagine that for some automatic generated messages someone might think XNA is a good thing. But for human written messages, I just don't see the point. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Down with tinyurl!
Seebs usenet-nos...@seebs.net writes: And this caused me to realize just how amazingly insulting that can be when done to someone who *did* already do the research. Exactly. I hate lmgtfy links hidden in a tiny url. It's not only insulting to the OP but also to people who try to learn something and end up on a google search page they could've come up with themselves. While certainly there's plenty of people who didn't do their own searching, there's also a fair number who are asking a question because they DID try searching and there was some problem with one or more of the answers. Yup, exactly. Or people who did a lot of searching but somehow were not able to compile a good query. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Too much code - slicing
AK andrei@gmail.com writes: On 09/19/2010 07:18 PM, Gregory Ewing wrote: AK wrote: Afaik the idea is that you can read a novel at the speed of half a page a second or so and understand it to the same extent as people who'd read at a normal rate. I've never understood why anyone would *want* to read a novel that fast, though. For me at least, reading a novel is something done for pleasure, so reading it at ten times normal speed would waste 90% of the benefit. One definite advantage would be that if, say, it takes you 70 pages of a given novel to figure out whether you like it enough to continue, you'd want to read those pages in 2 minutes rather than an hour. Heh, to me speed reading those 70 pages in a very short while, concluding that it's a good book, and start over again would be quite the spoiler. Do you fast forward movies as well? I do speed read but not the books I read for pleasure. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Too much code - slicing
AK andrei@gmail.com writes: On 09/19/2010 10:32 PM, John Bokma wrote: AKandrei@gmail.com writes: On 09/19/2010 07:18 PM, Gregory Ewing wrote: AK wrote: Afaik the idea is that you can read a novel at the speed of half a page a second or so and understand it to the same extent as people who'd read at a normal rate. I've never understood why anyone would *want* to read a novel that fast, though. For me at least, reading a novel is something done for pleasure, so reading it at ten times normal speed would waste 90% of the benefit. One definite advantage would be that if, say, it takes you 70 pages of a given novel to figure out whether you like it enough to continue, you'd want to read those pages in 2 minutes rather than an hour. Heh, to me speed reading those 70 pages in a very short while, concluding that it's a good book, and start over again would be quite the spoiler. Do you fast forward movies as well? I honestly doubt it would be a spoiler if it's a good book. Generally I find that poor books rely on twists and turns while better ones rely on the fabric of story-telling. Aside from that, though, it's a very interesting question - I'll try to think of good books and see if they'd be spoiled by peeking in the first 70 pages.. Starting with children's books, Peter Pan and Wind in the Willows, I think, would not be. Don quixote would not be. Crime and punishment - maybe if you get as far as the murder? Same author's the Devils, I would say you can read the last 70 pages and it'd be just as good :). -ak I didn't mean that there are spoilers in the first 70 pages, just that to me the excercise would spoil the book, so, I wouldn't do it. I consider a book like a meal, I wouldn't gobble down food, regurgitate it, and eat it again at a slower pace. Books, movies, family, walks are the things I prefer to do at a normal mudane pace, or even slower, if I can bring myself to it. My favourite books I try to read slow, and enjoy. ;-). Too much of my life is already in overdrive. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Performance: sets vs dicts.
Terry Reedy tjre...@udel.edu writes: On 9/1/2010 8:11 PM, John Bokma wrote: [...] Right. And if 'small values of n' include all possible values, then rejecting a particular O(log n) algorithm as 'unacceptable' relative to all O(1) algorithms is pretty absurd. I have little time, but want to reply to this one: anyone using big-Oh and claiming that an O(log n) algorithm is 'unacceptable' relative to all O(1) algorithms has no clue what he/she is talking about. big-Oh says something about the order of /growth/ of the running time of an algorithm. And since 1 is a constant O(1) means that the order of /growth/ of the running time is constant (independend of the input size. Since the growth of the running time is constant is quite a mouth full, it's often shortened to 'constant time' since from the context it's clear what's being meant. But this doesn't mean that if the algorithm gets an input size of 10 versus 1 that it takes the same number of seconds for the latter to process. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Obscure MySQLdb question - duplicating a database handle
John Nagle na...@animats.com writes: I have a system which does error logging to its database: db = MySQLdb.connect(...) # get database connection ... errorlog(db, Message) The problem is that I want errorlog to commit its message to the table used for error logging, but don't want to commit whatever the caller was doing - that may well revert. MySQL doesn't support nested transactions, so that won't help. At the many points errorlog is called, only the database handle is available, not the params used for connect. Is there something like UNIX dup for database connections in MySQLdb, or can I get the connection parameters (username, password, database, etc.) from the db object? Maybe I am not clear anymore (long day), but why not make 2 db connections? It might even be better since you can give each one its own user and hence, privileges. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Performance: sets vs dicts.
Arnaud Delobelle arno...@googlemail.com writes: Terry Reedy tjre...@udel.edu writes: On 9/1/2010 11:40 AM, Aahz wrote: I think that any implementation that doesn't have O(1) for list element access is fundamentally broken, Whereas I think that that claim is fundamentally broken in multiple ways. and we should probably document that somewhere. I agree that *current* algorithmic behavior of parts of CPython on typical *current* hardware should be documented not just 'somewhere' (which I understand it is, in the Wiki) but in a CPython doc included in the doc set distributed with each release. Perhaps someone or some group could write a HowTo on Programming with CPython's Builtin Classes that would describe both the implementation and performance and also the implications for coding style. In particular, it could compare CPython's array lists and tuples to singly linked lists (which are easily created in Python also). But such a document, after stating that array access may be thought of as constant time on current hardware to a useful first approximation, should also state that repeated seqeuntial accessess may be *much* faster than repeated random accessess. People in the high-performance computing community are quite aware of this difference between simplified lies and messy truth. Because of this, array algorithms are (should be) written differently in Fortran and C because Fortran stores arrays by columns and C by rows and because it is usually much faster to access the next item than one far away. I don't understand what you're trying to say. Aahz didn't claim that random list element access was constant time, he said it was O(1) (and that it should be part of the Python spec that it is). Uhm, O(1) /is/ constant time, see page 45 of Introduction to Algorithms, 2nd edition. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Performance: sets vs dicts.
Terry Reedy tjre...@udel.edu writes: On 9/1/2010 5:40 PM, John Bokma wrote: [..] Yes, I switched, because 'constant time' is a comprehensible claim that can be refuted and because that is how some will interpret O(1) (see below for proof;-). You make it now sound alsof this interpretation is not correct or out of place. People who have bothered to read ItA will use O(1) and constant time interchangeably while talking of the order of growth of the running time algorithms and most of those are aware that 'big oh' hides a constant, and that in the real world a O(log n) algorithm can outperform an O(1) algorithm for small values of n. Uhm, O(1) /is/ constant time, see page 45 of Introduction to Algorithms, 2nd edition. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Performance: sets vs dicts.
Robert Kern robert.k...@gmail.com writes: On 9/1/10 4:40 PM, John Bokma wrote: Arnaud Delobellearno...@googlemail.com writes: Terry Reedytjre...@udel.edu writes: [...] I don't understand what you're trying to say. Aahz didn't claim that random list element access was constant time, he said it was O(1) (and that it should be part of the Python spec that it is). Uhm, O(1) /is/ constant time, see page 45 of Introduction to Algorithms, 2nd edition. While we often use the term constant time to as a synonym for O(1) complexity of an algorithm, Arnaud and Terry are using the term here to mean an implementation takes roughly the same amount of wall-clock time every time. Now that's confusing in a discussion that earlier on provided a link to a page using big O notation. At least for people following this partially, like I do. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: controlling the mouse pointer on linux (or as vnc client)
Gelonida gelon...@gmail.com writes: Hi, From a python script I'd like to be able to move the mouse to certain absolute coordinates on the screen. There's no problems calling an external program with subprocess.popen, as I do not want to perform many movements. xte? sudo apt-get install xautomation xte 'mousemove 200 200' see: http://linux.die.net/man/1/xte -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Iterative vs. Recursive coding
Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid writes: BartC a écrit : Steven D'Aprano st...@remove-this-cybersource.com.au wrote in message news:4c6f8edd$0$28653$c3e8...@news.astraweb.com... On Fri, 20 Aug 2010 17:23:23 +0200, Bruno Desthuilliers wrote: I onced worked in a shop (Win32 desktop / accouting applications mainly) where I was the only guy that could actually understand recursion. FWIW, I also was the only guy around that understood hairy (lol) concepts like callback functions, FSM, polymorphism, hashtables, linked lists, ADTs, algorithm complexity etc... Was there anything they *did* understand, or did they just bang on the keyboard at random until the code compiled? *wink* You underestimate how much programming (of applications) can be done without needing any of this stuff. From personal experience : almost nothing worth being maintained. I'm talking about complex domain-specific applications here - not shell scripts or todo-lists. I doubt anyone who codes like that keeps a todo-list. Needless to say, I didn't last long !-) And rightly so :) I guess they wanted code that could be maintained by anybody. The code base was an unmaintainable, undecipĥerable mess loaded with global state (litteraly *hundreds* of global variables), duplication, dead code, and enough WTF to supply thedailywtf.com for years - to make a long story short, the perfect BigBallOfMudd. FWIW, the company didn't last long neither - they just kept on introducing ten new bugs each time they fixed one. and they forgot to sell that as new features, I guess :-D. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Writing byte stream as jpeg format to disk
Navkirat Singh navkir...@gmail.com writes: Hey guys, I am programming a webserver, I receive a jpeg file with the POST method.The file (.jpeg) is encoded in bytes, I parse the bytes by decoding them to a string. Why? -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Writing byte stream as jpeg format to disk
Navkirat Singh navkir...@gmail.com writes: I am using Python3 and I receive a byte stream with a jpeg attached sent by the web browser over a socket, which looks like this: b': image/jpeg\r\nAccept: text/*\r\nReferer: http://127.0.0.1:8001/\r\nAccept-Language: en-us\r\nAccept-Encoding: gzip, deflate\r\nContent-Length: 91783\r\nConnection: keep-alive\r\n\r\n\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x84\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\n\x07\x07\x06\x08\x0c\n\x0c\x0c\x0b\n\x0b\x0b\r\x0e\x12\x10\r\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f You're mistaken that the content is part of the headers, it's not. The \r\n\r\n separates headers from the content. Why don't you use urllib to save you from all this hassle? -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?
John Passaniti john.passan...@gmail.com writes: On Aug 24, 8:00 pm, Hugh Aguilar hughaguila...@yahoo.com wrote: The C programmers reading this are likely wondering why I'm being attacked. The reason is that Elizabeth Rather has made it clear to everybody that this is what she wants: [http://tinyurl.com/2bjwp7q] Hello to those outside of comp.lang.forth, where Hugh usually leaves his slime trail. I seriously doubt many people will bother to read the message thread Hugh references, but if you do, you'll get to delight in the same nonsense Hugh has brought to comp.lang.forth. Here's the compressed version: I did :-). I have somewhat followed Forth from a far, far distance since the 80's (including hardware), and did read several messages in the thread, also since it was not clear what Hugh was referring to. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?
David Kastrup d...@gnu.org writes: John Bokma j...@castleamber.com writes: On the other hand: some people I knew during my studies had no problem at all with introducing countless memory leaks in small programs (and turning off compiler warnings, because it gave so much noise...) [...] As for electrical engineering: done that (BSc) and one of my class mates managed to connect a transformer the wrong way around twice. Yet he had the highest mark in our class. Anybody worth his salt in his profession has a trail of broken things in his history. Sure. The long version is: he blew up his work when he connected the transformer wrong. He borrowed someone else's board and blew that one up as well. The faster it thinned out, the better he learned. He he he, his internships went along similar lines. Maybe he loved to blow up things. The only reliable way never to break a thing is not to touch it in the first place. But that will not help you if it decides to break on its own. I don't think transfomers connect themselfs in the wrong way ;-). I agree with that accidents do happen, but some people just manage to make accidents happen way above average. And in that case they might start to think if it's a good idea them touching things. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?
Hugh Aguilar hughaguila...@yahoo.com writes: On Aug 22, 11:12 am, John Bokma j...@castleamber.com wrote: And my experience is that a formal study in CS can't compare to home study unless you're really good and have the time and drive to read formal books written on CS. And my experience is that most self-educaters don't have that time. I've read a lot of graduate-level CS books. I think most self-educated programmers have read more of these books than have 4-year degree students who were not required to in order to get their Bachelors degree and who were too busy during college to read anything that wasn't required. I doubt it. But this all comes back to what I earlier wrote: those with a CS degree think they are better than people without, and people without think they can achieve the same or better by just buying a few books and reading them. On top of that, most of the people I knew in my final year were very fanatic regarding CS: it was a hobby to them. During coffeebreaks we talked about approximation algorithms for TSPs for example. Not always, but it happened. I read plenty of books during my studies that were not on the list, as did other students I knew. If I recall correctly, you don't have a CS degree. I do, and I can tell you that your /guess/ (since that is all it is) is wrong. For most exams I've done one had not only to have read the entire book (often in a very short time), but also the hand-outs. And for quite some courses additional material was given during the course itself, so not attending all classes could result in a lower score. Reading additional books and papers helped. Sometimes reading a book by a different author could be a real eye opener (and the students I had contact with did exactly this). On top of that, often in class excercises were done, and with some courses I had to hand in home work (yikes). Also, most books are easy to read compared to CS papers. In my final two years I did several courses which solely consisted of reading a CS paper and giving a presentation on the subject in front of your classmates (and sometimes other interested people). Reading and understanding such a paper is one (and quite an effort). Teaching it in front of a (small) class within a few days is not easy, to say the least. We also had to attend several talks by guest speakers. I went to more than the required number, including a guest talk by Linus. When there was a break-through in proving Fermat's last theorem there was a talk, which I attended, like several other class mates. I am sure there are students who are there just to get a degree and to make money. But my class mates didn't fall into that category, or I have missed something. So yes, I am convinced that there are plenty of self-educated people who can code circles around me or plenty of other people with a CS degree. But IMO those people are very hard to find. Most people overestimate their skills, with or without a degree; I am sure I do. And it wouldn't surprise me if self-educated people do this more so. On the other hand: some people I knew during my studies had no problem at all with introducing countless memory leaks in small programs (and turning off compiler warnings, because it gave so much noise...) I do this all the time. My slide-rule program, for example, has beau- coup memory leaks. When I have time to mess with the program I clean up these memory leaks, but it is not a big deal. The program just runs, generates the gcode and PostScript, and then it is done. I don't really worry about memory leaks except with programs that are run continuously and have a user-interface, because they can eventually run out of memory. Oh boy, I think you just made my point for me... The real problem here is that C, Forth and C++ lack automatic garbage collection. If I have a program in which I have to worry about memory leaks (as described above), I would be better off to ignore C, Forth and C++ and just use a language that supports garbage collection. Several languages that support garbage collection still are able to leak memory when circular datastructures are used (for example). Also, allocating memory and never giving it back (by keeping a reference to it) can also be memory leaking. And the wrong form of optimization can result in a program using more memory than necessary. On top of that, you have to understand when the gc releases memory, and things like memory fragmentation. In short: you still have to use your head (on some occasions even more). Why should I waste my time carefully freeing up heap space? I will very likely not find everything but yet have a few memory leaks anyway. Why should you waste time with carefully checking for other issues? In my experience, once you become sloppy with one aspect it's very easy to become sloppy with others as well. -- John Bokma j3b Blog: http://johnbokma.com/Facebook
Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?
Paul Rubin no.em...@nospam.invalid writes: Hugh Aguilar hughaguila...@yahoo.com writes: I've read a lot of graduate-level CS books. Reading CS books doesn't make you a computer scientist any more than listening to violin records makes you a violinist. Write out answers to all the exercises in those books, and get your answers to the more difficult ones checked by a professor, and you'll be getting somewhere. That's the point someone else was making about self-study: without someone checking your answers at first, it's easy to not learn to recogize your own mistakes. Anyway, as someone else once said, studying a subject like CS isn't done by reading. It's done by writing out answers to problem after problem. Unless you've been doing that, you haven't been studying. Yup. I would like to add the following three: 1) being able to teach to peers what you've read. As explained in a post I made: during several courses I took you got a paper from your teacher and had to teach in front of the class the next week. Those papers are quite hard to grasp on the first reading even if you know quite a bit of the topic. Understanding it enough to teach in front of a class and being able to handle the question round, in which the teacher participates, is quite a killer. 2) being able to program on paper / understand programs on paper. On several exams I had to write small programs on paper. The solutions had to compile (i.e. missing a ; for languages that required so was counted against you, or using optional ;). One exam was about OOP and several OO languages were taught, and hence on paper one had to provide solutions in C++, Objective-C, Object Pascal, Smalltalk, Eiffel, etc. No compiler(s) handy. And of course questions like: what's wrong with this piece of code and how should it be written. 3) being able to write papers and a thesis (or two) No explanation needed, quite some people have no problem reading the required books, passing the exams, but need quite some time to do this (and some give up on it). -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?
Hugh Aguilar hughaguila...@yahoo.com writes: On Aug 24, 5:16 pm, Paul Rubin no.em...@nospam.invalid wrote: Anyway, as someone else once said, studying a subject like CS isn't done by reading. It's done by writing out answers to problem after problem. Unless you've been doing that, you haven't been studying. What about using what I learned to write programs that work? Does that count for anything? Of course it does; but who's going to verify your program? If I don't have a professor to pat me on the back, will my programs stop working? That sounds more like magic than technology. I am sure you know what Paul means. As for patting on the back: you must make a hell of an effort to get that. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?
Hugh Aguilar hughaguila...@yahoo.com writes: This is also the attitude that I find among college graduates. They just believe what their professors told them in college, and there is no why. Which college is that? It doesn't agree with my experiences. In CS quite a lot has to be proven with a formal proof, exactly the opposite from what you claim. And after some time students want to see the proof and certainly don't accept there is no why! unless it's a trivial thing. Maybe it's because your anecdote is an interpretation from a distance, not based on the actual experience? This is essentially the argument being made above --- that C is taught in college and Forth is not, therefore C is good and Forth is bad --- THERE IS NO WHY! At an university which languages you see depend a lot on what your teachers use themselves. A language is just a verhicle to get you from a to b. What a good study should teach you is how to drive the verhicle without accidents and not that a red one is the best. From top of my head I've seen 20+ languages during my study at the University of Utrecht. Forth wasn't one of them, but I already knew about Forth before I went to the UU. On top of that I had written an extremely minimalistic Forth in Z80 assembly years before I went to the UU (based on the work of someone else). People who promote idiomatic programming are essentially trying to be Yoda. They want to criticize people even when those people's programs work. Works doesn't mean that a program is good or what. There is a lot to say about a program that works, even one that works flawless. I do it all the time about my own programs. It's good to be critical about your own work. And if you're a teacher, it's good to provide positive feedback. They are just faking up their own expertise --- Like you, you mean? You consider yourself quite the expert on how people educate and what they learn when educated in a formal environment. Without (if I recall correctly) only second hand information and guessing. many of them have never actually written a program that works themselves. Quite some part of CS can be done without writing a single line of code. The reason why I like programming is because there is an inherent anti- bullshit mechanism in programming. Your program either works or it doesn't. Now can you provide a formal proof that it works, or do you just consider running the program a few times sufficient proof that it works? If your program doesn't work, then it doesn't matter if it is idiomatic, if you have a college degree, etc., etc.. That is the way I see it, anyway. Well, you see it wrong. A program that doesn't work and is idiomatic is easier to make work and to verify by others that it works. A program that's the result of trial-and-error (that's what quite some people end up doing who are self-taught) is a pain in the ass (pardon my French) to maintain or to extend. This perspective doesn't hold for much on comp.lang.forth where we have people endlessly spouting blather *about* programming, and you are different how? Also note that your post is crossposted to several other groups. without actually doing any programming themselves. This is why I don't take c.l.f. very seriously; people attack me all of the time and I don't really care heh, hence all the replies you write, and mentioning it in this post. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?
John Bokma j...@castleamber.com writes: At an university which languages you see depend a lot on what your teachers use themselves. A language is just a verhicle to get you from a to b. Addendum: or to illustrate a concept (e.g. functional programming, oop) [..] Like you, you mean? You consider yourself quite the expert on how people educate and what they learn when educated in a formal environment. Without (if I recall correctly) only second hand ^^^ Should've written With, of course. information and guessing. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?
David Kastrup d...@gnu.org writes: John Bokma j...@castleamber.com writes: David Kastrup d...@gnu.org writes: John Passaniti john.passan...@gmail.com writes: Amen! All this academic talk is useless. Who cares about things like the big-O notation for program complexity. Can't people just *look* at code and see how complex it is?! And take things like the years of wasted effort computer scientists have put into taking data structures (like hashes and various kinds of trees) and extending them along various problem domains and requirements. Real programmers don't waste their time with learning that junk. What good did any of that ever do anyone?! It is my experience that in particular graduated (and in particular Phd) computer scientists don't waste their time _applying_ that junk. Question: do you have a degree in computer science? Since in my experience: people who talk about their experience with graduated people often missed the boat themselves and think that reading a book or two equals years of study. I have a degree in electrical engineering. But that's similarly irrelevant. Nah, it's not: your attitude towards people with a degree in computer science agrees with what I wrote. That has not particularly helped my respect towards CS majors and PhDs in the function of programmers (and to be honest: their education is not intended to make them good programmers, but to enable them to _lead_ good programmers). I disagree. That does not mean that I am incapable of analyzing, say quicksort and mergesort, Oh, that's what I was not implying. I am convinced that quite some people who do self-study can end up with better understanding of things than people who do it for a degree. I have done both: I already was programming in several languages before I was studying CS. And my experience is that a formal study in CS can't compare to home study unless you're really good and have the time and drive to read formal books written on CS. And my experience is that most self-educaters don't have that time. On the other hand: some people I knew during my studies had no problem at all with introducing countless memory leaks in small programs (and turning off compiler warnings, because it gave so much noise...) Donald Knuth never studied computer science. Yes, yes, and Albert Einstein worked at an office. Those people are very rare. But my experience (see for plenty of examples: Slashdot) is that quite some people who don't have a degree think that all that formal education is just some paper pushing and doesn't count. While some of those who do have the paper think they know it all. Those people who are right in either group are a minority in my experience. As for electrical engineering: done that (BSc) and one of my class mates managed to connect a transformer the wrong way around twice. Yet he had the highest mark in our class. So in short: yes, self-study can make you good at something. But self-study IMO is not in general a replacement for a degree. Someone who can become great after self-study would excel at a formal study and learn more. Study works best if there is competition and if there are challenges. I still study a lot at home, but I do miss the challenges and competition. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Iterative vs. Recursive coding
Steven D'Aprano st...@remove-this-cybersource.com.au writes: On Sat, 21 Aug 2010 19:09:52 -0500, John Bokma wrote: this means that Python should eliminate / optimize tail recursion. There have been various suggestions to add tail recursion optimization to the language. Two problems: [snip] But this is not the only sort of tail-call recursion, and a traceback like the following is useful: recurse(4) Traceback (most recent call last): File stdin, line 1, in module File stdin, line 5, in recurse File stdin, line 3, in f File stdin, line 5, in recurse File stdin, line 3, in f File stdin, line 5, in recurse File stdin, line 3, in f File stdin, line 4, in recurse File stdin, line 2, in g ValueError If all you saw was the last line (the call to g), debugging the exception would be significantly harder. Yup, agreed, good example. Me personally, I'd like to see either a (preferably) run-time setting or compile-time switch that enables/disables this optimization. Even an explicit decorator would be fine. And lo and behold: http://hircus.wordpress.com/2008/06/21/python-tail-call-optimization-done-right/ http://groups.google.com/group/comp.lang.python/msg/9b047d1392f2b8ec Add it to your bag of tricks and have fun. Thanks for the links. And yes, I will add this to my bag of tricks (aka local wiki with notes ;-) ). -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?
David Kastrup d...@gnu.org writes: John Passaniti john.passan...@gmail.com writes: Amen! All this academic talk is useless. Who cares about things like the big-O notation for program complexity. Can't people just *look* at code and see how complex it is?! And take things like the years of wasted effort computer scientists have put into taking data structures (like hashes and various kinds of trees) and extending them along various problem domains and requirements. Real programmers don't waste their time with learning that junk. What good did any of that ever do anyone?! It is my experience that in particular graduated (and in particular Phd) computer scientists don't waste their time _applying_ that junk. Question: do you have a degree in computer science? Since in my experience: people who talk about their experience with graduated people often missed the boat themselves and think that reading a book or two equals years of study. Oh, and rest assured, it works both ways: people who did graduate are now and then thinking it's the holy grail and no body can beat it with home study. Both are wrong, by the way. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Iterative vs. Recursive coding
John Nagle na...@animats.com writes: On 8/20/2010 1:17 PM, John Bokma wrote: John Naglena...@animats.com writes: Python does not do tail recursion, so using recursion where iteration could do the job is generally a bad idea. Scheme, on the other hand, always does tail recursion where possible. I think you mean tail recursion optimization / elimination. Python does tail recursion: Not very well. Based on your reply that follows, I agree. def cnt(n) : if n 0 : cnt(n-1) This will work for up to cnt(998), but at cnt(999), CPython reports RuntimeError: maximum recursion depth exceeded. Yes, you can increase the recursion depth, but that case shouldn't be compiled to recursion at all. I agree: so this means that Python should eliminate / optimize tail recursion. To me, the current value seems a bit low, but I know nothing about Python internals. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Iterative vs. Recursive coding
John Nagle na...@animats.com writes: Python does not do tail recursion, so using recursion where iteration could do the job is generally a bad idea. Scheme, on the other hand, always does tail recursion where possible. I think you mean tail recursion optimization / elimination. Python does tail recursion: def x(n): ... if n == 10: return ... print n ... x(n + 1) ... x(1) 1 2 3 4 5 6 7 8 9 -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Long rant about Python in Education
D'Arcy J.M. Cain da...@druid.net writes: On Thu, 12 Aug 2010 05:05:55 -0700 (PDT) เข้านอน iktomus.heyo...@gmail.com wrote: have to teach them to enjoy programming, enjoy computers, and develop their minds in a way that doesn't involve becoming 'Imams' who are essentially the learned mafia bosses of terrorism. This is the point that I stopped reading your message and added you to my blacklist. Goodbye. For what it's worth, same here. Also, I don't think it's a good idea to force a learning environment or an OS on a child. IMO it works best if you let the child discover and be a guide, not thou should not use Windows. Not so remarkable that the rant moves from an extremistic teaching environment to an extremistic world view. From hating everything that's not Linux and idolizing the CLI to hating everything that is different in general. -- John Bokma j3b Hacking Hiking in Mexico - http://johnbokma.com/ http://castleamber.com/ - Perl Python Development -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is python not written in C++ ?
Carl Banks pavlovevide...@gmail.com writes: On Aug 1, 6:09 pm, John Bokma j...@castleamber.com wrote: Roy Smith r...@panix.com writes: In article 4c55fe82$0$9111$426a3...@news.free.fr, candide cand...@free.invalid wrote: Python is an object oriented langage (OOL). The Python main implementation is written in pure and old C90. Is it for historical reasons? C is not an OOL and C++ strongly is. I wonder if it wouldn't be more suitable to implement an OOL with another one. One thing that comes to mind is that it's much easier to distribute C libraries than C++ libraries. In the beginning of C++ there were programs that just converted C++ to C (frontends). At least that is how the C++ compiler Acorn sold worked. So I don't think your argument was much true back then. No, it was that way back then too. They might all generate C code but different C code by different backends wouldn't be able to call each other natively. If you convert C++ to C, and compile the C code then that's not different from compiling the C code itself, correct? For instnace the function int foo(int); might be name-mangled this way in one cfront: foo$d and this way in another: int_foo__int_i But they call both the C libraries in the same way. The virtual table of this class: class Bar { virtual int foo(int); virtual int bar(int); }; might be generated like this in one cfront: struct Bar$$Vtable$ { int (*Bar$$bar$d)(int); int (*Bar$$foo$d)(int); }; and like this in another: struct class_Foo___vtable_ { int (*foo)(int); int (*bar)(int); }; So, just because they both generated C code, it doesn't mean they can call one another. Why would they need to call each other? The compiled C++ code ends up as being compiled generated C code. It has been a while, but I am quite sure that the Acorn C++ front end I used could dump the actual generated C code. And this generated code should compile with a normal C compiler on a different platform. The only exception I can think of is if the front end comes with libraries you have to link against. But since this should be C as well (since there is no native C++), I don't see any problem to recreate those libraries. -- John Bokma j3b Hacking Hiking in Mexico - http://johnbokma.com/ http://castleamber.com/ - Perl Python Development -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is python not written in C++ ?
Albert Hopkins mar...@letterboxes.org writes: But I wonder if someone has/has tried to write a programming language in C++ and what were their experiences. The Low Level Virtual Machine (LLVM) is a compiler infrastructure, written in C++, which is designed for compile-time, link-time, run-time, and idle-time optimization of programs written in arbitrary programming languages. Originally implemented for C/C++, the language-independent design (and the success) of LLVM has since spawned a wide variety of front ends, including Objective-C, Fortran, Ada, Haskell, Java bytecode, Python, Ruby, ActionScript, GLSL, and others. http://en.wikipedia.org/wiki/LLVM Unladen Swallow is a branch of Python intended to be fully compatible and significantly faster. It uses LLVM's optimization passes and JIT compiler. http://llvm.org/ProjectsWithLLVM/#unladenswallow -- John Bokma j3b Hacking Hiking in Mexico - http://johnbokma.com/ http://castleamber.com/ - Perl Python Development -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is python not written in C++ ?
Michael Torrie torr...@gmail.com writes: On 08/01/2010 07:09 PM, John Bokma wrote: One thing that comes to mind is that it's much easier to distribute C libraries than C++ libraries. In the beginning of C++ there were programs that just converted C++ to C (frontends). At least that is how the C++ compiler Acorn sold worked. So I don't think your argument was much true back then. No, he is still right. Each C++ implementation did name mangling differently leading to C libraries that had incompatible names and signatures. Also each frontend could have generated incompatible vtables and other C++ structures. So C code generated by one C++ frontend could not easily call C code generated by another C++ frontend. So the same arguments that are made about C++ now were just as valid back then when C++ was merely a fancy preprocessor. See my other post: I understand that two C++ preprocessors can't call each others generated code, but if one uses C++ and knows that one can only use shared C libraries on target systems, and not C++ libraries that might be present (or more likely not: C++ was new in those days). -- John Bokma j3b Hacking Hiking in Mexico - http://johnbokma.com/ http://castleamber.com/ - Perl Python Development -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is python not written in C++ ?
Carl Banks pavlovevide...@gmail.com writes: On Aug 3, 2:29 am, John Bokma j...@castleamber.com wrote: [..] But they call both the C libraries in the same way. Go look at the original claim, the one that you responded to. It's much easier to distribute C libraries than C++ libraries. Yup, and if I read it correctly the claim was: and that's why C++ was not chosen. I doubt it. Hence, It's much easier to distribute C libraries than C++ libraries. Yup, but still doesn't exclude C++ from being used to implement a programming language. And I would appreciate some respect, especially from someone who's too lazy to do some editing before posting, thank you. -- John Bokma j3b Hacking Hiking in Mexico - http://johnbokma.com/ http://castleamber.com/ - Perl Python Development -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is python not written in C++ ?
Ethan Furman et...@stoneleaf.us writes: John Bokma wrote: Michael Torrie torr...@gmail.com writes: On 08/01/2010 07:09 PM, John Bokma wrote: One thing that comes to mind is that it's much easier to distribute C libraries than C++ libraries. In the beginning of C++ there were programs that just converted C++ to C (frontends). At least that is how the C++ compiler Acorn sold worked. So I don't think your argument was much true back then. No, he is still right. Each C++ implementation did name mangling differently leading to C libraries that had incompatible names and signatures. Also each frontend could have generated incompatible vtables and other C++ structures. So C code generated by one C++ frontend could not easily call C code generated by another C++ frontend. So the same arguments that are made about C++ now were just as valid back then when C++ was merely a fancy preprocessor. See my other post: I understand that two C++ preprocessors can't call each others generated code, but if one uses C++ and knows that one can only use shared C libraries on target systems, and not C++ libraries that might be present (or more likely not: C++ was new in those days). So if Python were written in C++, and an extension was written in C++, how could the two call each other? Via C. -- John Bokma j3b Hacking Hiking in Mexico - http://johnbokma.com/ http://castleamber.com/ - Perl Python Development -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is python not written in C++ ?
Terry Reedy tjre...@udel.edu writes: On 8/1/2010 7:08 PM, candide wrote: Python is an object oriented langage (OOL). The Python main implementation is written in pure and old C90. Is it for historical reasons? Python was first released before C++. C++ was named C++ in 1983 (development on it started in 1979) and the first commercial implementation was released in 1985 [1]. Implementation of Python started in December 1989 [2]. So: no. (I was quite sure on this, since I started to program in C++ in the late 80's/early 90's IIRC). [1] http://en.wikipedia.org/wiki/C_plus_plus#History [2] http://en.wikipedia.org/wiki/Python_%28programming_language%29#History http://python-history.blogspot.com/2009/01/brief-timeline-of-python.html -- John Bokma j3b Hacking Hiking in Mexico - http://johnbokma.com/ http://castleamber.com/ - Perl Python Development -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is python not written in C++ ?
Roy Smith r...@panix.com writes: In article 4c55fe82$0$9111$426a3...@news.free.fr, candide cand...@free.invalid wrote: Python is an object oriented langage (OOL). The Python main implementation is written in pure and old C90. Is it for historical reasons? C is not an OOL and C++ strongly is. I wonder if it wouldn't be more suitable to implement an OOL with another one. One thing that comes to mind is that it's much easier to distribute C libraries than C++ libraries. In the beginning of C++ there were programs that just converted C++ to C (frontends). At least that is how the C++ compiler Acorn sold worked. So I don't think your argument was much true back then. -- John Bokma j3b Hacking Hiking in Mexico - http://johnbokma.com/ http://castleamber.com/ - Perl Python Development -- http://mail.python.org/mailman/listinfo/python-list
Re: Personal archive tool, looking for suggestions on improving the code
mo reina urban.yoga.journ...@gmail.com writes: i mainly did it because i'm always scanning through my pdf files, books, or the net for some coding example of solution that i'd already seen before, and it just seemed logical to have something where you could just put the content in, give it a title and tags, and just look it up whenever you needed to. Ages ago I wrote something like this in Perl, but now I use a local install of MediaWiki to keep notes, interesting links, code snippets, etc. One of the advantages is that I can reach it from each computer connected to my LAN, even virtual ones. -- John Bokma j3b Hacking Hiking in Mexico - http://johnbokma.com/ http://castleamber.com/ - Perl Python Development -- http://mail.python.org/mailman/listinfo/python-list
Re: Why are String Formatted Queries Considered So Magical? (Spammer analysis)
John Nagle na...@animats.com writes: On 7/26/2010 4:19 PM, Justin Smith wrote: Seeking industry expert candidates I’m Justin Smith, Director of Tech Recruiting at Express Seattle. I am currently seeking candidates to fill Tech Positions for multiple A- List Clients: Spammer detected. But did you report it? (If so, it helps if you state so). Injection-Info: r27g2000yqb.googlegroups.com; posting-host=63.170.35.94; http://www.spamcop.net/sc?track=63.170.35.94 - looks like abuse goes to the spammer... A whois gives sprint.net, so you could contact abuse at sprint.net (see: http://whois.domaintools.com/63.170.35.94 ) [snip address etc.] Spammers don't care about that. Best course of action, based on my experience, is to contact abuse at googlegroups.com (now and then it actually works), and sprint.net. -- John Bokma j3b Hacking Hiking in Mexico - http://johnbokma.com/ http://castleamber.com/ - Perl Python Development -- http://mail.python.org/mailman/listinfo/python-list
Re: why is this group being spammed?
be.krul be.k...@gmail.com writes: On Jul 17, 10:01 pm, be.krul be.k...@gmail.com wrote: why is this group being spammed? What I was asking is why not moderate the group. this is the only Python group I could find.. Controlling spam starts by you! Report it. And certainly don't reply to spam by qouting the entire (religious) spam message. Moron. -- John Bokma j3b Hacking Hiking in Mexico - http://johnbokma.com/ http://castleamber.com/ - Perl Python Development -- http://mail.python.org/mailman/listinfo/python-list
Re: why is this group being spammed?
be.krul be.k...@gmail.com writes: why is this group being spammed? Do you report those spammers? While Google is extremely lazy with dealing with spammers, if sufficient people report them action might be taken. Also make sure to report those spammers with their ISP; posts via GG contain the posting IP address. Even trolls can be hurt, if enough people report them: http://www.xahlee.org/Periodic_dosage_dir/t2/harassment.html -- John Bokma j3b Hacking Hiking in Mexico - http://johnbokma.com/ http://castleamber.com/ - Perl Python Development -- http://mail.python.org/mailman/listinfo/python-list
Re: death of newsgroups (Microsoft closing their newsgroups)
Kenneth Tilton kentil...@gmail.com writes: fup2 poster Let me see if I have this right. Your technique for reducing unwanted traffic is to openly insult one of the participants? Heh, or just ploinking them (done). Or making them cry like a little baby: http://xahlee.org/Periodic_dosage_dir/t2/harassment.html (it had an effect for a while :-D ) -- The John Bokma guy j3b Hacking Hiking in Mexico - http://johnbokma.com/ http://castleamber.com/ - Perl Python Development -- http://mail.python.org/mailman/listinfo/python-list