Re: Code golf challenge: XKCD 936 passwords

2013-10-07 Thread Chris Angelico
On Tue, Oct 8, 2013 at 5:48 PM, wrote: > And if we were actually trying then that filename should just be "/w". Would > get rid of another 19 chars. I'm working this on the assumption that the dictionary file already exists (that's where it is on my Debian Linux systems, for instance) and shoul

Re: Code golf challenge: XKCD 936 passwords

2013-10-07 Thread sprucebondera
On Monday, October 7, 2013 8:45:39 PM UTC-10, spruce...@gmail.com wrote: > On Monday, October 7, 2013 8:17:21 PM UTC-10, Chris Angelico wrote: > > > Who's up for some fun? Implement an XKCD-936-compliant password > > > > > > generator in Python 3, in less code than this: > > > > > > > > >

Re: Code golf challenge: XKCD 936 passwords

2013-10-07 Thread sprucebondera
On Monday, October 7, 2013 8:17:21 PM UTC-10, Chris Angelico wrote: > Who's up for some fun? Implement an XKCD-936-compliant password > > generator in Python 3, in less code than this: > > > > print(*__import__("random").sample(open("/usr/share/dict/words").read().split("\n"),4)) > > > > Sec

Re: Formal-ity and the Church-Turing thesis

2013-10-07 Thread Mark Lawrence
On 08/10/2013 06:44, rusi wrote: On Tuesday, October 8, 2013 10:46:50 AM UTC+5:30, Ravi Sahni wrote: With due respect Sir, you saying that Turing machine not a machine? Very confusion Sir!!! Thanks Ravi for the 'due respect' though it is a bit out of place on a list like this :-) With due

Code golf challenge: XKCD 936 passwords

2013-10-07 Thread Chris Angelico
Who's up for some fun? Implement an XKCD-936-compliant password generator in Python 3, in less code than this: print(*__import__("random").sample(open("/usr/share/dict/words").read().split("\n"),4)) Second challenge: Use it for generating all your passwords :) [1] https://en.wikipedia.org/wiki/C

Re: Formal-ity and the Church-Turing thesis

2013-10-07 Thread rusi
On Tuesday, October 8, 2013 10:49:11 AM UTC+5:30, zipher wrote: > I don't have an infinite stack to implement > lambda calculus, but... And then > But this is not a useful formalism. Any particular Program implements > a DFA, even as it runs on a TM. The issue of whether than TM is > finite or

Re: Formal-ity and the Church-Turing thesis

2013-10-07 Thread rusi
On Tuesday, October 8, 2013 10:46:50 AM UTC+5:30, Ravi Sahni wrote: > With due respect Sir, you saying that Turing machine not a machine? > Very confusion Sir!!! Thanks Ravi for the 'due respect' though it is a bit out of place on a list like this :-) Thanks even more for the 'very confusion'.

Re: Formal-ity and the Church-Turing thesis

2013-10-07 Thread Mark Janssen
> On Tuesday, October 8, 2013 5:54:10 AM UTC+5:30, zipher wrote: >> Now, one can easily argue that I've gone too far to say "no one has >> understood it" (obviously), so it's very little tongue-in-cheek, but >> really, when one tries to pretend that one model of computation can be >> substituted fo

Re: Formal-ity and the Church-Turing thesis

2013-10-07 Thread Ravi Sahni
On Tue, Oct 8, 2013 at 8:47 AM, rusi wrote: > I can only say how ironic it sounds to someone who is familiar with the > history of our field: > Turing was not a computer scientist (the term did not exist then) but a > mathematician. And his major contribution was to create a form of argument >

Re: Tail recursion to while iteration in 2 easy steps

2013-10-07 Thread Mark Janssen
>> Yeah, and this is where two models of computation have been conflated, >> creating magical effects, confusing everybody. I challenge you to get >> down to the machine code in scheme and formally describe how it's >> doing both. > > Which two models of computation are you talking about? And what

Re: Tail recursion to while iteration in 2 easy steps

2013-10-07 Thread Mark Janssen
>>> But even putting that aside, even if somebody wrote such a description, >>> it would be reductionism gone mad. What possible light on the problem >>> would be shined by a long, long list of machine code operations, even >>> if written using assembly mnemonics? >> >> Only that you've got a consi

Formal-ity and the Church-Turing thesis

2013-10-07 Thread rusi
On Tuesday, October 8, 2013 5:54:10 AM UTC+5:30, zipher wrote: > Now, one can easily argue that I've gone too far to say "no one has > understood it" (obviously), so it's very little tongue-in-cheek, but > really, when one tries to pretend that one model of computation can be > substituted for anot

Re: Tail recursion to while iteration in 2 easy steps

