Re: reference vs. name space question

2010-10-10 Thread Steven D'Aprano
On Sat, 09 Oct 2010 21:00:45 -0700, chad wrote: > Maybe I'm being a bit dense, but how something like > > [cdal...@localhost oakland]$ python > Python 2.6.2 (r262:71600, May 3 2009, 17:04:44) [GCC 4.1.1 20061011 > (Red Hat 4.1.1-30)] on linux2 Type "help", "copyright", "credits" or > "license" f

Re: Class-level variables - a scoping issue

2010-10-10 Thread Jonathan Gardner
On Oct 9, 10:30 pm, John Nagle wrote: >     Here's an obscure bit of Python semantics which > is close to being a bug: > >  >>> class t(object) : > ...     classvar = 1 > ... > ...     def fn1(self) : > ...         print("fn1: classvar = %d" % (self.classvar,)) > ...         self.classvar = 2 > ..

Re: Class-level variables - a scoping issue

2010-10-10 Thread Lawrence D'Oliveiro
In message <4cb14f8c$0$1627$742ec...@news.sonic.net>, John Nagle wrote: > Within "fn1", the first reference to "self.classvar" references the class- > level version of "classvar". The assignment overrides that and creates an > object-level instance of "self.classvar". Further references to > self

Re: if the else short form

2010-10-10 Thread Lawrence D'Oliveiro
In message <45368e8d-3b4f-4380-974d-bf9cd5d68...@w9g2000prc.googlegroups.com>, NevilleDNZ wrote: > I do ponder why (given that linked lists can easily be created in Algol68) > useful types like LIST and DICT were left out of the standard prelude. I guess a list type wasn’t seen as primitive enou

Re: script in Linux vs Windows

2010-10-10 Thread Dave Angel
On 2:59 PM, Lawrence D'Oliveiro wrote: In message, Dennis Lee Bieber wrote: On Windows, the I/O system for text files converts into a on input, and on output converts to. Is it Windows doing that, or is it some Visual Studio library? Windows OS itself does not transform any newlines at

Re: hashkey/digest for a complex object

2010-10-10 Thread Hrvoje Niksic
Steven D'Aprano writes: > On Sat, 09 Oct 2010 21:39:51 +0100, Arnaud Delobelle wrote: > >> 1. hash() is an idempotent function, i.e. hash(hash(x)) == hash(x) hold >> for any hashable x (this is a simple consequence of the fact that >> hash(x) == x for any int x (by 'int' I mean 2.X int)). > > It'

Re: Unicode Support in Ruby, Perl, Python, Emacs Lisp

2010-10-10 Thread David Kastrup
Sean McAfee writes: > Xah Lee writes: >> Perl's exceedingly lousy unicode support hack is well known. In fact >> it is the primary reason i “switched” to python for my scripting needs >> in 2005. (See: Unicode in Perl and Python) > > I think your assessment is antiquated. I've been doing Unicod

Re: hashkey/digest for a complex object

2010-10-10 Thread Arnaud Delobelle
Steven D'Aprano writes: > On Sat, 09 Oct 2010 21:39:51 +0100, Arnaud Delobelle wrote: > >> 1. hash() is an idempotent function, i.e. hash(hash(x)) == hash(x) hold >> for any hashable x (this is a simple consequence of the fact that >> hash(x) == x for any int x (by 'int' I mean 2.X int)). > > It'

Re: "Strong typing vs. strong testing"

2010-10-10 Thread Lie Ryan
On 10/01/10 00:24, TheFlyingDutchman wrote: > >> >>> If I had to choose between "blow up" or "invalid answer" I would pick >>> "invalid answer". >> >> there are some application domains where neither option would be >> viewed as a satisfactory error handling strategy. Fly-by-wire, petro- >> chemic

Re: Unicode Support in Ruby, Perl, Python, Emacs Lisp

2010-10-10 Thread Nobody
On Sat, 09 Oct 2010 15:45:42 -0700, Sean McAfee wrote: >> I'll have to say, as far as text processing goes, the most beautiful >> lang with respect to unicode is emacs lisp. In elisp code (e.g. >> Generate a Web Links Report with Emacs Lisp ), i don't have to declare >> none of the unicode or enco

