Re: Is this the proper way to use a class method?

2012-03-02 Thread Ian Kelly
On Fri, Mar 2, 2012 at 12:16 AM, John Salerno  wrote:
>> That's just a coincidence. Your supercall is ought to be: super().move()
>> In contrast, super().move(self) calls the superclass instance method
>> `move` with 2 arguments, both `self`, which just happens to work given
>> your move() method, inside which `cls` isn't actually a class like it
>> ought to be.
>
> Thank you! This is the whole reason I tried using a class method in the first 
> place. I was getting an error that said my move method only takes one 
> argument, but I was passing in two.
>
> But if I make the super call as super().move(), how does that work? The move 
> method in the superclass takes an argument, and if I just do super().move(), 
> isn't it the subclass that's getting passed to it?

The self that gets passed into the superclass.move() or the
subclass.move() is the exact same object in either case.  There is no
"up-casting" (or any casting at all, for that matter) in Python.

> How does the superclass move method know what 'self' is if it doesn't get 
> passed to it as I did originally?

super() called without arguments is equivalent to super(, self) -- it collects the value of self from
the current stack frame.  So self is able to be passed in because the
super object implicitly knows what self is.

Cheers,
Ian
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is this the proper way to use a class method?

2012-03-02 Thread Chris Rebert
On Thu, Mar 1, 2012 at 11:16 PM, John Salerno  wrote:
>> That's just a coincidence. Your supercall is ought to be: super().move()
>> In contrast, super().move(self) calls the superclass instance method
>> `move` with 2 arguments, both `self`, which just happens to work given
>> your move() method, inside which `cls` isn't actually a class like it
>> ought to be.
>
> Thank you! This is the whole reason I tried using a class method in the first 
> place. I was getting an error that said my move method only takes one 
> argument, but I was passing in two.
>
> But if I make the super call as super().move(), how does that work? The move 
> method in the superclass takes an argument, and if I just do super().move(), 
> isn't it the subclass that's getting passed to it?

The instance of the subclass (i.e. what Pawn.move() considers `self`)
gets passed to it.

> How does the superclass move method know what 'self' is if it doesn't get 
> passed to it as I did originally?

Oh, but it does get passed, just implicitly. `super()` basically grabs
`self` magically from its caller, and uses it to bind method calls on
the magical object returned by `super()`.

`super().move()` ends up being, in this particular case, equivalent to:
ChessPiece.move(self)
which is incidentally how one would write this without using super().

Here is a useful[1] "identity" to ponder:
x.y(z) === type(x).y(x, z)

Cheers,
Chris
--
[1]: In the sense of a useful lie[2]; it's far from completely
accurate; it (at the least) ignores metaclasses, overridings of
__getattribute__(), and a third thing that's difficult to clearly put
into words.
[2]: http://c2.com/cgi/wiki?UsefulLie [3]
[3]: Yes, my footnotes have footnotes.
http://rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Python Developer Job Opportunities

2012-03-02 Thread Matt Jones
I have an opportunity for talented Python Developers with Django experience 
based in the South of the UK.

I am recruiting for a funded new venture set up by two successful entrepreneurs 
who are experienced and well--respected scientists and mathematicians. They're 
building a new and radical way of learning Maths; an advanced technological 
platform (iPad / Cloud based) with unique data gathering and analysis 
capabilities the program will create a world beating, cutting edge product.

They are on the hunt for Python developers to build the interface of a brand 
new cloud hosted web app that will be rolled out on iPad as well as a bespoke 
CMS, web portal and internal visualization platform.

The team  are working in brand new, expansive offices (45,000 square feet, free 
lunch, onsite gym, games room, poker room with casino grade tables, 5-A-Side 
football pitch).

This is an exciting opportunity to become a core member of the development team 
in a growing company that will be providing a technical challenge in a 
fantastic working environment all in aid of a good cause.

If you would like to discuss the role in more detail please contact me at 
[email protected] I 
can also provide photos of the office, details on working environment etc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: lang comparison: in-place algorithm for reversing a list in Perl,Python, Lisp

2012-03-02 Thread Xah Lee

Xah Lee wrote:
«… One easy way to measure it is whether a programer can read and
understand a program without having to delve into its idiosyncrasies.
…»

Chris Angelico wrote:
«Neither the behavior of ints nor the behavior of IEEE floating point
is a "quirk" or an "idiosyncracy". …»