2013-10-07 Thread Piet van Oostrum
Steven D'Aprano writes: > Far more useful would be a high-level description of Scheme's programming > model. If names can be rebound on the fly, how does Scheme even tell > whether something is a recursive call or not? Maybe it doesn't have to tell. If you do tail call optimization there is no

Re: Tail recursion to while iteration in 2 easy steps

2013-10-07 Thread Piet van Oostrum
Mark Janssen writes: > Yeah, and this is where two models of computation have been conflated, > creating magical effects, confusing everybody. I challenge you to get > down to the machine code in scheme and formally describe how it's > doing both. Which two models of computation are you talking

Re: Tail recursion to while iteration in 2 easy steps

2013-10-07 Thread Steven D'Aprano
On Mon, 07 Oct 2013 17:16:35 -0700, Mark Janssen wrote: > It's like this: there *should* be one-to-one mappings between the > various high-level constructs to the machine code, varying only between > different chips (that is the purpose of the compiler after all), yet for > some operations, in lan

Re: Tail recursion to while iteration in 2 easy steps

2013-10-07 Thread Mark Janssen
On Mon, Oct 7, 2013 at 4:50 PM, Steven D'Aprano wrote: > On Mon, 07 Oct 2013 15:47:26 -0700, Mark Janssen wrote: >> I challenge you to get >> down to the machine code in scheme and formally describe how it's doing >> both. > > For which machine? Right, I should stop assuming a modern implementati

Re: Tail recursion to while iteration in 2 easy steps

2013-10-07 Thread Mark Janssen
> Only that you've got a consistent, stable (and therefore, > formalizable) translation from your language to the machine. That's > all. Everything else is magic. Do you know that the Warren > Abstraction Engine used to power the predicate logic in Prolog into > machien code for a VonNeumann mac

Re: Tail recursion to while iteration in 2 easy steps

2013-10-07 Thread Steven D'Aprano
On Mon, 07 Oct 2013 15:47:26 -0700, Mark Janssen wrote: > I challenge you to get > down to the machine code in scheme and formally describe how it's doing > both. For which machine? Or are you assuming that there's only one machine code that runs on all computing devices? Frankly, asking some

Re: Tail recursion to while iteration in 2 easy steps

2013-10-07 Thread Mark Janssen
>> That's fine. My point was: you can't at the same time have full >> dynamicity *and* procedural optimizations (like tail call opt). >> Everybody should be clear about the trade-off. > > Your wrong. Full dynamics is not in contradiction with tail call > optimisation. Scheme has already done it for

Re: Tail recursion to while iteration in 2 easy steps

2013-10-07 Thread Piet van Oostrum
Alain Ketterlin writes: > BTW, does the original callable object have a ref counter? Is it garbage > collected in that case? If not, would it be considered a bug? In CPython ALL objects have ref counters. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https

Re: Variable arguments (*args, **kwargs): seeking elegance

2013-10-07 Thread John Ladasky
Wow, Steven, that was a great, detailed reply. I hope you will forgive me for shortcutting to the end, because I've been hacking away for a few hours and came to this very conclusion: On Monday, October 7, 2013 2:13:10 PM UTC-7, Steven D'Aprano wrote: > In general, you should aim to use either

Re: Tail recursion to while iteration in 2 easy steps

2013-10-07 Thread MRAB
On 07/10/2013 18:57, Antoon Pardon wrote: Op 07-10-13 19:15, Alain Ketterlin schreef: I want to consider here what it would mean to concretely implement the abstract notion 'disallow rebinding of function names' and show what would be behind calling the idea 'not feasible'. Again, I'm more con

Re: Newbie: installation difficulties [webapp2 / babel]

2013-10-07 Thread Chris Angelico
On Tue, Oct 8, 2013 at 7:00 AM, BobAalsma wrote: > Well Joel, umm, I'm not sure if I understand you correctly. > > $ python babel > /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: > can't open file 'babel': [Errno 2] No such file or directory If the

Re: Tail recursion to while iteration in 2 easy steps

2013-10-07 Thread random832
On Sat, Oct 5, 2013, at 3:39, Antoon Pardon wrote: > What does this mean? > > Does it mean that a naive implementation would arbitrarily mess up > stack traces and he wasn't interested in investigating more > sophisticated implementations? > > Does it mean he just didn't like the idea a stack tra

Re: Tail recursion to while iteration in 2 easy steps

2013-10-07 Thread random832
On Mon, Oct 7, 2013, at 13:15, Alain Ketterlin wrote: > That's fine. My point was: you can't at the same time have full > dynamicity *and* procedural optimizations (like tail call opt). > Everybody should be clear about the trade-off. Let's be clear about what optimizations we are talking about. T

Re: Variable arguments (*args, **kwargs): seeking elegance

2013-10-07 Thread Steven D'Aprano
On Mon, 07 Oct 2013 09:26:51 -0700, John Ladasky wrote: > Thanks, everyone, for your replies. Perhaps I have complicated things > unnecessarily? I was just trying to do some error-checking on the > arguments supplied to the class constructor. Perhaps Python already > implements automatically wh