Re: Unicode Support in Ruby, Perl, Python, Emacs Lisp

2010-10-10 Thread Steven D'Aprano
On Sun, 10 Oct 2010 11:34:02 +0200, David Kastrup wrote: [unnecessary quoting removed] > Your headers state: > > User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (darwin) Please stop spamming multiple newsgroups. I'm sure this is of great interest to the Emacs newsgroup, but not of Python. Followu

Re: Help with pointers when calling from python to C

2010-10-10 Thread Nobody
On Fri, 08 Oct 2010 18:02:15 +0200, Jonas H. wrote: > On 10/08/2010 05:23 PM, Carolyn MacLeod wrote: >> "How do I pass an integer by reference to a C function?" > > That's impossible in pure Python. The only thing I can think of is a > wrapper in C. I didn't see the original message, but if you

Re: "Strong typing vs. strong testing"

2010-10-10 Thread Lie Ryan
On 10/02/10 20:04, Nick Keighley wrote: >>> > > In a statically typed language, the of-the-wrong-type is something which >>> > > can, by definition, be caught at compile time. >> > >> > Any time something is true "by definition" that is an indication that >> > it's not a particularly useful fact. >

Re: "Strong typing vs. strong testing"

2010-10-10 Thread Lie Ryan
On 10/05/10 14:36, salil wrote: > So, the programmer who > specifically mentions "Int" in the signature of the function, is > basically overriding this default behavior for specific reasons > relevant to the application, for example, for performance. I think > Haskell's way is the right. I agree

Re: Class-level variables - a scoping issue

2010-10-10 Thread Chris Torek
In article <4cb14f8c$0$1627$742ec...@news.sonic.net> John Nagle wrote: >Here's an obscure bit of Python semantics which >is close to being a bug: [assigning to instance of class creates an attribute within the instance, thus obscuring the class-level version of the attribute] This is sort o

Re: "Strong typing vs. strong testing"

2010-10-10 Thread Lie Ryan
On 10/01/10 23:56, BartC wrote: > > "Pascal J. Bourguignon" wrote in message > news:87zkuyjawh@kuiper.lan.informatimago.com... >> "BartC" writes: >> >>> "Pascal J. Bourguignon" wrote in message > When Intel will realize that 99% of its users are running VM >>> >>> Which one? >> >> Any

Compiling xpython: No rule to make target `runathana.py', needed by `frozen/frozen.c'.