they are computer engineering by-products. Are quirks and
idiosyncracies. Check out a advanced lang such as Mathematica. There,
one can learn how the mathematical concept of integer or real number
are implemented in a computer language, without lots by-products of
comp engineering as in vast majority of langs (all those that chalks
up to some IEEE. (which, sadly, includes C, C++, java, perl,
python, lisp, and almost all. (lisp idiots speak of the jargon “number
tower” instead I.) (part of the reason almost all langs stick to
some I stuff is because it's kinda standard, and everyone
understand it, in the sense that unix RFC (aka really fucking common)
is wide-spread because its free yet technically worst. (in a sense,
when everybody's stupid, there arise a cost to not be stupid..

 Xah
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af

2012-03-02 Thread Seymour J.
In <[email protected]>, on 03/01/2012
   at 02:40 PM, Rainer Weikusat  said:

>You obviously don't have any sense of humour.

Certainly I do; I laugh at pretentious loons with delusions of
adequacy.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to [email protected]

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade!

2012-03-02 Thread Xah Lee
On Mar 1, 3:00 am, Kiuhnm  wrote:
> They did not make up the terminology, if that is what you are saying.
> The concepts of left and right associativity are well-known and accepted
> in TCS (Theoretical CS).


> Aho, Sethi and Ullman explain it this way in "Compilers: Principles,
> Techniques and Tools":
> "We say that the operator + associates to the left because an operand
> with plus signs on both sides of it is taken by the operator to its
> left. [...]"
> And they also show parse trees similar to the ones I wrote above.

how do they explain when 2 operators are adjacent e.g. 「3 △ 6 ▲ 5 」?

do you happen to know some site that shows the relevant page i can
have a look?

thanks.

 Xah

On Mar 1, 3:00 am, Kiuhnm  wrote:
> On 3/1/2012 1:02, Xah Lee wrote:
>
> > i missed a point in my original post. That is, when the same operator
> > are adjacent. e.g. 「3 ▲ 6 ▲ 5」.
>
> > This is pointed out by Kiuhnm 〔kiuhnm03.4t.yahoo.it〕 and Tim Bradshaw.
> > Thanks.
>
> > though, i disagree the way they expressed it, or any sense this is
> > different from math.
>
> They did not make up the terminology, if that is what you are saying.
> The concepts of left and right associativity are well-known and accepted
> in TCS (Theoretical CS).
>
> If you change the terminology, no one will understand you unless you
> provide your definitions every time (and then they may not accept them).
>
> Another way of saying that an operator is left-associative is that its
> parse tree is a left-tree, i.e. a complete tree where each right child
> is a leaf.
> For instance, (use a monospaced font)
>    1 + 2 + 3 + 4
> gives you this left-tree:
>        +
>      +   4
>    +   3
>   1 2
> while 1**2**3**4
> gives you this right-tree:
>    **
> 1    **
>     2    **
>         3  4
>
> Aho, Sethi and Ullman explain it this way in "Compilers: Principles,
> Techniques and Tools":
> "We say that the operator + associates to the left because an operand
> with plus signs on both sides of it is taken by the operator to its
> left. [...]"
> And they also show parse trees similar to the ones I wrote above.
>
> Kiuhnm
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af

2012-03-02 Thread Chiron
On Thu, 01 Mar 2012 10:13:11 -0500, Shmuel (Seymour J.) Metz wrote:

> In , on 03/01/2012
>at 05:07 AM, Chiron  said:
> 
>>Hmm... maybe, instead of just ridiculing him,
> 
> I'm treating him as he treats others.

OK.
> 
>>BTW, I happen to agree with you insofar as this poster not understanding
>> the nature of mathematics.  His comment reminds me of the article, 
>>"Transgressing the Boundaries: Towards a Transformative Hermeneutics of
>>Quantum Gravity"
> 
> A brilliant piece of work. I greatly enjoyed it and the reaction to its
> disclosure.

What always gets me is how so many people criticized Sokal for doing it, 
instead of soundly condemning the editor for not bothering to verify what 
Sokal said.  It's like the kid points out that the emperor has no 
clothes, so they shoot the kid.  Of course, in real life, that's exactly 
what would happen, so I guess I shouldn't be too surprised...



-- 
It is a hard matter, my fellow citizens, to argue with the belly,
since it has no ears.
-- Marcus Porcius Cato
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade!

2012-03-02 Thread Kiuhnm

On 3/2/2012 14:12, Xah Lee wrote:

On Mar 1, 3:00 am, Kiuhnm  wrote:

They did not make up the terminology, if that is what you are saying.
The concepts of left and right associativity are well-known and accepted
in TCS (Theoretical CS).




Aho, Sethi and Ullman explain it this way in "Compilers: Principles,
Techniques and Tools":
"We say that the operator + associates to the left because an operand
with plus signs on both sides of it is taken by the operator to its
left. [...]"
And they also show parse trees similar to the ones I wrote above.


how do they explain when 2 operators are adjacent e.g. 「3 △ 6 ▲ 5 」?


The same way you do, I guess. An operand that has operators on both 
sides is operand of the operator of higher precedence.

For instance, in
  3 * 4 + 6
4 is operand of * but not of +.
Indeed, the operands of + are 3*4 and 6.


do you happen to know some site that shows the relevant page i can
have a look?


Nope, sorry.

Kiuhnm
--
http://mail.python.org/mailman/listinfo/python-list


Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-03-02 Thread Mark Roseman
 Rick Johnson  wrote:
> Book authors and Doc authors are not always the most well informed; as
> we have witnessed by this very thread! Obviously these tutorials are more 
> like: "What NOT to do when coding Tkinter GUIs!" No wonder everyone hates 
> Tkinter.  :-)

Indeed. One of the things that motivated me to write the tutorial at 
http://www.tkdocs.com is the rather poor state (in terms of being out of 
date, incorrect, or demonstrating poor practices) of most Tkinter 
documentation.

Call it self-serving, but I think the Tkinter world would be a happier 
place if everyone just pointed to TkDocs. ;-)

To your point about explicit root, etc. I'll make the general 
observation that lots of different things work in a given situation, 
which is just fine for quick little hacky things. If people are doing 
anything more than a throwaway however, they'd be better served by 
spending a bit of time learning the conceptual underpinnings (e.g. 
http://www.tkdocs.com/tutorial/concepts.html) after which the "right" 
thing to do will be more obvious.

Mark
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: New Science Discovery: Perl Detractors Remain Idiots After A Decade!

2012-03-02 Thread Seymour J.
In , on 03/02/2012
   at 02:17 PM, Chiron  said:

>What always gets me is how so many people criticized Sokal for doing
>it, 

Google for Omerta. It's common for whistle blowers to be chastised or
even persecuted. I agree that the criticism of Prof Sokal was
outrageous, but it was also predictable.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to [email protected]

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is this the proper way to use a class method?

2012-03-02 Thread John Salerno
> Oh, but it does get passed, just implicitly. `super()` basically grabs
> `self` magically from its caller, and uses it to bind method calls on
> the magical object returned by `super()`.

Thanks again, now I understand :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-03-02 Thread John Salerno

> Indeed. One of the things that motivated me to write the tutorial at 
> http://www.tkdocs.com is the rather poor state (in terms of being out of 
> date, incorrect, or demonstrating poor practices) of most Tkinter 
> documentation.
> 
> Call it self-serving, but I think the Tkinter world would be a happier 
> place if everyone just pointed to TkDocs. ;-)
> 
> To your point about explicit root, etc. I'll make the general 
> observation that lots of different things work in a given situation, 
> which is just fine for quick little hacky things. If people are doing 
> anything more than a throwaway however, they'd be better served by 
> spending a bit of time learning the conceptual underpinnings (e.g. 
> http://www.tkdocs.com/tutorial/concepts.html) after which the "right" 
> thing to do will be more obvious.
> 
> Mark

Nice. I shall be spending some time at your website. I actually like wxPython, 
but I decided to learn a little Tkinter because it's already included and would 
be an easier and quicker option for small interfaces.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: New Science Discovery: Perl Detractors Remain Idiots After A Decade!

2012-03-02 Thread Chiron
On Fri, 02 Mar 2012 10:53:30 -0500, Shmuel (Seymour J.) Metz wrote:

> In , on 03/02/2012
>at 02:17 PM, Chiron  said:
> 
>>What always gets me is how so many people criticized Sokal for doing it,
> 
> Google for Omerta. It's common for whistle blowers to be chastised or
> even persecuted. I agree that the criticism of Prof Sokal was
> outrageous, but it was also predictable.

Yeah, omerta... I'm familiar with it.  Talk and you're dead, and they put 
a canary in your mouth (well, some folks do, anyway).

But of course you're right - it's a milder form of omerta.  It's just so 
misguided.  Kill the messenger.  Imprison the whistle-blower.



-- 
Imitation is the sincerest form of plagiarism.
-- 
http://mail.python.org/mailman/listinfo/python-list


decompilation

2012-03-02 Thread shikha panghal
Hi

Please decoplile the .pyc code ,as i have lost my .py code.

Thanks,
Shikha


hangman322.pyc
Description: Binary data
-- 
http://mail.python.org/mailman/listinfo/python-list


Python - CGI-BIN - Apache Timeout Problem

2012-03-02 Thread Sean Cavanaugh (scavanau)
Hello List,

 

Would appreciate some insight/help, ran out of ideas...

 

BRIEF OVERVIEW:

 

I am trying to create a simple webserver gui wrapper for a set of
scripts I developed to test some of our firewalls here at Cisco.  Being
that the total amount of engineer that will ever probably use this is 4
people and my limited python experience I just decided to do a quick
cgi-bin solution.  I control the machine with the webserver on em0 where
I do my fw testing on em1/em2.

 

Browser goes to http://webserver/main.py-> main.py executes a
script->tests.py ->test.py imports my engine v6tester_main.py which is a
series of functions I wrote. tests.py kicks of whatever test main.py
wanted.  

 

THE PROBLEM:

 

When I execute the scripts from the command line (#python main.py) it
generates it fine (albeit slowly), it prints all the html code out
including the script.  The 'core' part of the script dumbed down to the
lowest level is->

 

proc = subprocess.Popen(['/usr/local/bin/python', 'tests.py'],
stdout=subprocess.PIPE)

output = proc.stdout.read()

print output

proc.stdout.close()

 

When I open main.py and execute the script it just hangs... it seems to
execute the script (I see pcap fires on the interface that I am testing
on the firewall) but its not executing correctly... or loading the
entire webpage...the webpage keeps chugging along and eventually gives
me an error timeout.

 

I know it's not a permissions issue or setup issue b/c I did a proof of
concept where I just fired one simple pcap and it works fine (reported
back just like it would if I ran it on the command line).. it has
something to do with either the amount of prints out the script is
doing, or the timing.  I see no problems except the timeout (nothing in
logs: /var/log/http-error.log).  My script takes about 8 secounds to
run.  It does use threading but I wouldn't think that would mess it up.

 

BTW: I posted here if this helps anyone:
http://stackoverflow.com/questions/9524758/cgi-bin-timing-timeout-on-fre
ebsd-apache22

 

 

Thanks in advance for any ideas.  I can include the whole main.py if
that would help.

 



Sean Cavanaugh

Cisco Systems

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: decompilation

2012-03-02 Thread Chris Rebert
On Fri, Mar 2, 2012 at 10:52 AM, shikha panghal
 wrote:
> Hi
>
> Please decoplile the .pyc code ,as i have lost my .py code.

Your best shot would be:
http://www.crazy-compilers.com/decompyle/

Cheers,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: decompilation

2012-03-02 Thread Arnaud Delobelle
On 2 March 2012 18:52, shikha panghal  wrote:
> Hi
>
> Please decoplile the .pyc code ,as i have lost my .py code.

Aha, a customer!  I've written a module for this: unpyc3
(http://code.google.com/p/unpyc3/)

Here it is in action:


Python 3.2.1 (v3.2.1:ac1f7e5c0510, Jul  9 2011, 01:03:53)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import unpyc3
>>> import hangman322
>>> code = unpyc3.decompile(hangman322)
>>> print(code)
import random

def readFile(fileName):
file = open(fileName)
lineList = file.readlines()
file.close()
return lineList

def initialize(fileName):
try:
lineList = readFile(fileName)
except:
print('Oops! ' + filename + ' was not a valid file.')
return
len_d = len(lineList)
word_length = [0]*len_d
for i in range(len_d):
if lineList[i][-1] == '\n':
word_length[i] = len(lineList[i]) - 1
else:
word_length[i] = len(lineList[i])
tabulate = [0]*25
for i in range(len_d):
if word_length[i] >= 24:
tabulate[24] = tabulate[24] + 1
else:
tabulate[word_length[i]] = tabulate[word_length[i]] + 1
words = [None]*25
for i in range(2, 24):
words[i] = [None]*tabulate[i]
k = 0
for j in range(len_d):
if word_length[j] == i:
words[i][k] = lineList[j]
k = k + 1
for i in range(24, 25):
words[i] = [None]*tabulate[i]
k = 0
for j in range(len_d):
if word_length[j] >= i:
words[i][k] = lineList[j]
k = k + 1
return words

def wordsOfLength(n, source_file):
words = initialize(source_file)
return words[n]

def getUserStringInput(L, prompt):
replyInList = False
while not replyInList:
reply = input(prompt)
replyInList = reply in L
if not replyInList:
print('That reply is invalid. Try again.')
return reply

def intListToStringList(L):
L2 = ['']*len(L)
for i in range(len(L)):
L2[i] = str(L[i])
return L2

def getNewLetterGuess(availableLetters):
letterString = ''
for j in range(26):
if availableLetters[j]:
letterString = letterString + chr(65 + j) + ' '
else:
letterString = letterString + '  '
validChar = False
print(letterString)
while not validChar:
reply = input('Guess! > ')
if len(reply) == 1:
validChar = True
letterIndex = ord(reply) - 65
if letterIndex > 25:
letterIndex = letterIndex - 32
while letterIndex > 25 or not availableLetters[letterIndex]:
print('This is an invalid choice. Please try again!')
validChar = False
print(letterString)
while not validChar:
reply = input('Guess! > ')
if len(reply) == 1:
validChar = True
letterIndex = ord(reply) - 65
if letterIndex > 25:
letterIndex = letterIndex - 32
guess = chr(97 + letterIndex)
availableLetters[letterIndex] = False
return guess, availableLetters

def getWordFamilyCounter(L, n, guess):
wordFamilyCounter = [0]*2**n
familyIndexList = [-1]*len(L)
for k in range(len(L)):
w = list(L[k])
ct = 0
for k2 in range(n):
if w[k2] == guess:
ct = ct + 2**k2
familyIndexList[k] = ct
wordFamilyCounter[ct] = wordFamilyCounter[ct] + 1
return wordFamilyCounter, familyIndexList

def extractLargestFamily(L, familyIndexList, wordFamilyCounter):
bestFamily = wordFamilyCounter.index(max(wordFamilyCounter))
boolist = [False]*len(L)
for k3 in range(len(L)):
if familyIndexList[k3] == bestFamily:
boolist[k3] = True
j2 = 0
smallList = [' ']*sum(boolist)
for k4 in range(len(L)):
if boolist[k4]:
smallList[j2] = L[k4]
j2 = j2 + 1
return smallList

def updatePatternList(patternList, guess, bestFamily):
n = len(patternList)
for k6 in range(n):
if bestFamily//2 == bestFamily/2:
pass
else:
patternList[k6] = guess + ' '
bestFamily = bestFamily >> 1
return patternList

def pickWordFrom(L):
index = random.randint(0, len(L) - 1)
return L[index]

def play():
reply = getUserStringInput(intListToStringList(list(range(2,
21))), 'How long should I make your word?!!? (2 to 20) > ')
n = int(reply)
patternList = ['_ ']*n
print(''.join(patternList))
L = wordsOfLength(n, 'dictionary.txt')
reply = getUserStringInput(intListToStringList(list(range(1,
27))), 'How many guesses will you need? > ')
m = int(reply)
availableLetters = [True]*26
for i in range(m):
guess, availableLetters = getNewLetterGuess(availableLetters)
wordFamilyCounter, familyIndexList = getWordFamilyCounter(L,

Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-03-02 Thread Terry Reedy

On 3/1/2012 10:43 PM, Terry Reedy wrote:


Not sure what is happening on your end, but i don't see any braces.


Are you saying that if you change "Hello_World\n(click_me)" to
"Hello World\n(click me)", you see

Hello World
(click me)

as I expected, instead of

{Hellow World
(click me)}

as I do see? What OS are you running? And what tk version? (I have 8.5.9
in Win7)


The problem was another subtle bug in the current example":
self.hi_there["text"] = "Hello",

The spurious comma at the end makes the value of the 'text' attribute a 
one-elememt tuple and not just a string. I presume tcl-based tk handles 
that in the manner appropriate for the tcl equivalent. I believe tcl 
uses spaces rather than commas to separate items, so the braces serve as 
'quotes' to indicate that the contents are one item, not three. Removing 
the comma solves the problem.


--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


Re: Python - CGI-BIN - Apache Timeout Problem

2012-03-02 Thread Chris Rebert
On Fri, Mar 2, 2012 at 12:09 PM, Sean Cavanaugh (scavanau)
 wrote:

> THE PROBLEM:
>
> When I execute the scripts from the command line (#python main.py) it
> generates it fine (albeit slowly), it prints all the html code out including
> the script.  The ‘core’ part of the script dumbed down to the lowest level
> is->
>
>     proc = subprocess.Popen(['/usr/local/bin/python', 'tests.py'],
> stdout=subprocess.PIPE)
>     output = proc.stdout.read()

Note the red warning box about possible deadlock with .stdout.read()
and friends:
http://docs.python.org/library/subprocess.html#popen-objects

>     print output
>     proc.stdout.close()

As the docs advise, try using .communicate()
[http://docs.python.org/library/subprocess.html#subprocess.Popen.communicate
] instead:
proc = subprocess.Popen(…)
out, err = proc.communicate()
print out

> When I open main.py and execute the script it just hangs… it seems to
> execute the script (I see pcap fires on the interface that I am testing on
> the firewall) but its not executing correctly… or loading the entire
> webpage…the webpage keeps chugging along and eventually gives me an error
> timeout.

The hanging makes me suspect that the aforementioned deadlock is occurring.

Cheers,
Chris
--
http://chrisrebert.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-03-02 Thread Mel Wilson
Terry Reedy wrote:

> The problem was another subtle bug in the current example":
>  self.hi_there["text"] = "Hello",
> 
> The spurious comma at the end makes the value of the 'text' attribute a
> one-elememt tuple and not just a string. I presume tcl-based tk handles
> that in the manner appropriate for the tcl equivalent. I believe tcl
> uses spaces rather than commas to separate items, so the braces serve as
> 'quotes' to indicate that the contents are one item, not three. Removing
> the comma solves the problem.

That looks like it.  Tcl is the 'LISP of strings'  Composite-object things 
like indexing work on space-separated strings.


Mel.
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Python - CGI-BIN - Apache Timeout Problem

2012-03-02 Thread Sean Cavanaugh (scavanau)
Hey Chris,

Thanks for your quick reply!  I switched my code to->

proc = subprocess.Popen(['/usr/local/bin/python', 'tests.py'], 
stdout=subprocess.PIPE)
out, err = proc.communicate()
print out
proc.stdout.close()

It still dead locked.  Interestingly enough When I did a #python tests.py on 
the command line even that was taking awhile to print out to the command line 
so I decided to restart my webserver... wow from mucking before something must 
have been running in the background still.  I got the script down to 2 seconds 
or so... 

Now it still works but faster when I do #python main.py it generates all the 
text to the command line but the website still hangs when I go to 
http://webserver/main.py... I am not sure what is going wrong... no error in 
the /var/log except for the eventual timeout after a couple minutes goes by.

-S

-Original Message-
From: [email protected] [mailto:[email protected]] On Behalf Of Chris Rebert
Sent: Friday, March 02, 2012 3:23 PM
To: Sean Cavanaugh (scavanau)
Cc: [email protected]
Subject: Re: Python - CGI-BIN - Apache Timeout Problem

On Fri, Mar 2, 2012 at 12:09 PM, Sean Cavanaugh (scavanau)
 wrote:

> THE PROBLEM:
>
> When I execute the scripts from the command line (#python main.py) it
> generates it fine (albeit slowly), it prints all the html code out including
> the script.  The ‘core’ part of the script dumbed down to the lowest level
> is->
>
>     proc = subprocess.Popen(['/usr/local/bin/python', 'tests.py'],
> stdout=subprocess.PIPE)
>     output = proc.stdout.read()

Note the red warning box about possible deadlock with .stdout.read()
and friends:
http://docs.python.org/library/subprocess.html#popen-objects

>     print output
>     proc.stdout.close()

As the docs advise, try using .communicate()
[http://docs.python.org/library/subprocess.html#subprocess.Popen.communicate
] instead:
proc = subprocess.Popen(…)
out, err = proc.communicate()
print out

> When I open main.py and execute the script it just hangs… it seems to
> execute the script (I see pcap fires on the interface that I am testing on
> the firewall) but its not executing correctly… or loading the entire
> webpage…the webpage keeps chugging along and eventually gives me an error
> timeout.

The hanging makes me suspect that the aforementioned deadlock is occurring.

Cheers,
Chris
--
http://chrisrebert.com
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Python - CGI-BIN - Apache Timeout Problem

2012-03-02 Thread Sean Cavanaugh (scavanau)
Hey All,

So maybe this part is important (after doing some troubleshooting)  hopefully 
not everyone has beers in hand already since its Friday :-) 

The way the code works if you want to send through the firewall (i.e.   
SERVER->FIREWALL->SERVER)  I split the process into two threads.  One is 
listening on the egress, then I send on the ingress.  The main waits until the 
thread finishes (it times out after 2 seconds).  I had to do this b/c scapy 
(the library I used) won't let me send pcaps while I receive them.  This lets 
me see packets on both sides (i.e. did that sort of internet traffic go through 
the firewall).   The reason I think this could be a problem is when I ran a 
test where I sent to the firewall (rather than through it) and my program does 
not need to thread the webserver works fine..   

Suggestions anyone?

-S

-Original Message-
From: [email protected] [mailto:[email protected]] On Behalf Of Chris Rebert
Sent: Friday, March 02, 2012 3:23 PM
To: Sean Cavanaugh (scavanau)
Cc: [email protected]
Subject: Re: Python - CGI-BIN - Apache Timeout Problem

On Fri, Mar 2, 2012 at 12:09 PM, Sean Cavanaugh (scavanau)
 wrote:

> THE PROBLEM:
>
> When I execute the scripts from the command line (#python main.py) it
> generates it fine (albeit slowly), it prints all the html code out including
> the script.  The ‘core’ part of the script dumbed down to the lowest level
> is->
>
>     proc = subprocess.Popen(['/usr/local/bin/python', 'tests.py'],
> stdout=subprocess.PIPE)
>     output = proc.stdout.read()

Note the red warning box about possible deadlock with .stdout.read()
and friends:
http://docs.python.org/library/subprocess.html#popen-objects

>     print output
>     proc.stdout.close()

As the docs advise, try using .communicate()
[http://docs.python.org/library/subprocess.html#subprocess.Popen.communicate
] instead:
proc = subprocess.Popen(…)
out, err = proc.communicate()
print out

> When I open main.py and execute the script it just hangs… it seems to
> execute the script (I see pcap fires on the interface that I am testing on
> the firewall) but its not executing correctly… or loading the entire
> webpage…the webpage keeps chugging along and eventually gives me an error
> timeout.

The hanging makes me suspect that the aforementioned deadlock is occurring.

Cheers,
Chris
--
http://chrisrebert.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: decompilation

2012-03-02 Thread Karim

Le 02/03/2012 21:18, Arnaud Delobelle a écrit :

On 2 March 2012 18:52, shikha panghal  wrote:

Hi

Please decoplile the .pyc code ,as i have lost my .py code.

Aha, a customer!  I've written a module for this: unpyc3
(http://code.google.com/p/unpyc3/)

Here it is in action:


Python 3.2.1 (v3.2.1:ac1f7e5c0510, Jul  9 2011, 01:03:53)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

import unpyc3
import hangman322
code = unpyc3.decompile(hangman322)
print(code)

import random

def readFile(fileName):
 file = open(fileName)
 lineList = file.readlines()
 file.close()
 return lineList

def initialize(fileName):
 try:
 lineList = readFile(fileName)
 except:
 print('Oops! ' + filename + ' was not a valid file.')
 return
 len_d = len(lineList)
 word_length = [0]*len_d
 for i in range(len_d):
 if lineList[i][-1] == '\n':
 word_length[i] = len(lineList[i]) - 1
 else:
 word_length[i] = len(lineList[i])
 tabulate = [0]*25
 for i in range(len_d):
 if word_length[i]>= 24:
 tabulate[24] = tabulate[24] + 1
 else:
 tabulate[word_length[i]] = tabulate[word_length[i]] + 1
 words = [None]*25
 for i in range(2, 24):
 words[i] = [None]*tabulate[i]
 k = 0
 for j in range(len_d):
 if word_length[j] == i:
 words[i][k] = lineList[j]
 k = k + 1
 for i in range(24, 25):
 words[i] = [None]*tabulate[i]
 k = 0
 for j in range(len_d):
 if word_length[j]>= i:
 words[i][k] = lineList[j]
 k = k + 1
 return words

def wordsOfLength(n, source_file):
 words = initialize(source_file)
 return words[n]

def getUserStringInput(L, prompt):
 replyInList = False
 while not replyInList:
 reply = input(prompt)
 replyInList = reply in L
 if not replyInList:
 print('That reply is invalid. Try again.')
 return reply

def intListToStringList(L):
 L2 = ['']*len(L)
 for i in range(len(L)):
 L2[i] = str(L[i])
 return L2

def getNewLetterGuess(availableLetters):
 letterString = ''
 for j in range(26):
 if availableLetters[j]:
 letterString = letterString + chr(65 + j) + ' '
 else:
 letterString = letterString + '  '
 validChar = False
 print(letterString)
 while not validChar:
 reply = input('Guess!>  ')
 if len(reply) == 1:
 validChar = True
 letterIndex = ord(reply) - 65
 if letterIndex>  25:
 letterIndex = letterIndex - 32
 while letterIndex>  25 or not availableLetters[letterIndex]:
 print('This is an invalid choice. Please try again!')
 validChar = False
 print(letterString)
 while not validChar:
 reply = input('Guess!>  ')
 if len(reply) == 1:
 validChar = True
 letterIndex = ord(reply) - 65
 if letterIndex>  25:
 letterIndex = letterIndex - 32
 guess = chr(97 + letterIndex)
 availableLetters[letterIndex] = False
 return guess, availableLetters

def getWordFamilyCounter(L, n, guess):
 wordFamilyCounter = [0]*2**n
 familyIndexList = [-1]*len(L)
 for k in range(len(L)):
 w = list(L[k])
 ct = 0
 for k2 in range(n):
 if w[k2] == guess:
 ct = ct + 2**k2
 familyIndexList[k] = ct
 wordFamilyCounter[ct] = wordFamilyCounter[ct] + 1
 return wordFamilyCounter, familyIndexList

def extractLargestFamily(L, familyIndexList, wordFamilyCounter):
 bestFamily = wordFamilyCounter.index(max(wordFamilyCounter))
 boolist = [False]*len(L)
 for k3 in range(len(L)):
 if familyIndexList[k3] == bestFamily:
 boolist[k3] = True
 j2 = 0
 smallList = [' ']*sum(boolist)
 for k4 in range(len(L)):
 if boolist[k4]:
 smallList[j2] = L[k4]
 j2 = j2 + 1
 return smallList

def updatePatternList(patternList, guess, bestFamily):
 n = len(patternList)
 for k6 in range(n):
 if bestFamily//2 == bestFamily/2:
 pass
 else:
 patternList[k6] = guess + ' '
 bestFamily = bestFamily>>  1
 return patternList

def pickWordFrom(L):
 index = random.randint(0, len(L) - 1)
 return L[index]

def play():
 reply = getUserStringInput(intListToStringList(list(range(2,
21))), 'How long should I make your word?!!? (2 to 20)>  ')
 n = int(reply)
 patternList = ['_ ']*n
 print(''.join(patternList))
 L = wordsOfLength(n, 'dictionary.txt')
 reply = getUserStringInput(intListToStringList(list(range(1,
27))), 'How many guesses will you need?>  ')
 m = int(reply)
 availableLetters = [True]*26
 for i

Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-03-02 Thread John Salerno
> After that, you can nest as
> many frames, toplevels, and blah widgets under that root window as you
> so desire. Actually you don't even need a "frame", you can pack
> widgets directly into a Toplevel or Tk widget.

This is interesting. I completely understand your point about always calling 
(and using) the instance of Tk as the root. Given that, what is the point of 
creating a Frame object at all? I tried NOT doing it, like you said, and it 
seemed to work fine with my simple example. But is there a benefit to using a 
Frame object to group the widgets together? Or is it cleaner to just use the Tk 
object?
-- 
http://mail.python.org/mailman/listinfo/python-list


A possible change to decimal.Decimal?

2012-03-02 Thread Jeff Beardsley
HISTORY:  

In using python 2.7.2 for awhile on a web project (apache/wsgi web.py), I 
discovered a problem in using decimal.Decimal.  A short search revealed that 
many other people have been having the problem as well, in their own 
apache/wsgi implementations (django, mostly), but I found no real solutions 
among the posts I read.  So I did some experimentation of my own.

The following code will break unexpectedly on standard python2.7 (and earlier) 
because of the way that isinstance fails after reload() (which is called by 
both of the above web frameworks).

This is the error: TypeError("Cannot convert %r to Decimal" % value)

THE TEST CODE

import decimal
from decimal import Decimal

#this works
Decimal(Decimal())

reload(decimal)

#this fails before patching, but works fine afterwards
Decimal(Decimal())


THE SOLUTION:

So, looking into decimal.py I discovered lots if statements using isinstance, 
and have slightly rearranged the code inside __new__() to mostly remove their 
use, and for my purposes totally fixes the problem within wsgi.

I am not an official python dev, so would appreciate it if someone who *IS* 
could just look this over, improve it if necessary, and get it (or some 
variation) submitted into the library.

Below is a patch for use against python-2.7.2

PATCH:


*** decimal.py  2012-03-02 16:42:51.285964007 -0600
--- /usr/lib/python2.7/decimal.py   2012-03-02 14:36:01.238976461 -0600
***
*** 535,608 
  # and the Decimal constructor still deal with tuples of
  # digits.
  
  self = object.__new__(cls)
  
! # From a string
! # REs insist on real strings, so we can too.
! if isinstance(value, basestring):
! m = _parser(value.strip())
! if m is None:
! if context is None:
! context = getcontext()
! return context._raise_error(ConversionSyntax,
! "Invalid literal for Decimal: %r" % value)
! 
! if m.group('sign') == "-":
! self._sign = 1
! else:
! self._sign = 0
! intpart = m.group('int')
! if intpart is not None:
! # finite number
! fracpart = m.group('frac') or ''
! exp = int(m.group('exp') or '0')
! self._int = str(int(intpart+fracpart))
! self._exp = exp - len(fracpart)
! self._is_special = False
! else:
! diag = m.group('diag')
! if diag is not None:
! # NaN
! self._int = str(int(diag or '0')).lstrip('0')
! if m.group('signal'):
! self._exp = 'N'
! else:
! self._exp = 'n'
! else:
! # infinity
! self._int = '0'
! self._exp = 'F'
! self._is_special = True
! return self
! 
! # From an integer
! if isinstance(value, (int,long)):
! if value >= 0:
! self._sign = 0
! else:
! self._sign = 1
! self._exp = 0
! self._int = str(abs(value))
! self._is_special = False
  return self
  
! # From another decimal
! if isinstance(value, Decimal):
  self._exp  = value._exp
  self._sign = value._sign
  self._int  = value._int
  self._is_special  = value._is_special
  return self
  
  # From an internal working value
! if isinstance(value, _WorkRep):
  self._sign = value.sign
  self._int = str(value.int)
  self._exp = int(value.exp)
  self._is_special = False
  return self
  
  # tuple/list conversion (possibly from as_tuple())
  if isinstance(value, (list,tuple)):
  if len(value) != 3:
  raise ValueError('Invalid tuple size in creation of Decimal '
--- 535,582 
  # and the Decimal constructor still deal with tuples of
  # digits.
  
  self = object.__new__(cls)
  
! # Note about isinstance -- Decimal has been a victim of the
! # isinstance builtin failing after module reload in some
! # environments (e.g. web.py, django) under apache/wsgi, which
! # I determined to be the reason Decimal was causing so many
! # problems in my web deployment.  I have re-organized the
! # following code to remove use of isinstance except on
! # native types (int, long, float, list, tuple), since those
! # seem not to break in this regard. -- jdb
! 
! # First, assume it's another Decimal or similar(having _exp,
! #   _sign, _int and _is_special.  Obviously, having these
! # 

Re: A possible change to decimal.Decimal?

2012-03-02 Thread Jeff Beardsley
The problem with that though is:  I am not the one calling reload(). That
is actually being called for me by web.py (or django, or some other
framework, take your pick).  More than that, I believe it's called (or
caused, anyway) by something happening in WSGI under apache.  (And I don't
really want to start digging around in there either)

The patch in this case is very limited in scope, and all it inflicts on the
subject code inside of decimal.Decimal.__new__(), is better programming
practices.

--jeff

On Fri, Mar 2, 2012 at 5:49 PM, Ethan Furman  wrote:

> Jeff Beardsley wrote:
>
>> HISTORY:
>> In using python 2.7.2 for awhile on a web project (apache/wsgi web.py), I
>> discovered a problem in using decimal.Decimal.  A short search revealed
>> that many other people have been having the problem as well, in their own
>> apache/wsgi implementations (django, mostly), but I found no real solutions
>> among the posts I read.  So I did some experimentation of my own.
>>
>> The following code will break unexpectedly on standard python2.7 (and
>> earlier) because of the way that isinstance fails after reload() (which is
>> called by both of the above web frameworks).
>>
>> This is the error: TypeError("Cannot convert %r to Decimal" % value)
>>
>> THE TEST CODE
>>
>> import decimal
>> from decimal import Decimal
>>
>> #this works
>> Decimal(Decimal())
>>
>> reload(decimal)
>>
>> #this fails before patching, but works fine afterwards
>> Decimal(Decimal())
>>
>>
> Patching decimal.py to make it work with reload() is probably not going to
> happen.
>
> What you should be doing is:
>
>  import decimal
>  from decimal import Decimal
>
>  reload(decimal)
>  Decimal = decimal.Decimal   # (rebind 'Decimal' to the reloaded code)
>
> ~Ethan~
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A possible change to decimal.Decimal?

2012-03-02 Thread Ethan Furman

Jeff Beardsley wrote:
HISTORY:  


In using python 2.7.2 for awhile on a web project (apache/wsgi web.py), I 
discovered a problem in using decimal.Decimal.  A short search revealed that 
many other people have been having the problem as well, in their own 
apache/wsgi implementations (django, mostly), but I found no real solutions 
among the posts I read.  So I did some experimentation of my own.

The following code will break unexpectedly on standard python2.7 (and earlier) 
because of the way that isinstance fails after reload() (which is called by 
both of the above web frameworks).

This is the error: TypeError("Cannot convert %r to Decimal" % value)

THE TEST CODE

import decimal
from decimal import Decimal

#this works
Decimal(Decimal())

reload(decimal)

#this fails before patching, but works fine afterwards
Decimal(Decimal())



Patching decimal.py to make it work with reload() is probably not going 
to happen.


What you should be doing is:

  import decimal
  from decimal import Decimal

  reload(decimal)
  Decimal = decimal.Decimal   # (rebind 'Decimal' to the reloaded code)

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list


How do you use the widgets in tkinter.ttk if you want to "import tkinter as tk"?

2012-03-02 Thread John Salerno
According to the Python docs, the way to use tkinter.ttk is this:

from tkinter import *
from tkinter.ttk import *

But what if I don't like this import method and prefer to do:

import tkinter as tk

How then do I utilize tkinter.ttk using the same name? Or is that not possible? 
Will I have to use to separate names, like this:

import tkinter as tk
import tkinter.ttk as ttk

Is that the only way?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you use the widgets in tkinter.ttk if you want to "import tkinter as tk"?

2012-03-02 Thread Terry Reedy

On 3/2/2012 8:48 PM, John Salerno wrote:

According to the Python docs, the way to use tkinter.ttk is this:

from tkinter import *
from tkinter.ttk import *


I suppose the 'advantage' of this is that it will replace tk widgets 
with equivalent ttk widgets, if they exist and have the same name. I 
believe one has to program them differently, however, so the replacement 
cannot be transparent and one mush know anyway what gets replaced and 
what not.



But what if I don't like this import method and prefer to do:

import tkinter as tk

How then do I utilize tkinter.ttk using the same name?

> Or is that not possible? Will I have to use to separate names, like this:

No. One name for one object.


import tkinter as tk
import tkinter.ttk as ttk


Yes

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


Re: Unable to install xmldiff package on WIndows7

2012-03-02 Thread gwang
On Jan 3, 11:47 am, hisan  wrote:
> Hi All
>
> i have downloaded "xmldiff-0.6.10" from their official site 
> (http://www.logilab.org/859).
> I have tried installing the same on my 32 bit Windows 7 OS using the
> command "setup.py install" but below exceptions are thrown in the
> console.
> please help me out in installing this package on Windows
>
> Exceptions thrown while installing
>
> C:\Users\santosh\Downloads\xmldiff-0.6.10>setup.py build
> running build
> running build_py
> package init file '.\test\__init__.py' not found (or not a regular
> file)
> package init file '.\test\__init__.py' not found (or not a regular
> file)
> running build_ext
> building 'xmldiff.maplookup' extension
> gcc -mno-cygwin -mdll -O -Wall -ID:\Python26\include -ID:\Python26\PC -
> c extensions/maplookup.c -o b
> uild\temp.win32-2.6\Release\extensions\maplookup.o
> error: command 'gcc' failed: No such file or directory

edit maplookup.c and comment away the line : #include .
At least that's what worked for me.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you use the widgets in tkinter.ttk if you want to "import tkinter as tk"?

2012-03-02 Thread Ben Finney
Terry Reedy  writes:

> On 3/2/2012 8:48 PM, John Salerno wrote:
> > from tkinter import *
> > from tkinter.ttk import *
>
> I suppose the 'advantage' of this is that it will replace tk widgets
> with equivalent ttk widgets, if they exist and have the same name. I
> believe one has to program them differently, however, so the
> replacement cannot be transparent and one mush know anyway what gets
> replaced and what not.

Yes, and one mush is exactly what one gets when clobbering the namespace
with ‘from foo import *’ :-)

-- 
 \ “We are human only to the extent that our ideas remain humane.” |
  `\  —_Breakfast of Champions_, Kurt Vonnegut |
_o__)  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Udacity CS 101

2012-03-02 Thread Josh English
On Monday, February 27, 2012 6:37:25 PM UTC-8, Ray Clark wrote:
> 
> You have to remember that this course assumes no prior computer
> programming knowledge.
> 
> I agree, it is starting out very basic.  Give it some more time.
> These guys have PhDs from MIT and/or have taught at Stanford.  They
> know what they are doing.

It seems to me that they're not starting with good Python practices, really, or 
even the terminology I'd expect.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you use the widgets in tkinter.ttk if you want to "import tkinter as tk"?

2012-03-02 Thread John Salerno
> I suppose the 'advantage' of this is that it will replace tk widgets 
> with equivalent ttk widgets, if they exist and have the same name. I 
> believe one has to program them differently, however, so the replacement 
> cannot be transparent and one mush know anyway what gets replaced and 
> what not.

Grr, sounds like a pain if I want to use the new widgets. Does this cause 
conflict with someone who isn't running 8.5, or will they still see the older 
widgets as normal?

I'm tempted just to go back to wxPython. Two sets of widgets in Tkinter is a 
little annoying.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A 'Python like' language

2012-03-02 Thread dreamingforward
On Tuesday, March 30, 2004 12:31:35 AM UTC-7, Mark Hahn wrote:
> > --Take advantage of iterators early on for return values to avoid
> > things like having both dict.items() and dict.iteritems().
> 
> Interestiong idea.  Generators are fully supported so I could do this now.
> So gens would have to be allowed absolutely everywhere lists are allowed (is
> trhis possible?).  Or are you thinking the user should type
> List(dict.items()) ?

No, the former.  Most of the time you never really use a full, naked list 
anyway, generally only for documentation purposes.

> > --Choose "{:}" syntax for empty dict creation to reserve "{}" for
> > sets.  (Or: use "{}" for both, and do automatic "set-to-dict
> 
> Also cool.  Maybe <> for sets?  Prothon doesn't support <> as != so it is
> free.

I strongly suggest the standard (in math anyway) syntax for set notation.  It 
shouldn't be hard to parse whether code syntax is referring to a set vs. dict.

> > --Functions that return multiple, but unique, values should return a
> > set, not a list, to communicate same (ex: dict.keys(), dir(), etc.).
> 
> Also cool.

This is something that still hasn't really been implemented in PythonV3. 
 
> > --Dict should inherit from Set.
> 
> Also cool (I feel like the credits of Holy Grail saying Also wik).

An alternative is to create a named association type, similar to the ABC 
programming language, denoted by the colon.  "name": [].  A dict then would 
simply be a set of these.  Having a compound type would come in handy in 
several other ways too.

> > --With prothon's "immutability" bit and other considerations, does the
> > language need both tuples AND lists?
> 
> I like this a lot.  Tuples are already implemented internally as lists.

I think, in fact, that the object model could be more unified.  Under such a 
new object model, the worries about having a full library becomes rather 
pointless, as the new model will require a revamping of everything.

> More like a few dollars.  This is really good stuff.  Can I talk you into
> hanging out on the Prothon list now and then, at least until we get the core
> language sorted out?

Haha, a little late, but consider this a restart.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A 'Python like' language

2012-03-02 Thread Paul Rubin
[email protected] writes:
>> hanging out on the Prothon list now and then, at least until we get
>> the core language sorted out?
>
> Haha, a little late, but consider this a restart.

It wasn't til I saw the word "Prothon" that I scrolled back and saw you
were responding to a thread from 2004.  Prothon was pretty cool in some
ways but I think it's been inactive for a very long time.  I don't see
much point to developing a "slightly improved but incompatible
Python-like language" anyway though.  Why make superficial changes that
break working code and mentally overload programmers?  Python is a
relatively mature language by now, so it shouldn't be messed with unless
the changes produce drastic benefits, not minor ones.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A 'Python like' language

2012-03-02 Thread dreamingforward
On Tuesday, March 30, 2004 6:01:01 AM UTC-7, Gerrit wrote:
> > > --Dict should inherit from Set.
> > 
> > Also cool (I feel like the credits of Holy Grail saying Also wik).
> 
> I have read (in c.l.py) that in Smalltalk, a Dict is a Set of Associates
> or something similar. I don't know Smalltalk, but I like this idea of a
> Set.

Yeah, I like this too.  I take it from the ABC language.  The thing that's 
relevant (and apropos to Paul Rubin's objection), is that when unifying models, 
you have to decide "where the decimal point is" from which all the different 
dimensions that the language is encoding and silently tracking can pivot 
around.  The ":" of a compound is a sort of decimal point.   Then the task is 
finding a formalism in which to define and incorporate all the relavent 
dimensions into one.  The result will be necessarily recursive, revolving 
around the notions of the "atomic" versus the "group" and the transition rules 
that govern them.  

mark (aka zipher)
-- 
http://mail.python.org/mailman/listinfo/python-list