Re: Variable arguments (*args, **kwargs): seeking elegance

2013-10-07 Thread Peter Cacioppi
On Saturday, October 5, 2013 9:04:25 PM UTC-7, John Ladasky wrote: > Hi folks, > > > > I'm trying to make some of Python class definitions behave like the ones I > find in professional packages, such as Matplotlib. A Matplotlib class can > often have a very large number of arguments -- some o

Re: Tail recursion to while iteration in 2 easy steps

2013-10-07 Thread Terry Reedy
On 10/7/2013 1:15 PM, Alain Ketterlin wrote: Terry Reedy writes: 3. Python does not mandate how namespaces are implemented. CPython uses both dicts and, for function local namespaces, internal C arrays. So 'names' in code can become either string keys for dicts or integer indexes for arrays.

Re: Newbie: installation difficulties [webapp2 / babel]

2013-10-07 Thread Joel Goldstick
On Mon, Oct 7, 2013 at 4:00 PM, BobAalsma wrote: > Well Joel, umm, I'm not sure if I understand you correctly. > > $ python babel > /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: > can't open file 'babel': [Errno 2] No such file or directory > > And

Re: Tail recursion to while iteration in 2 easy steps

2013-10-07 Thread Antoon Pardon
Op 07-10-13 19:15, Alain Ketterlin schreef: I want to consider here what it would mean to concretely implement the abstract notion 'disallow rebinding of function names' and show what would be behind calling the idea 'not feasible'. Again, I'm more concerned about the function than about the na

Re: Newbie: installation difficulties [webapp2 / babel]

2013-10-07 Thread BobAalsma
Well Joel, umm, I'm not sure if I understand you correctly. $ python babel /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'babel': [Errno 2] No such file or directory And $ python Python 2.7.5 (v2.7.5:ab05e7dd2788, May 13 2013, 13

Re: Mysql's mysql module

2013-10-07 Thread Chris “Kwpolska” Warrick
On Oct 7, 2013 9:36 PM, "Duncan Booth" wrote: > > Skip Montanaro wrote: > > > On Mon, Oct 7, 2013 at 1:08 PM, Tobiah wrote: > >> I just noticed this: > >> > >> > >> http://dev.mysql.com/doc/connector-python/en/index.html > > > > * Does it adhere to the Python database API? > > http://www.python.

Re: Mysql's mysql module

2013-10-07 Thread Duncan Booth
Skip Montanaro wrote: > On Mon, Oct 7, 2013 at 1:08 PM, Tobiah wrote: >> I just noticed this: >> >> >> http://dev.mysql.com/doc/connector-python/en/index.html > > * Does it adhere to the Python database API? > http://www.python.org/dev/peps/pep-0249/ > > * Is source available? > > * Does it h

Re: Newbie: installation difficulties [webapp2 / babel]

2013-10-07 Thread Joel Goldstick
On Mon, Oct 7, 2013 at 3:12 PM, BobAalsma wrote: > Hi, > > I'm following webapp2 documentation (release 2.1). > > I made a mistake in following the text. > I typed "pip install babel" and this led to errors in the installation. > As that user is not in sudo list, I changed users, typed "sudo pip i

Newbie: installation difficulties [webapp2 / babel]

2013-10-07 Thread BobAalsma
Hi, I'm following webapp2 documentation (release 2.1). I made a mistake in following the text. I typed "pip install babel" and this led to errors in the installation. As that user is not in sudo list, I changed users, typed "sudo pip install babel" and everything seemed right. Further on, the

Re: Mysql's mysql module

2013-10-07 Thread Skip Montanaro
On Mon, Oct 7, 2013 at 1:08 PM, Tobiah wrote: > I just noticed this: > > > http://dev.mysql.com/doc/connector-python/en/index.html * Does it adhere to the Python database API? http://www.python.org/dev/peps/pep-0249/ * Is source available? * Does it have a reasonable open source license? These

Mysql's mysql module

2013-10-07 Thread Tobiah
I just noticed this: http://dev.mysql.com/doc/connector-python/en/index.html What are the thoughts on this vs. the MySQLdb with which I'm familiar? I also noticed MySQLdb2. I was wondering whether to use this version on a new project that is likely to take some months to develop. Thanks, T

Re: Tail recursion to while iteration in 2 easy steps

2013-10-07 Thread Alain Ketterlin
Terry Reedy writes: > On 10/4/2013 5:49 AM, Alain Ketterlin wrote: > >> I think allowing rebinding of function names is extremely strange, > > Steven already countered the 'is extremely strange' part by showing > that such rebinding is common, generally useful, and only occasionally > dodgy and a

Re: Variable arguments (*args, **kwargs): seeking elegance