2010-10-10 Thread est
I found an interesting project, it's a single 4.7 MB executable with stdlib+PIL+pdf r/w+magpy+wxpython environment But when compiling following the instructions http://www.xpython.org/#compiling there is an error make: *** No rule to make target `runathana.py', needed by `frozen/ frozen.c'. St

SQLObject 0.14.0

2010-10-10 Thread Oleg Broytman
Hello! I'm pleased to announce version 0.14.0, the first stable release of branch 0.14 of SQLObject. What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be e

Re: how to handle network failures

2010-10-10 Thread Jorgen Grahn
On Fri, 2010-10-08, harryos wrote: > hi > I am trying to write a DataGrabber which reads some data from given > url..I made DataGrabber as a Thread and want to wait for some interval > of time in case there is a network failure that prevents read(). > I am not very sure how to implement this > > c

Institutional careers in Management work.

2010-10-10 Thread gaurav
Careers recruitments in Management work. Employments in Management careers. http://managementjobs.webs.com/pm.htm & http://jobscore.webs.com/executivemanager.htm Rush for career in government and computer jobs potential revenue. http://rojgars1.webs.com/gov.htmhttp://rojgars.webs.com/bankingjo

Documentation on the Tkinter files in Python's tcl folder?

2010-10-10 Thread python
Is there some sort of documentation regarding the files in Python's tcl folder? I've been googling this topic without finding such a source. Thank you, Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Re: hashkey/digest for a complex object

2010-10-10 Thread kj
In <87hbgu8irb@gmail.com> Arnaud Delobelle writes: >Steven D'Aprano writes: >> On Sat, 09 Oct 2010 21:39:51 +0100, Arnaud Delobelle wrote: >> >>> 1. hash() is an idempotent function, i.e. hash(hash(x)) == hash(x) hold >>> for any hashable x (this is a simple consequence of the fact that >>>

Re: hashkey/digest for a complex object

2010-10-10 Thread Steven D'Aprano
On Sun, 10 Oct 2010 11:06:00 +0100, Arnaud Delobelle wrote: > Steven D'Aprano writes: > >> On Sat, 09 Oct 2010 21:39:51 +0100, Arnaud Delobelle wrote: >> >>> 1. hash() is an idempotent function, i.e. hash(hash(x)) == hash(x) >>> hold for any hashable x (this is a simple consequence of the fact t

Re: hashkey/digest for a complex object

2010-10-10 Thread Steven D'Aprano
On Sun, 10 Oct 2010 13:49:09 +, kj wrote: >>> to give only two of an infinite number of counter-examples. > > (Infinite???) I was mistaken. Given Arnaud's specification that we look only at the Python 2.x ints, I believe that there is only one counter-example, namely -1. However, in Pytho

Re: hashkey/digest for a complex object

2010-10-10 Thread Arnaud Delobelle
kj writes: > In <87hbgu8irb@gmail.com> Arnaud Delobelle writes: [...] >>And, in fact, >>(-1) is the only int such that hash(x) != x. > > Arnaud, how did you determine that -1 is the only such int? I > can't imagine any other approach other than a brute-force check of > all ints... When I

Re: hashkey/digest for a complex object

2010-10-10 Thread Hrvoje Niksic
Arnaud Delobelle writes: > I have learnt too that hash(-1) is not (-1), and that it seems that a > hash value is not allowed to be (-1). There is one thing left to find > out. Why can't it be (-1)? Because -1 has a special meaning in the C function equivalent to Python's hash(). PyObject_Hash

UTF-8 problem encoding and decoding in Python3

2010-10-10 Thread hidura
Hello everybody i am trying to encode a file string of an upload file and i am facing some problems with the first part of the file. When i open directly and try to decode the file the error is this: `UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position 0: unexpected code byt

Re: Many newbie questions regarding python

2010-10-10 Thread Peter Pearson
On Sat, 09 Oct 2010 19:30:16 -0700, Ethan Furman wrote: > Steven D'Aprano wrote: [snip] >> But that doesn't mean that the list comp is the general purpose solution. >> Consider the obvious use of the idiom: >> >> def func(arg, count): >> # Initialise the list. >> L = [arg for i in range(

Re: UTF-8 problem encoding and decoding in Python3

2010-10-10 Thread Chris Rebert
On Sun, Oct 10, 2010 at 10:25 AM, wrote: > Hello everybody i am trying to encode a file string of an upload file and i > am facing some problems with the first part of the file. When i open > directly and try to decode the file the error is this: `UnicodeDecodeError: > 'utf8' codec can't decode b

Re: Class-level variables - a scoping issue

2010-10-10 Thread John Nagle
On 10/10/2010 12:53 AM, Lawrence D'Oliveiro wrote: In message<4cb14f8c$0$1627$742ec...@news.sonic.net>, John Nagle wrote: Within "fn1", the first reference to "self.classvar" references the class- level version of "classvar". The assignment overrides that and creates an object-level instance o

Re: "Strong typing vs. strong testing"

2010-10-10 Thread Martin Gregorie
On Sun, 10 Oct 2010 21:38:11 +1100, Lie Ryan wrote: > > Virtual Machine in Hardware... isn't that a contradiction? > Nope. Several mainframes did that. Two that I knew well were both British - the ICL 1900 and 2900. The Burroughs x700 series also used hardware virtualisation. Both Burroughs a

Re: UTF-8 problem encoding and decoding in Python3

2010-10-10 Thread Almar Klein
Hi, please tell us what you are trying to do. Encoding (with UTF-8) is a method to convert a Unicode string to a sequence of bytes. Decoding does the reverse. When i open > directly and try to decode the file the error is this: `UnicodeDecodeError: > 'utf8' codec can't decode byte 0xff in positi

Re: hashkey/digest for a complex object

