Unknown function operation deciphering, exercise in readability by program reasoning

2010-12-03 Thread small Pox
Rules : @1@ No execution of the function, only checking syntax @2@ No profiling using a debugger or profiler @3@ Editing allowed to make simpler variables (defun unknown-function (nano-thermite-911-FBI-fat-per-diem-bustards- kept-their-odious-mouth-shut-on-anthrax-and-911-lie) (let (BERNA

Re: Google AI challenge: planet war. Lisp won.

2010-12-03 Thread small Pox
On Dec 3, 8:56 pm, small Pox wrote: > > > Gábor wrote a blog about it > > > herehttp://quotenil.com/Planet-Wars-Post-Mortem.html > > http://presstv.ir/detail/153770.html > > It is said in the protocols to corrupt the minds of the GOYIM by > > alcohol > gambling > games      <- > porno

Re: Google AI challenge: planet war. Lisp won.

2010-12-03 Thread small Pox
On Dec 3, 8:56 pm, small Pox wrote: > > > Gábor wrote a blog about it > > > herehttp://quotenil.com/Planet-Wars-Post-Mortem.html > > http://presstv.ir/detail/153770.html > > It is said in the protocols to corrupt the minds of the GOYIM by > > alcohol > gambling > games      <- > porno

Re: Google AI challenge: planet war. Lisp won.

2010-12-03 Thread small Pox
> > Gábor wrote a blog about it > > herehttp://quotenil.com/Planet-Wars-Post-Mortem.html http://presstv.ir/detail/153770.html It is said in the protocols to corrupt the minds of the GOYIM by alcohol gambling games <- pornography adulteries sex Watch the photo and proof of isra

Re: Comparison with False - something I don't understand

2010-12-03 Thread Tim Harig
On 2010-12-03, Harishankar wrote: > On Fri, 03 Dec 2010 14:31:43 +, Mark Wooding wrote: >> In general, recovering from an exceptional condition requires three >> activities: >> >> * doing something about the condition so that the program can continue >> running; >> >> * identifying s

Re: Comparison with False - something I don't understand

2010-12-03 Thread Tim Harig
On 2010-12-04, alex23 wrote: > On Dec 3, 2:12 am, Tim Harig wrote: >> Actually, I thought that debate was resolved years ago.  I cannot think of >> a single recently developed programming language that does not provide >> exception handling mechanisms because they have been proven more reliable.

Re: Google AI challenge: planet war. Lisp won.

2010-12-03 Thread Mirko
On Dec 2, 12:06 pm, Xah Lee wrote: > discovered this rather late. > > Google has a AI Challenge: planet wars.http://ai-contest.com/index.php > > it started sometimes 2 months ago and ended first this month. > > the winner is Gábor Melis, with his code written in lisp. > > Congrats lispers! > > Gáb

Re: Comparison with False - something I don't understand

2010-12-03 Thread alex23
On Dec 3, 2:12 am, Tim Harig wrote: > Actually, I thought that debate was resolved years ago.  I cannot think of > a single recently developed programming language that does not provide > exception handling mechanisms because they have been proven more reliable. Google's Go lacks exceptions and I

Re: import module doesn't work for new package

2010-12-03 Thread Steven D'Aprano
On Fri, 03 Dec 2010 12:27:04 -0800, goldtech wrote: > I tried install a Python - would the word be "package"? - on Ubuntu > 10.10. Could you tell me how to fix? I would be grateful, is it a path > problem? Thanks. Lee That looks to me like either a missing dependency, or a bug in the package. I

Re: Exception handling in Python 3.x

2010-12-03 Thread Steven D'Aprano
On Fri, 03 Dec 2010 17:08:38 +0100, Peter Otten wrote: > After rereading the original post I still don't get why the workarounds > provided in those links aren't worth considering. The first work-around: http://mail.python.org/pipermail/python-list/2010-October/1258606.html is unsuitable beca

Re: Exception handling in Python 3.x

2010-12-03 Thread Steven D'Aprano
On Fri, 03 Dec 2010 16:26:19 +0100, Hrvoje Niksic wrote: > Peter Otten <__pete...@web.de> writes: > >>> Note that StopIteration is an internal detail of no relevance >>> whatsoever to the caller. Expose this is unnecessary at best and >>> confusing at worst. >> >> http://mail.python.org/pipermail

Re: [Python-es] Uso de variable Global

2010-12-03 Thread Guillermo Candia Huerta
El 02/12/10 19:04, Pau Cervera escribió: > Ni idea de Tkinter, pero ¿no puedes almacenar *valor* en una variable de > instancia de App y convertir la función *muestra* en un método de la classe > App que teng aceso a las variables de instancia de App? > > - > Pau > > Python..., what else? >

Re: Exception handling in Python 3.x

2010-12-03 Thread Steven D'Aprano
On Fri, 03 Dec 2010 10:15:58 -0800, Paul Rubin wrote: > Steven D'Aprano writes: >> def func(iterable): >> it = iter(iterable) >> failed = False >> try: >> x = next(it) >> except StopIteration: >> failed = True >> if failed: >> raise ValueError("can't pr

Re: Assigning to __class__ attribute

2010-12-03 Thread Steven D'Aprano
On Fri, 03 Dec 2010 19:28:00 +, kj wrote: > This was the first surprise for me: assigning to the __class__ attribute > not only isn't vetoed, but in fact changes the instances class: > > Oh-ky... > > First question: how kosher is this sort of class transmutation through > assignment to _

Re: class attribute confusion

2010-12-03 Thread Steven D'Aprano
On Fri, 03 Dec 2010 22:54:19 +0100, OAN wrote: > Hi, > > i was having a problem with class attributes initiated outside of > __init__. This code is a demonstration of what i mean: [...] > I would expect the following result: > > v: [1] > x: [1, 2] > y: [1, 2] > z: [1] > v: [1] > > Who wouldn't,

Re: Assigning to __class__ attribute

2010-12-03 Thread Mark Wooding
kj writes: > >>> class Spam(object): pass > > Now I define an instance of Spam and an instance of Spam's superclass: > >>> x = Spam() > >>> y = Spam.__mro__[1]() # (btw, is there a less uncouth way to do this???) There's the `__bases__' attribute, which is simply a tuple of the class's direct su

Re: class attribute confusion

2010-12-03 Thread Arnaud Delobelle
OAN writes: > Hi, > > i was having a problem with class attributes initiated outside of > __init__. This code is a demonstration of what i mean: > > class A(): > mylist = [] > def __init__(self): > self.mylist.append(1) > pass > > class B(A): > def __init__(self): >

class attribute confusion

2010-12-03 Thread OAN
Hi, i was having a problem with class attributes initiated outside of __init__. This code is a demonstration of what i mean: class A(): mylist = [] def __init__(self): self.mylist.append(1) pass class B(A): def __init__(self): A.__init__(self) self.

Re: Comparison with False - something I don't understand

2010-12-03 Thread Aahz
In article , Harishankar wrote: >On Thu, 02 Dec 2010 17:33:47 -0800, Aahz wrote: >> >> Please demonstrate that using ``if`` blocks for True/False is impler and >> cleaner than using ``try`` blocks to handle exceptions. > >It is my personal preference and coding style for certain situations I >en

Re: Assigning to __class__ attribute

2010-12-03 Thread Arnaud Delobelle
kj writes: > I have a couple of questions regarding assigning to an instance's > __class__ attribute. > > The first is illustrated by the following interaction. First I > define an empty class: > class Spam(object): pass > ... > > Now I define an instance of Spam and an instance of Spam's

Re: Assigning to __class__ attribute

2010-12-03 Thread Robert Kern
On 12/3/10 1:28 PM, kj wrote: I have a couple of questions regarding assigning to an instance's __class__ attribute. The first is illustrated by the following interaction. First I define an empty class: class Spam(object): pass ... Now I define an instance of Spam and an instance of Spam'

import module doesn't work for new package

2010-12-03 Thread goldtech
I tried install a Python - would the word be "package"? - on Ubuntu 10.10. Could you tell me how to fix? I would be grateful, is it a path problem? Thanks. Lee gi...@giga1:~/Desktop/pykhtml-0.2$ sudo python setup.py install [sudo] password for giga1: running install running build running build_py

Re: Exception handling in Python 3.x

2010-12-03 Thread Ethan Furman
Peter Otten wrote: Hrvoje Niksic wrote: Peter Otten <__pete...@web.de> writes: Note that StopIteration is an internal detail of no relevance whatsoever to the caller. Expose this is unnecessary at best and confusing at worst. http://mail.python.org/pipermail/python-list/2010-October/1258606.

Re: Exception handling in Python 3.x

2010-12-03 Thread Ethan Furman
Peter Otten wrote: > http://mail.python.org/pipermail/python-list/2010-October/1258606.html http://mail.python.org/pipermail/python-list/2010-October/1259024.html I found #6210 on bugs.python.org -- does anyone know if there are any others regarding this issue? Or any progress on MRAB's idea

Assigning to __class__ attribute

2010-12-03 Thread kj
I have a couple of questions regarding assigning to an instance's __class__ attribute. The first is illustrated by the following interaction. First I define an empty class: >>> class Spam(object): pass ... Now I define an instance of Spam and an instance of Spam's superclass: >>> x = Spam()

Re: Twisted and txJSON-RPC

2010-12-03 Thread jaime
did you fix it? I have the same problem -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparison with False - something I don't understand

2010-12-03 Thread Emile van Sebille
On 12/3/2010 6:31 AM Mark Wooding said... It's easy to show that a resumable exception system can do everything that a nonresumable system (like Python's) can do (simply put all of the recovery logic at the resume point); but the converse is not true. There are some other fringe benefits to res

Re: Exception handling in Python 3.x

2010-12-03 Thread Paul Rubin
Steven D'Aprano writes: > def func(iterable): > it = iter(iterable) > failed = False > try: > x = next(it) > except StopIteration: > failed = True > if failed: > raise ValueError("can't process empty iterable") > print(x) Untested: from itertoo

Re: Comparison with False - something I don't understand

2010-12-03 Thread Harishankar
On Thu, 02 Dec 2010 17:33:47 -0800, Aahz wrote: > Please demonstrate that using ``if`` blocks for True/False is impler and > cleaner than using ``try`` blocks to handle exceptions. It is my personal preference and coding style for certain situations I encounter in my own programs and not somethi

How to add data into exisitng Excel file at next open row?

2010-12-03 Thread noydb
How can you determine the next open row in an existing Excel file such that you can start adding data to the cells in that row? As in below, I want a variable in place of the 6 (row 6 in the four ws1.Cells(x,1) lines), but have no other way of knowing what row I am on besides looking to the first

Re: Comparison with False - something I don't understand

2010-12-03 Thread Harishankar
On Fri, 03 Dec 2010 14:31:43 +, Mark Wooding wrote: > The most obvious improvement is resumable exceptions. This is probably what I had in mind but I just couldn't explain it the way you did below. > > In general, recovering from an exceptional condition requires three > activities: > >

Using a window style in a Toplevel window

2010-12-03 Thread craf
Hi. I use Python 3.1 and Tkinter.ttk 8.5 on Ubuntu 9.10. CODE: module:FMain.py from tkinter import ttk from FSecondWindow import * class App: def __init__(self,master): button1 = ttk.Button(master,text='Show TopLevel',command=lam

Re: Exception handling in Python 3.x

2010-12-03 Thread Peter Otten
Hrvoje Niksic wrote: > Peter Otten <__pete...@web.de> writes: > >>> Note that StopIteration is an internal detail of no relevance whatsoever >>> to the caller. Expose this is unnecessary at best and confusing at >>> worst. >> >> http://mail.python.org/pipermail/python-list/2010-October/1258606.ht

Re: position independent build of python

2010-12-03 Thread Diez B. Roggisch
erikj writes: > If my understanding is correct, the sys.prefix variable holds the root > directory python uses to find related files, and eg its site-packages. > > the value of sys.prefix is specified at compile time. > > it seems that on windows, when I build/install python at one location, > an

Re: Exception handling in Python 3.x

2010-12-03 Thread Hrvoje Niksic
Peter Otten <__pete...@web.de> writes: >> Note that StopIteration is an internal detail of no relevance whatsoever >> to the caller. Expose this is unnecessary at best and confusing at worst. > > http://mail.python.org/pipermail/python-list/2010-October/1258606.html > http://mail.python.org/piperm

Using python for web IM?

2010-12-03 Thread Kechagias Apostolos
Hello, We are currently working on a project which needs video and audio streaming(peer to peer). We need to know if there are any available open source libraries to embed video,audio,p2p transfer in our client OR if there is any available framework which could help us with our project. It would

Re: is id(self) constant over an object lifetime ?

2010-12-03 Thread Christian Heimes
Am 03.12.2010 14:53, schrieb Jean-Michel Pichavant: > Next time I promise to look at the doc before actually asking the > question here :) You are misinterpreting the excerpt. You are right that the id of an object doesn't change during the lifetime of a Python process and as long as it stays ins

Re: Google AI challenge: planet war. Lisp won.

2010-12-03 Thread namekuseijin
On 2 dez, 15:06, Xah Lee wrote: > discovered this rather late. > > Google has a AI Challenge: planet wars.http://ai-contest.com/index.php > > it started sometimes 2 months ago and ended first this month. > > the winner is Gábor Melis, with his code written in lisp. > > Congrats lispers! > > Gábor

Re: Comparison with False - something I don't understand

2010-12-03 Thread Mark Wooding
Steven D'Aprano writes: > On Thu, 02 Dec 2010 16:35:08 +, Mark Wooding wrote: > > There are better ways to handle errors than Python's exception system. > > I'm curious -- what ways would they be? The most obvious improvement is resumable exceptions. In general, recovering from an exception

Re: Exception handling in Python 3.x

2010-12-03 Thread Peter Otten
Steven D'Aprano wrote: > Consider the following common exception handling idiom: > > def func(iterable): > it = iter(iterable) > try: > x = next(it) > except StopIteration: > raise ValueError("can't process empty iterable") > print(x) > > The intention is: > > *

Great chance for Management work.

2010-12-03 Thread gaurav
Best site for management careers. Career in Management. http://jobscore.webs.com/executivemanager.htm http://topcareer.webs.com/businessmanagement.htm Chances for banking career listing to all over cites person can get work as bank employee. http://rojgars1.webs.com/gov.htm http://printmediajobs.w

Re: Exception handling in Python 3.x

2010-12-03 Thread Hrvoje Niksic
Steven D'Aprano writes: > Consider the following common exception handling idiom: > > def func(iterable): > it = iter(iterable) > try: > x = next(it) > except StopIteration: > raise ValueError("can't process empty iterable") > print(x) Not exactly what you're look

New to Jython - how to install setuptools?

2010-12-03 Thread Dobedani
Hi folks, I'm new to Jython - not to Python. The good thing about Python is that there are many packages available which can be installed easily by means of setuptools. Today I installed Jython, because I'm thinking of integrating some Python code into a web application which will be hosted on a w

Re: is id(self) constant over an object lifetime ?

2010-12-03 Thread Jean-Michel Pichavant
Adam Tauno Williams wrote: On Fri, 2010-12-03 at 14:44 +0100, Jean-Michel Pichavant wrote: Hello fellows, I would need a unique internal identifier to an object. Can I use the object python id ? class Foo: def getUniqueIdentifier(): return id(self) This id needs to be unique and

Python assignments

2010-12-03 Thread Sverker Nilsson
Dear friends, This is Sverker from Sweden. You probably know me better as the guy who made Guppy/Heapy: http://guppy-pe.sf.net I am currently in the process of preparing version 0.1.10 with support for Python 2.7. I will let you know when it is updated. For those who don’t know, I work as a con

Re: is id(self) constant over an object lifetime ?

2010-12-03 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: Hello fellows, I would need a unique internal identifier to an object. Can I use the object python id ? class Foo: def getUniqueIdentifier(): return id(self) This id needs to be unique and constant over the python process lifetime. JM sorry guys " id(/objec

Re: is id(self) constant over an object lifetime ?

2010-12-03 Thread Adam Tauno Williams
On Fri, 2010-12-03 at 14:44 +0100, Jean-Michel Pichavant wrote: > Hello fellows, > I would need a unique internal identifier to an object. Can I use the > object python id ? > class Foo: > def getUniqueIdentifier(): >return id(self) > This id needs to be unique and constant over the p

Re: is id(self) constant over an object lifetime ?

2010-12-03 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: Hello fellows, I would need a unique internal identifier to an object. Can I use the object python id ? class Foo: def getUniqueIdentifier(): return id(self) This id needs to be unique and constant over the python process lifetime. JM erratum python

is id(self) constant over an object lifetime ?

2010-12-03 Thread Jean-Michel Pichavant
Hello fellows, I would need a unique internal identifier to an object. Can I use the object python id ? class Foo: def getUniqueIdentifier(): return id(self) This id needs to be unique and constant over the python process lifetime. JM -- http://mail.python.org/mailman/listinfo/pyt

Re: Reading by positions plain text files

2010-12-03 Thread javivd
On Dec 1, 3:15 am, Tim Harig wrote: > On 2010-12-01, javivd wrote: > > > > > On Nov 30, 11:43 pm, Tim Harig wrote: > >> On 2010-11-30, javivd wrote: > > >> > I have a case now in wich another file has been provided (besides the > >> > database) that tells me in wich column of the file is every

Exception handling in Python 3.x

2010-12-03 Thread Steven D'Aprano
Consider the following common exception handling idiom: def func(iterable): it = iter(iterable) try: x = next(it) except StopIteration: raise ValueError("can't process empty iterable") print(x) The intention is: * detect an empty iterator by catching StopIteration

Re: Comparison with False - something I don't understand

2010-12-03 Thread Mel
Harishankar wrote: > I think I understand the general trend of what you're saying. It > definitely requires a mindset change. I still feel that user-defined > exception classes might not be the way, but maybe I should allow the > built-in exceptions which are thrown by library functions to follow

Re: Comparison with False - something I don't understand

2010-12-03 Thread Tim Harig
On 2010-12-03, Paul Rubin wrote: > Steven D'Aprano writes: >>> There are better ways to handle errors than Python's exception system. >> I'm curious -- what ways would they be? >> I'm aware of three general exception handling techniques: ... >> What else is there? > > The Erlang approach is to ch