2013-10-07 Thread John Ladasky
On Monday, October 7, 2013 9:26:51 AM UTC-7, I wrote: > Here is one more detail which may be relevant. The base class for the family > of classes I am developing is a numpy.ndarray. The numpy.ndarray is a C > extension type (and if I understand correctly, that means it is immutable by > ordina

Re: Variable arguments (*args, **kwargs): seeking elegance

2013-10-07 Thread John Ladasky
Thanks, everyone, for your replies. Perhaps I have complicated things unnecessarily? I was just trying to do some error-checking on the arguments supplied to the class constructor. Perhaps Python already implements automatically what I am trying to accomplish manually? I'll tinker around wit

Re: HEX to ASCII

2013-10-07 Thread Piet van Oostrum
markot...@gmail.com writes: > This is the code i came up with: > from teisendaja import * > from operator import * > import binascii > > teisendus = teisendus() > kood = input("Kood: ") > key = input("Võti: ") > > chunksize = 2 > vastus = [teisendus.teisendus3(16,2,kood[i: (i + chunksize)]) for i

Re: HEX to ASCII

2013-10-07 Thread Mark Lawrence
On 07/10/2013 14:54, markot...@gmail.com wrote: I forgot to tell. The teisendaja module that i have imported, is a number converter that allow to convert numbers from one base to another. i mostly use it for HEX to BIN and vice versa, but it supports other bases too. That's nice to know, but

Re: HEX to ASCII

2013-10-07 Thread markotaht
I forgot to tell. The teisendaja module that i have imported, is a number converter that allow to convert numbers from one base to another. i mostly use it for HEX to BIN and vice versa, but it supports other bases too. -- https://mail.python.org/mailman/listinfo/python-list

Re: HEX to ASCII

2013-10-07 Thread markotaht
esmaspäev, 7. oktoober 2013 4:27.44 UTC+3 kirjutas Piet van Oostrum: > markot...@gmail.com writes: > > > > > problem is : Traceback (most recent call last): > > > File "C:\Users\Marko\Desktop\hacker.org\XOR cypher.py", line 35, in > > > > > print("Key-" + str(võti) + ": " + str("".j

Re: Variable arguments (*args, **kwargs): seeking elegance

2013-10-07 Thread Skip Montanaro
> What makes Matplotlib so professional? > > Assuming that "professional" packages necessarily do the right thing is > an unsafe assumption. Many packages have *lousy* interfaces. Not that it's a complete explanation for matplotlib's interfaces, but it did start out as a Python-based replacement f

Re: Goodbye: was JUST GOT HACKED

2013-10-07 Thread Ravi Sahni
On Mon, Oct 7, 2013 at 5:56 PM, Walter Hurry wrote: > On Thu, 03 Oct 2013 11:35:00 +, Steven D'Aprano wrote: > >> On Thu, 03 Oct 2013 09:21:08 +0530, Ravi Sahni wrote: >> >>> On Thu, Oct 3, 2013 at 2:43 AM, Walter Hurry >>> wrote: Ding ding! Nikos is simply trolling. It's easy enough to

Re: Goodbye: was JUST GOT HACKED

2013-10-07 Thread Tim Chase
On 2013-10-07 12:26, Walter Hurry wrote: > The 'Goodbye' post was made in rather a fit of pique, for which I > apologise. If I am allowed a second chance, there is actually > something puzzling me at the moment. It's a UnicodeDecodeError, but > I shall start a separate thread about it. Indeed, th

Re: Goodbye: was JUST GOT HACKED

2013-10-07 Thread Chris Angelico
On Mon, Oct 7, 2013 at 11:26 PM, Walter Hurry wrote: > The 'Goodbye' post was made in rather a fit of pique, for which I > apologise. If I am allowed a second chance, there is actually something > puzzling me at the moment. It's a UnicodeDecodeError, but I shall start > a separate thread about it.

Re: Goodbye: was JUST GOT HACKED

2013-10-07 Thread Walter Hurry
On Thu, 03 Oct 2013 11:35:00 +, Steven D'Aprano wrote: > On Thu, 03 Oct 2013 09:21:08 +0530, Ravi Sahni wrote: > >> On Thu, Oct 3, 2013 at 2:43 AM, Walter Hurry >> wrote: >>> Ding ding! Nikos is simply trolling. It's easy enough to killfile him >>> but inconvenient to skip all the answers to

Re: How to streamingly read text file and display whenever updated text

2013-10-07 Thread Andreas Perstinger
On 07.10.2013 03:54, galeom...@gmail.com wrote: https://docs.google.com/file/d/0B2D69u2pweEvelh1T25ra19oZEU/edit?usp=sharing For the readers who don't bother clicking on the link above: It's a short video where the OP demonstrates how her/his usage of tail doesn't work. no matter call tai