2010-10-10 Thread kj
In <4cb1dc9a$0$29970$c3e8da3$54964...@news.astraweb.com> Steven D'Aprano writes: >Reading the source code is also a good approach. Every time I have attempted to answer a question by looking at the Python C source, all I've achieved was wasting time, sometimes a *lot* of time, so by now I've de

Re: UTF-8 problem encoding and decoding in Python3

2010-10-10 Thread Hidura
I try to encode a binary file what was upload to a server and is extract from the wsgi.input of the environ and comes as an unicode string. 2010/10/10, Almar Klein : > Hi, > > please tell us what you are trying to do. Encoding (with UTF-8) is a method > to convert a Unicode string to a sequence of

cp936 uses gbk codec, doesn't decode `\x80` as U+20AC EURO SIGN

2010-10-10 Thread John Machin
|>>> '\x80'.decode('cp936') Traceback (most recent call last): File "", line 1, in UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 0: incomplete multibyte sequence However: Retrieved 2010-10-10 from http://www.unicode.org/Public /MAPPINGS/VENDORS/MICSFT/WINDOWS/CP936.TXT

Re: Design: Module interface vs. library interface

2010-10-10 Thread Aahz
In article <4c8b8123.80...@sschwarzer.net>, Stefan Schwarzer wrote: > >Which approach would you prefer and why? Or some other approach? Would >you use a different approach if the library-internal class was named >`_FTPFile` instead of `FTPFile`? If it's not a public class, it should have been na

Re: open file on mac

2010-10-10 Thread tinauser
On Oct 10, 6:54 am, Lawrence D'Oliveiro wrote: > In message > , > > tinauser wrote: > > now,the file will be opened only if i give the full path, not if i > > give only the name of the file, although the folder is in the path. > > what am I missing? > > The fact that sys.path is not used for that.

Re: Control webbrowser from Python script

2010-10-10 Thread luca
On Oct 9, 11:39 am, Johny wrote: > Is it possible to control any webbrowser from Python ? For example to > issue http POST and GET  command > Thanks > Johny I'm using funkload and it is awesome! http://funkload.nuxeo.org/ FunkLoad is a functional and load web tester, written in Python, whose ma

Re: open file on mac

2010-10-10 Thread Benjamin Kaplan
On Sun, Oct 10, 2010 at 5:29 PM, tinauser wrote: > On Oct 10, 6:54 am, Lawrence D'Oliveiro central.gen.new_zealand> wrote: >> In message >> , >> >> tinauser wrote: >> > now,the file will be opened only if i give the full path, not if i >> > give only the name of the file, although the folder is i

Reading Outlook .msg file using Python

2010-10-10 Thread John Henry
Hello all: I have a need to read .msg files exported from Outlook. Google search came out with a few very old posts about the topic but nothing really useful. The email module in Python is no help - everything comes back blank and it can't even see if there are attachments. Did find a Java libr

Re: Class-level variables - a scoping issue

2010-10-10 Thread John Posner
On 10/10/2010 3:07 PM, John Nagle wrote: I understand how the current semantics fall out of the obvious implementation. But I don't see those semantics as particularly desirable. The obvious semantics for globals are similar, but that case is so error-prone that it was made an error. Nicely st

Re: if the else short form

2010-10-10 Thread Hrvoje Niksic
Antoon Pardon writes: > Personaly I don't see a reason to declare in advance that someone > who wants to treat "True" differently from non-zero numbers or > non-empty sequences and does so by a test like: > > if var == Trueorif var is True > > to have written incorrect code. I wouldn't

Re: Light on Dark screen for Spe or Pyscripter

2010-10-10 Thread PyScripter
On Oct 10, 7:48 am, flebber wrote: > On Oct 9, 3:54 pm, flebber wrote: > > > I was hoping someone knew how to setup pyscripter or Spe ide's with > > light on dark windows. I start to have trouble reading the nomal dark > > on light screens after any lengthy period. > > > I have seen several scree

Re: Class-level variables - a scoping issue

2010-10-10 Thread Steven D'Aprano
On Sun, 10 Oct 2010 18:14:33 -0400, John Posner wrote: > Class attributes are often used as "class constants", so how about > naming them with UPPERCASE names, like other constants? When you choose > to override one of these constants, like this: > > self.EGGS = 4 Er what? If self.EGGS is m

Re: if the else short form

2010-10-10 Thread NevilleDNZ
On Oct 10, 6:02 pm, Lawrence D'Oliveiro wrote: > As for DICT, I think table lookups were still a sufficiently novel concept > for people to disagree on how they should best be implemented. I then stumbled over this paper: Title: List processing in Algol 68 - V. J. Rayward-Smith International Jour

Re: Light on Dark screen for Spe or Pyscripter

2010-10-10 Thread PyScripter
On Oct 11, 1:51 am, PyScripter wrote: > In Pyscripter try View, Themes, EOS > Further dark theme athttp://www.mytreedb.com/downloads/m-subcat/a-skins.html > (you need to download the archive and place the skin file at %APPDATA%/ > pyscripter/skins) > > Dark hihglighters athttp://code.google.com/p/

Great career in Management

2010-10-10 Thread gaurav
Work from home genuine bulk data entry, home and government jobs sources. http://rojgars1.webs.com/gov.htm http://rojgars.webs.com/bankingjobs.htm Easy Management careers for you. Get start earning at your Management work. Visit: http://managementjobs.webs.com/pm.htm & http://jobscore.webs.co

Can't find pythonwin

2010-10-10 Thread HP Garcia
I am working on a class project that requires us to use python. I have never used python before so be gentle. My question is I have python 2.5 installed on my pc. The instructions as me to run pythonwin but I can't find pythonwin. What I did find is IDLE(GUI). Any suggestions where I can find i

Re: Can't find pythonwin

2010-10-10 Thread Mark Hammond
On 11/10/2010 11:24 AM, HP Garcia wrote: I am working on a class project that requires us to use python. I have never used python before so be gentle. My question is I have python 2.5 installed on my pc. The instructions as me to run pythonwin but I can't find pythonwin. What I did find is IDLE(G

Re: Can't find pythonwin

2010-10-10 Thread Jed Smith
On Sun, Oct 10, 2010 at 8:24 PM, HP Garcia wrote: > I am working on a class project that requires us to use python. I have never > used python before so be gentle. My question is I have python 2.5 installed > on my pc. The instructions as me to run pythonwin but I can't find > pythonwin. What I di

Re: Can't find pythonwin

2010-10-10 Thread MRAB
On 11/10/2010 01:24, HP Garcia wrote: I am working on a class project that requires us to use python. I have never used python before so be gentle. My question is I have python 2.5 installed on my pc. The instructions as me to run pythonwin but I can't find pythonwin. What I did find is IDLE(GUI)

Re: "Strong typing vs. strong testing"

2010-10-10 Thread Dave Angel
On 2:59 PM, Lie Ryan wrote: On 10/01/10 23:56, BartC wrote: "Pascal J. Bourguignon" wrote in message news:87zkuyjawh@kuiper.lan.informatimago.com... "BartC" writes: "Pascal J. Bourguignon" wrote in message When Intel will realize that 99% of its users are running VM Which one? Any

Re: Class-level variables - a scoping issue

2010-10-10 Thread Lawrence D'Oliveiro
In message <4cb23ac9.70...@optimum.net>, John Posner wrote: > Since it's unlikely that the language will change ... Python 4000, anybody? :) -- http://mail.python.org/mailman/listinfo/python-list

Re: if the else short form

2010-10-10 Thread Lawrence D'Oliveiro
In message , NevilleDNZ wrote: > Not having LIST and DICT as part of the base language would make sense > if user contributions were encouraged. Unfortunately, they neglected to include any kind of module/package system to make this kind of thing easy to do. But then again, the state of the ar

Re: Many newbie questions regarding python

2010-10-10 Thread Ethan Furman
Peter Pearson wrote: On Sat, 09 Oct 2010 19:30:16 -0700, Ethan Furman wrote: Steven D'Aprano wrote: [snip] But that doesn't mean that the list comp is the general purpose solution. Consider the obvious use of the idiom: def func(arg, count): # Initialise the list. L = [arg for i in

Re: Reading Outlook .msg file using Python

2010-10-10 Thread Lawrence D'Oliveiro
In message , John Henry wrote: > I have a need to read .msg files exported from Outlook. Try using EML format instead. That’s plain text. -- http://mail.python.org/mailman/listinfo/python-list

Re: Compiling xpython: No rule to make target `runathana.py', needed by `frozen/frozen.c'.

2010-10-10 Thread est
On Oct 10, 7:40 pm, est wrote: > I found an interesting project, it's a single 4.7 MB executable with > stdlib+PIL+pdf r/w+magpy+wxpython environment > > But when compiling following the instructions > > http://www.xpython.org/#compiling > > there is an error > > make: *** No rule to make target `

Re: Class-level variables - a scoping issue

2010-10-10 Thread Ethan Furman
John Nagle wrote: On 10/10/2010 12:53 AM, Lawrence D'Oliveiro wrote: In message<4cb14f8c$0$1627$742ec...@news.sonic.net>, John Nagle wrote: Within "fn1", the first reference to "self.classvar" references the class- level version of "classvar". The assignment overrides that and creates an o

Re: Reading Outlook .msg file using Python

2010-10-10 Thread John Henry
On Oct 10, 8:27 pm, Lawrence D'Oliveiro wrote: > In message > , John > > Henry wrote: > > I have a need to read .msg files exported from Outlook. > > Try using EML format instead. That’s plain text. Thanks for the reply. I would have to check to see if my client's Outlook can export in EML forma

Re: "Strong typing vs. strong testing"

2010-10-10 Thread Rob Warnock
Martin Gregorie wrote: +--- | Lie Ryan wrote: | > Virtual Machine in Hardware... isn't that a contradiction? | | Nope. Several mainframes did that. | | Two that I knew well were both British - the ICL 1900 and 2900. | The Burroughs x700 series also used hardware virtualisation. +---

os.stat and strange st_ctime

2010-10-10 Thread Mark Jones
I've read the part about these being variable Note The exact meaning and resolution of the st_atime, st_mtime, andst_ctime members depends on the operating system and the file system. For example, on Windows systems using the FAT or FAT32 file systems, st_mtimehas 2-second resolution, and st_ati

WE R HOT COUPLES AND SEARCHING FOR HOT MAN, WOMAN OR COUPLES FOR REAL FUN

2010-10-10 Thread COUPLES FOR FUN
WE R HOT COUPLES AND SEARCHING FOR HOT MAN, WOMAN OR COUPLES FOR REAL FUN JUST CLICK no promlem, just click http://adultfriendfinder.com/go/page/reg_form_video_04?lang=english&pid=g1264377-ppc http://adultfriendfinder.com/go/page/reg_form_video_04?lang=english&pid=g1264377-ppc http://ad

Re: Eclipse/PyDev - BOM Lexical Error

2010-10-10 Thread Ethan Furman
Lawrence D'Oliveiro wrote: In message , Ethan Furman wrote: Lawrence D'Oliveiro wrote: But they can only recognize it as a BOM if they assume UTF-8 encoding to begin with. Otherwise it could be interpreted as some other coding. Not so. The first three bytes are the flag. But this is

Re: open file on mac

2010-10-10 Thread tinauser
On Oct 10, 11:44 pm, Benjamin Kaplan wrote: > On Sun, Oct 10, 2010 at 5:29 PM, tinauser wrote: > > On Oct 10, 6:54 am, Lawrence D'Oliveiro > central.gen.new_zealand> wrote: > >> In message > >> , > > >> tinauser wrote: > >> > now,the file will be opened only if i give the full path, not if i > >

socket problem and html problem

2010-10-10 Thread bussiere bussiere
here is my code and two questions : why it says to me that i can't bind the socket ? normally it had closed it and kill it :/ and why it returns me plain text and not html ? Regards and a pack of m&m's to the one who will help me on this two questions. import socket import sys # Create a TCP/IP

Re: Class-level variables - a scoping issue

2010-10-10 Thread Gregory Ewing
Lawrence D'Oliveiro wrote: It seems to me the same principle, that of disallowing implicit overriding of a name from an outer scope with that from an inner one after the former has already been referenced, should be applied here as well. How would you intend to enforce such a restriction? --