Re: Reference or Value?

2009-02-22 Thread afriere
On Feb 23, 2:13 am, Torsten Mohr wrote: > Hi, > > how is the rule in Python, if i pass objects to a function, when is this > done by reference and when is it by value? > > def f1(a): >     a = 7 > > b = 3 > f1(b) > print b > => 3 > > Integers are obviously passed by value, lists and dicts by refer

Re: Running script in module initialization

2009-02-22 Thread Kom2
On 20 Ún, 16:27, Steve Holden wrote: > Kom2 wrote: > > Hello, > > I'm trying to convert my project from python 2.5 to python 3.0 and I > > have the following problem. My project is PYD library written in C++. > > So I have this PyInit_ModuleName function containing PyModule_Create > > call and thi

Re: different errors, return outside function and others

2009-02-22 Thread Chris Rebert
On Sun, Feb 22, 2009 at 10:51 PM, Tony wrote: > Hi, > I am trying to write a small program for my final for school, everytime i > run my program it gives me a return outside function error (after i fixed > all the indentation errors it throws at me), i am not very good at > programing with python

different errors, return outside function and others

2009-02-22 Thread Tony
Hi, I am trying to write a small program for my final for school, everytime i run my program it gives me a return outside function error (after i fixed all the indentation errors it throws at me), i am not very good at programing with python atm, so any help would be appreiciated. and if im missing

Re: How does one get from "ImportError: DLL load failed:..." to a culprit .dll and symbol?

2009-02-22 Thread John Machin
On Feb 23, 2:56 pm, Chris Cormie wrote: > Hi, > > I've been Googling around on a moderately common Windows Python problem: > a mismatch between the symbols a python extension thinks are available > and the contents of the associated DLL. Python users running into this > problem are greeted with: >

Re: Reference or Value?

2009-02-22 Thread Denis Kasak
On Mon, Feb 23, 2009 at 5:09 AM, Steven D'Aprano wrote: > On Sun, 22 Feb 2009 13:37:27 -0300, andrew cooke wrote: > >> as far as i understand things, the best model is: >> >> 1 - everything is an object >> 2 - everything is passed by reference > > Except that is wrong. If it were true, you could d

Re: How to open a remote file using python.

2009-02-22 Thread Chris Rebert
On Sun, Feb 22, 2009 at 9:02 PM, venutaurus...@gmail.com wrote: > On Feb 23, 9:25 am, MRAB wrote: >> venutaurus...@gmail.com wrote: >> > Hello all, >> >I am writing an application where I need to open a shared >> > file on a remote machine using python script. I tried using the >> > f

Re: How to open a remote file using python.

2009-02-22 Thread odeits
On Feb 22, 9:02 pm, "venutaurus...@gmail.com" wrote: > On Feb 23, 9:25 am, MRAB wrote: > > > > > venutaurus...@gmail.com wrote: > > > Hello all, > > >            I am writing an application where I need to open a shared > > > file on a remote machine using python script. I tried using the > > > f

Re: How to open a remote file using python.

2009-02-22 Thread venutaurus...@gmail.com
On Feb 23, 9:25 am, MRAB wrote: > venutaurus...@gmail.com wrote: > > Hello all, > >            I am writing an application where I need to open a shared > > file on a remote machine using python script. I tried using the > > following function: > > > f = urllib.open("\\remote_machine\\folder1\\fil

Re: How to inherit from two classes without metaclass clashing ?

2009-02-22 Thread Michele Simionato
On Sun, Feb 22, 2009 at 2:29 PM, Barak, Ron wrote: > Hi Michele, > > I tried understanding how to avoid the metaclasses clashing, and I did read > the link you referred to below, > as well as the relevant O'Reilly cookbook chapter (Recipe 20.17. Solving > Metaclass Conflicts), but seems I do not u

Re: How to open a remote file using python.

2009-02-22 Thread MRAB
venutaurus...@gmail.com wrote: Hello all, I am writing an application where I need to open a shared file on a remote machine using python script. I tried using the following function: f = urllib.open("\\remote_machine\\folder1\\file1.doc") I also tried using class urllib.Fa

Re: How to open a remote file using python.

2009-02-22 Thread Chris Rebert
On Sun, Feb 22, 2009 at 8:13 PM, venutaurus...@gmail.com wrote: > Hello all, > I am writing an application where I need to open a shared > file on a remote machine using python script. I tried using the > following function: > > f = urllib.open("\\remote_machine\\folder1\\file1.doc") > >

How to open a remote file using python.

2009-02-22 Thread venutaurus...@gmail.com
Hello all, I am writing an application where I need to open a shared file on a remote machine using python script. I tried using the following function: f = urllib.open("\\remote_machine\\folder1\\file1.doc") I also tried using class urllib.FancyURLopener(...) but d

Re: Reference or Value?

2009-02-22 Thread Steven D'Aprano
On Sun, 22 Feb 2009 13:37:27 -0300, andrew cooke wrote: > as far as i understand things, the best model is: > > 1 - everything is an object > 2 - everything is passed by reference Except that is wrong. If it were true, you could do this: def swap(x, y): y, x = x, y a = 1 b = 2 swap(a, b)

How does one get from "ImportError: DLL load failed:..." to a culprit .dll and symbol?

2009-02-22 Thread Chris Cormie
Hi, I've been Googling around on a moderately common Windows Python problem: a mismatch between the symbols a python extension thinks are available and the contents of the associated DLL. Python users running into this problem are greeted with: import "ImportError: DLL load failed: The spec

Re: pickle.load() on an dictionary of dictionaries doesn't load full data structure on first call

2009-02-22 Thread James Pearson
Ah, thank you, you explained that quite well and opened my eyes to some things I very much need to improve in my code. I'll keep those list-etiquette things in mind next time. On Sun, Feb 22, 2009 at 5:10 PM, Albert Hopkins wrote: > On Sun, 2009-02-22 at 16:15 -0800, James Pearson wrote: > > I'v

Re: Reference or Value?

2009-02-22 Thread Steven D'Aprano
On Sun, 22 Feb 2009 16:13:02 +0100, Torsten Mohr wrote: > Hi, > > how is the rule in Python, if i pass objects to a function, when is this > done by reference and when is it by value? Never, and never. > Integers are obviously passed by value, lists and dicts by reference. Your error is assum

Re: Python 3 and easygui problem

2009-02-22 Thread John Machin
On Feb 23, 11:55 am, Peter Anderson wrote: > John Machin said:* > > *"... the knowledge that you had attempted to contact Steve Ferg and > have not yet had a response was not available on c.l.py and in any case > is not a justification for incitement to hijack." > > John, I resent the implication

Re: choosing a default text-encoding in Python programs (was: To unicode or not to unicode)

2009-02-22 Thread John Machin
On Feb 23, 11:46 am, Joshua Judson Rosen wrote: > Denis Kasak writes: > > > > > Python "assumes" ASCII and if the decodes/encoded text doesn't > > > > fit that encoding it refuses to guess. > > > > Which is reasonable given that Python is programming language where it's > > > better to have more

Re: pickle.load() on an dictionary of dictionaries doesn't load full data structure on first call

2009-02-22 Thread Albert Hopkins
On Sun, 2009-02-22 at 16:15 -0800, James Pearson wrote: > I've been using irclib to write a simple irc bot, and I was running > into some difficulties with pickle. Upon some experimentation with > pdb, I found that pickle.load() doesn't load *all* of the data the > _first_ time it's called. > > F

Re: datetime.time and midnight

2009-02-22 Thread Joshua Judson Rosen
Ethan Furman writes: > > [...]partly because midnight is in fact a time of day, and not a lack of > a time of day, I do indeed expect it to be True. While it's not a lack of `time of day', it /is/ a lack of /elapsed/ time in the day ;) Just as if you were using a plain integer or float to count

Re: choosing a default text-encoding in Python programs

2009-02-22 Thread Ben Finney
Joshua Judson Rosen writes: > If you have to make an assumption, I'd really think that it'd be > better to use whatever the host OS's default is, if the host OS has > such a thing--using an assumption of ISO 8859-1 works only in select > regions on unix systems, and may fail even in those select

Re: Python 3 and easygui problem

2009-02-22 Thread Peter Anderson
John Machin said:* *"... the knowledge that you had attempted to contact Steve Ferg and have not yet had a response was not available on c.l.py and in any case is not a justification for incitement to hijack." John, I resent the implication that I am trying to hijack Steve's project. This wa

Re: Problem trying to install ReportLab with easy_install

2009-02-22 Thread Sebastian Bassi
On Sun, Feb 22, 2009 at 10:07 AM, Garrett Cooper wrote: >It's not building lib_renderPM_libart properly, or it's a typo > that supposed to be librenderPM_libart, or bad LDFLAGS... >More details need to be provided like an ls of your site-packages > directory and a partial ls of your local

choosing a default text-encoding in Python programs (was: To unicode or not to unicode)

2009-02-22 Thread Joshua Judson Rosen
Denis Kasak writes: > > > > Python "assumes" ASCII and if the decodes/encoded text doesn't > > > fit that encoding it refuses to guess. > > > > Which is reasonable given that Python is programming language where it's > > better to have more conservative assumption about encodings so errors > > can

pickle.load() on an dictionary of dictionaries doesn't load full data structure on first call

2009-02-22 Thread James Pearson
I've been using irclib to write a simple irc bot, and I was running into some difficulties with pickle. Upon some experimentation with pdb, I found that pickle.load() doesn't load *all* of the data the _first_ time it's called. For instance, I have this dictionary pickled: {'xiong_chiamiov': {'na

Re: Python 3 and easygui problem

2009-02-22 Thread John Machin
On Feb 23, 9:17 am, Peter Anderson wrote: > John Machin said: > > Has the OP tried to contact the author/maintainer of easygui [the > usually-recommended approach to problems with not-widely-used third- > party modules]? > > Don't you think the author/maintainer might like to be consulted > before

Re: Python 3 and easygui problem

2009-02-22 Thread Peter Anderson
Terry, I have not used PyPI before and feel a little uneasy about putting this modified script into such a public place. I have previously contacted Steve Ferg (the original developer of EasyGui) but have not had a reply. Clearly the bulk of the work is his still where as the modifications are

Re: Python 3 and easygui problem

2009-02-22 Thread Peter Anderson
John Machin said: Has the OP tried to contact the author/maintainer of easygui [the usually-recommended approach to problems with not-widely-used third- party modules]? Don't you think the author/maintainer might like to be consulted before you incite an OP to claim-jump his package name on PyPI

Wanted: Online Python Course for Credit

2009-02-22 Thread jsidell
I'm a high school game development teacher and I have recently discovered Python to be a great way to introduce computer programming. I intend to study Python on my own but I can get professional development credit at my job for taking a Python course. So I'm looking for an online class that I can

Re: Find the location of a loaded module

2009-02-22 Thread Pekka Klärck
2009/2/21 Gabriel Genellina : > > Use packages. Make act1 and act2 packages by creating __init__.py files. That's how I'd do it too. The code would be also more easy to understand and maintain: import act1 import act2 act1.story() act2.story() Alternative solution would be using reload functio

Re: Python 3 and easygui problem

2009-02-22 Thread John Machin
On Feb 23, 8:18 am, Terry Reedy wrote: > Peter Anderson wrote: > > Gabriel Genellina said: > > > That's very short-lived; cmp is gone in 3.0.1 (should not have existed > > in 3.0 in the first place). > > Try with: > > choices.sort(key=str.lower) > > > Gabriel, > > > That's worked fine - thank you.

Python on 64-bit Windows Vista

2009-02-22 Thread dineshv
Does anyone have experience of working with Python and very large text files (> 10Gb) on 64-bit Windows Vista? The problem is that my Python program - to perform simple data processing on the 10Gb file - never completes and ends with an error. When I reduce the size of the file (< 5Gb) the program

Re: Python 3 and easygui problem

2009-02-22 Thread Chris Rebert
On Sun, Feb 22, 2009 at 1:20 PM, Terry Reedy wrote: > Chris Rebert wrote: >> >> On Sat, Feb 21, 2009 at 8:46 PM, Peter Anderson >> wrote: >>> >>> I have just installed Python 3. I have been using Tkinter and easygui >>> (with >>> Python 2.5.4) for any GUI needs. I have just started to port some o

Re: Forwarding keyword arguments from one function to another

2009-02-22 Thread Terry Reedy
Ravi wrote: The following code didn't work: In the future, explain "didn't work". Wrong output? give actual (copy and paste) and expected. Error message? give traceback (copy and paste). -- http://mail.python.org/mailman/listinfo/python-list

Re: datetime.time and midnight

2009-02-22 Thread Ethan Furman
Tim Rowe wrote: 2009/2/22 Mark Dickinson : On Feb 21, 10:44 pm, Ethan Furman wrote: --> midnight = datetime.time(0,0,0) --> bool(midnight) False I'd call this a bug. No more so than zero being false. Zero exists too (check my bank balance). Once you've accepted non-Bool

Re: Problem with lists.

2009-02-22 Thread Matimus
On Feb 20, 8:12 am, "ssd" wrote: > Hi, > > In the following code, (in Python 2.5) > I was expecting to get in "b" variable the values  b: [[0, 0], [0, 1],[0, > 2], [0, 3],[0, 4], [1, 0],[1, 1], [1, 2], .] > But I get only the last value [4,4], b: b: [[4, 4], [4, 4], [4, 4], ... ] > > My code:

Re: Python 3 and easygui problem

2009-02-22 Thread Terry Reedy
Chris Rebert wrote: On Sat, Feb 21, 2009 at 8:46 PM, Peter Anderson wrote: I have just installed Python 3. I have been using Tkinter and easygui (with Python 2.5.4) for any GUI needs. I have just started to port some of my existing scripts to Python 3 and discovered problems with easygui. I wa

Re: Python 3 and easygui problem

2009-02-22 Thread Terry Reedy
Peter Anderson wrote: Gabriel Genellina said: That's very short-lived; cmp is gone in 3.0.1 (should not have existed in 3.0 in the first place). Try with: choices.sort(key=str.lower) Gabriel, That's worked fine - thank you. I think I now have a version of easygui.py that works with Python

Re: Problem with lists.

2009-02-22 Thread Chris Rebert
On Fri, Feb 20, 2009 at 8:12 AM, ssd wrote: > > Hi, > > In the following code, (in Python 2.5) > I was expecting to get in "b" variable the values b: [[0, 0], [0, 1],[0, > 2], [0, 3],[0, 4], [1, 0],[1, 1], [1, 2], .] > But I get only the last value [4,4], b: b: [[4, 4], [4, 4], [4, 4], ... ]

Re: datetime.time and midnight

2009-02-22 Thread Joshua Judson Rosen
"D'Arcy J.M. Cain" writes: > > On Sun, 22 Feb 2009 05:20:31 -0200 > "Gabriel Genellina" wrote: > > En Sat, 21 Feb 2009 21:55:23 -0200, MRAB > > escribió: > > > I think it's because midnight is to the time of day what zero is to > > > integers, or an empty string is to strings, or an empty cont

Re: Problem with lists.

2009-02-22 Thread des...@gmail.com
On Feb 20, 10:12 am, "ssd" wrote: > Hi, > > In the following code, (in Python 2.5) > I was expecting to get in "b" variable the values  b: [[0, 0], [0, 1],[0, > 2], [0, 3],[0, 4], [1, 0],[1, 1], [1, 2], .] > But I get only the last value [4,4], b: b: [[4, 4], [4, 4], [4, 4], ... ] > > My code:

Problem with lists.

2009-02-22 Thread ssd
Hi, In the following code, (in Python 2.5) I was expecting to get in "b" variable the values b: [[0, 0], [0, 1],[0, 2], [0, 3],[0, 4], [1, 0],[1, 1], [1, 2], .] But I get only the last value [4,4], b: b: [[4, 4], [4, 4], [4, 4], ... ] My code: a = ["",""] b = [] for i in range (0,5):

Re: Forwarding keyword arguments from one function to another

2009-02-22 Thread Albert Hopkins
On Sun, 2009-02-22 at 12:09 -0800, Ravi wrote: > I am sorry about the typo mistake, well the code snippets are as: > > # Non Working: > > class X(object): > def f(self, **kwds): > print kwds > try: > print kwds['i'] * 2 > except KeyError: > print "unknown keyword argument" > s

Re: Python dictionary size/entry limit?

2009-02-22 Thread Martin v. Löwis
intellimi...@gmail.com wrote: > Is there a limit to the size or number of entries that a single > dictionary can possess? On a 32-bit system, the dictionary can have up to 2**31 slots, meaning that the maximum number of keys is slightly smaller (about 2**30). As others have pointed out, Python's

Re: Windows Install Command Line

2009-02-22 Thread Sparky
On Feb 22, 11:15 am, "Martin v. Löwis" wrote: > Sparky wrote: > > For internal distribution purposes, I was wondering if there was an > > already established process/program for installing Python on Windows > > machines without using an msi file or compiling from source. Basically > > I need the s

Re: Is there a way to ask a class what its metaclasses are ?

2009-02-22 Thread Chris Rebert
On Sun, Feb 22, 2009 at 5:14 AM, Barak, Ron wrote: > Hi Chris, Is there a way to ask a class what its metaclasses are ? > (e.g., how to ask wx.Frame what it's metaclass is) Of course. A metaclass is the type of a class, so it's just type(wx.Frame). Cheers, Chris -- Follow the path of the Igua

Re: Forwarding keyword arguments from one function to another

2009-02-22 Thread Albert Hopkins
On Sun, 2009-02-22 at 11:44 -0800, Ravi wrote: > The following code didn't work: > > class X(object): > def f(self, **kwds): > print kwds > try: > print kwds['i'] * 2 > except KeyError: > print

Re: Forwarding keyword arguments from one function to another

2009-02-22 Thread Ravi
I am sorry about the typo mistake, well the code snippets are as: # Non Working: class X(object): def f(self, **kwds): print kwds try: print kwds['i'] * 2 except KeyError: print "unknown keyword argument" self.g("string", kwds) def g(self, s, **kwds): print s print

Re: Forwarding keyword arguments from one function to another

2009-02-22 Thread Tim Wintle
On Sun, 2009-02-22 at 11:44 -0800, Ravi wrote: > The following code didn't work: > > def g(self, s, kwds): > print s > print kwds This expects the function g to be called with the parameters "s" and "kwds" > def g(self, s, **kwds): >

Forwarding keyword arguments from one function to another

2009-02-22 Thread Ravi
The following code didn't work: class X(object): def f(self, **kwds): print kwds try: print kwds['i'] * 2 except KeyError: print "unknown keyword argument" self.g("string", **kwd

Re: Python dictionary size/entry limit?

2009-02-22 Thread Stefan Behnel
intellimi...@gmail.com wrote: > Ummm, I didn't know about the dbm databases. It seems there are many > different > modules for this kind of tasks: gdbm, berkeley db, cdb, etc. I'm > needing to implement > a constant hashtable with a large number of keys, but only a small > fraction of them > will b

Re: Reference or Value?

2009-02-22 Thread Andrew Koenig
"andrew cooke" wrote in message news:mailman.464.1235320654.11746.python-l...@python.org... > as far as i understand things, the best model is: > > 1 - everything is an object > 2 - everything is passed by reference > 3 - some objects are immutable > 4 - some (immutable?) objects are cached/reus

Re: "Byte" type?

2009-02-22 Thread Martin v. Löwis
>> Please don't call something dumb that you don't fully understand. It's >> offenses the people who have spent lots of time developing Python -- >> personal, unpaid and voluntary time! > > Crying out; "Please do not criticise me, I am doing it for free!" does > not justify delivering sub standar

Re: Windows Install Command Line

2009-02-22 Thread Martin v. Löwis
Sparky wrote: > For internal distribution purposes, I was wondering if there was an > already established process/program for installing Python on Windows > machines without using an msi file or compiling from source. Basically > I need the standard distribution installed by either a batch file or

Re: Unexpected long pyserial read delay on Windows

2009-02-22 Thread John Nagle
Grant Edwards wrote: On 2009-02-22, John Nagle wrote: I've been using PySerial on Windows (Win2000, amusingly) to drive a Baudot teletype at 45.45 baud. Input and output work, but there's a delay of about 1 second (!) on the input side between receiving a character and reporting it to the pro

Re: "metaclass conflict" error: where is noconflict ?

2009-02-22 Thread Hrvoje Niksic
"Barak, Ron" writes: > import wx > > class CopyAndPaste(object): > def __init__(self): > pass > > def set_copy_and_paste(self): > ... > > and CopyAndPaste is being called with: > > ... > class ListControlMeta(wx.Frame, CopyAndPaste): > pass You don't need ListControlMeta at all; just inher

Re: Python AppStore / Marketplace

2009-02-22 Thread Marcel Luethi
Hi Steve I really appreciate your feedback! Certainly I'm no expert "for the many differences in package formats and install requirements between the different platforms". But let me explain a bit more: I don't have the idea that the multi-platform client should handle all the different package f

Re: datetime.time and midnight

2009-02-22 Thread Tim Rowe
2009/2/22 Mark Dickinson : > On Feb 21, 10:44 pm, Ethan Furman wrote: > >> --> midnight = datetime.time(0,0,0) >> --> bool(midnight) >> False > > I'd call this a bug. No more so than zero being false. Zero exists too (check my bank balance). Once you've accepted non-Boolean types having Boolean v

Re: Unexpected long pyserial read delay on Windows

2009-02-22 Thread Grant Edwards
On 2009-02-22, John Nagle wrote: > I've been using PySerial on Windows (Win2000, amusingly) to > drive a Baudot teletype at 45.45 baud. Input and output work, > but there's a delay of about 1 second (!) on the input side > between receiving a character and reporting it to the program. The UART

Re: Musings: Using decorators to reduce duplicate exception handling

2009-02-22 Thread Diez B. Roggisch
J Kenneth King schrieb: I recently started a project called TracShell (http://code.google.com/p/tracshell) where I make heavy use of the xmlrpclib core module. When the number of RPC calls was small, wrapping each call in try/except was acceptable. However, this obviously will duplicate code all

Re: Reference or Value?

2009-02-22 Thread andrew cooke
as far as i understand things, the best model is: 1 - everything is an object 2 - everything is passed by reference 3 - some objects are immutable 4 - some (immutable?) objects are cached/reused by the system andrew Torsten Mohr wrote: > Hi, > > how is the rule in Python, if i pass objects to

Unexpected long pyserial read delay on Windows

2009-02-22 Thread John Nagle
I've been using PySerial on Windows (Win2000, amusingly) to drive a Baudot teletype at 45.45 baud. Input and output work, but there's a delay of about 1 second (!) on the input side between receiving a character and reporting it to the program. I'm using the latest "supports 1.5 stop bits"

Re: Reference or Value?

2009-02-22 Thread MRAB
Torsten Mohr wrote: Hi, how is the rule in Python, if i pass objects to a function, when is this done by reference and when is it by value? def f1(a): a = 7 b = 3 f1(b) print b => 3 Integers are obviously passed by value, lists and dicts by reference. Is there a general rule? Some commo

Re: datetime.time and midnight

2009-02-22 Thread MRAB
Gabriel Genellina wrote: En Sat, 21 Feb 2009 21:55:23 -0200, MRAB escribió: Ethan Furman wrote: Greetings, List! I was curious if anyone knew the rationale behind making midnight False? --> import datetime --> midnight = datetime.time(0,0,0) --> bool(midnight) False To my way of thinkin

Re: Reference or Value?

2009-02-22 Thread Duncan Booth
Torsten Mohr wrote: > how is the rule in Python, if i pass objects to a function, when is this > done by reference and when is it by value? > > def f1(a): > a = 7 > > b = 3 > f1(b) > print b >=> 3 > > Integers are obviously passed by value, lists and dicts by reference. > > Is there a gen

Windows Install Command Line

2009-02-22 Thread Sparky
For internal distribution purposes, I was wondering if there was an already established process/program for installing Python on Windows machines without using an msi file or compiling from source. Basically I need the standard distribution installed by either a batch file or python script through

Re: Scanning a file character by character

2009-02-22 Thread rzed
Spacebar265 wrote in news:c86cd530-cee5-4de6-8e19-304c664c9...@c12g2000yqj.googlegroups.c om: > On Feb 11, 1:06 am, Duncan Booth > wrote: [...] >> >>> re.split("(\w+)", "The quick brown fox jumps, and falls >> >>> over.")[1::2] >> >> ['The', 'quick', 'brown', 'fox', 'jumps', 'and', 'falls', >

Re: Reference or Value?

2009-02-22 Thread Christian Heimes
Torsten Mohr schrieb: > Hi, > > how is the rule in Python, if i pass objects to a function, when is this > done by reference and when is it by value? > > def f1(a): > a = 7 > > b = 3 > f1(b) > print b > => 3 > > Integers are obviously passed by value, lists and dicts by reference. > > Is t

Reference or Value?

2009-02-22 Thread Torsten Mohr
Hi, how is the rule in Python, if i pass objects to a function, when is this done by reference and when is it by value? def f1(a): a = 7 b = 3 f1(b) print b => 3 Integers are obviously passed by value, lists and dicts by reference. Is there a general rule? Some common formulation? Thank

Re: "Byte" type?

2009-02-22 Thread Christian Heimes
Hendrik van Rooyen wrote: > "Christian Heimes" wrote: > >> John Nagle wrote >>>If "bytes", a new keyword, works differently in 2.6 and 3.0, that was >>> really >>> dumb. There's no old code using "bytes". So converting code to 2.6 means >>> it has to be converted AGAIN for 3.0. That's a go

Re: can error messages be improved or can they be overridden ?

2009-02-22 Thread Steve Holden
Barak, Ron wrote: > Hi Stef, > > You can do something like (not tested): > > try: > self.Brick.Par [ self.EP[2] ]['FileName'] = filename > except IndexError,e: > msg = "%s: '%s %s %s %d" % > (e.strerror,e.filename,self.EP,self.EP[2],len(self.Brick.Par)) > p

Re: datetime.time and midnight

2009-02-22 Thread D'Arcy J.M. Cain
On Sun, 22 Feb 2009 05:20:31 -0200 "Gabriel Genellina" wrote: > En Sat, 21 Feb 2009 21:55:23 -0200, MRAB > escribió: > > I think it's because midnight is to the time of day what zero is to > > integers, or an empty string is to strings, or an empty container ... > > So chr(0) should be False t

RE: can error messages be improved or can they be overridden ?

2009-02-22 Thread Barak, Ron
Hi Stef, You can do something like (not tested): try: self.Brick.Par [ self.EP[2] ]['FileName'] = filename except IndexError,e: msg = "%s: '%s %s %s %d" % (e.strerror,e.filename,self.EP,self.EP[2],len(self.Brick.Par)) print msg Bye, Ron.

Re: To unicode or not to unicode

2009-02-22 Thread Denis Kasak
On Sun, Feb 22, 2009 at 1:39 AM, Ross Ridge wrote: > Ross Ridge (Sat, 21 Feb 2009 18:06:35 -0500) >> I understand what Unicode and MIME are for and why they exist. Neither >> their merits nor your insults change the fact that the only current >> standard governing the content of Usenet posts doesn

Re: Python AppStore / Marketplace

2009-02-22 Thread Steve Holden
Marcel Luethi wrote: > Dear Community > > Now I'm standing here, having this great idea for a brand new rocking > app... > But where do I start? I want it to be multi-platform (Linux, Mac OS X, > Windows). It should be easy to install and upgrade. It should be self- > contained, independent of an

Re: datetime.time and midnight

2009-02-22 Thread Steve Holden
Ethan Furman wrote: > Greetings, List! > > I was curious if anyone knew the rationale behind making midnight False? > > --> import datetime > --> midnight = datetime.time(0,0,0) > --> bool(midnight) > False > > To my way of thinking, midnight does actually exist so it should be > true. If datet

Re: Find the location of a loaded module

2009-02-22 Thread Steve Holden
Gabriel Genellina wrote: > En Sat, 21 Feb 2009 14:51:40 -0200, escribió: > >> "Gabriel Genellina" wrote: >>> En Fri, 20 Feb 2009 20:44:21 -0200, Aaron Scott >>> escribi=F3: >>> >>> > So, the problem lies with how Python cached the modules in memory. >>> > Yes, the modules were in two different

can error messages be improved or can they be overridden ?

2009-02-22 Thread Stef Mientki
hello, I often get an error message like this self.Brick.Par [ self.EP[2] ]['FileName'] = filename IndexError: list index out of range Now it would be very welcome, if the error message specified which index is out of range, in this case e.g., - specifying the length of self.EP - specifying

RE: "metaclass conflict" error: where is noconflict ?

2009-02-22 Thread Barak, Ron
Hi Hrvoje, I tried also as follows: #!/usr/bin/env python import wx class CopyAndPaste(object): def __init__(self): pass def set_copy_and_paste(self): ... and CopyAndPaste is being called with: ... class ListControlMeta(wx.Frame, CopyAndPaste): pass class ListContro

How to inherit from two classes without metaclass clashing ?

2009-02-22 Thread Barak, Ron
Hi Michele, I tried understanding how to avoid the metaclasses clashing, and I did read the link you referred to below, as well as the relevant O'Reilly cookbook chapter (Recipe 20.17. Solving Metaclass Conflicts), but seems I do not understand the correct syntax to use, as I either get $ pyth

Re: To unicode or not to unicode

2009-02-22 Thread dineshv
re: "You should never have to rely on the default encoding. You should explicitly decode and encode data." What is the best practice for 1) doing this in Python and 2) for unicode support ? I want to standardize on unicode and want to put into place best Python practice so that we don't have to w

Is there a way to ask a class what its metaclasses are ?

2009-02-22 Thread Barak, Ron
Hi Chris, > -Original Message- > From: ch...@rebertia.com [mailto:ch...@rebertia.com] On > Behalf Of Chris Rebert > Sent: Sunday, February 22, 2009 13:57 > To: Barak, Ron > Cc: python-list@python.org > Subject: Re: "metaclass conflict" error: where is noconflict ? > > On Sun, Feb 22, 2009

Re: Problem trying to install ReportLab with easy_install

2009-02-22 Thread Garrett Cooper
On Sat, Feb 21, 2009 at 10:06 PM, Sebastian Bassi wrote: > I don't understand what is wrong when I try to install ReportLab. This > is under Ubuntu and all build packages are installed. > Here is what I get when trying to install it: (I could install it with > apt-get, but I am testing virtualenv

Re: python contextmanagers and ruby blocks

2009-02-22 Thread Francesco Bochicchio
On Sat, 21 Feb 2009 09:42:02 -0800, Aahz wrote: > In article , > Alia K wrote: >> >>Nevertheless, I remain curious about whether once can use the >>contextmanager in python to achieve the full power of ruby's blocks... > > Short answer: no > > Longer answer: the way in Python to achieve the fu

Re: "metaclass conflict" error: where is noconflict ?

2009-02-22 Thread Hrvoje Niksic
"Barak, Ron" writes: > class CopyAndPaste(): CopyAndPaste is an old-style class. Make it a new-style class, and you'll probably be able to inherit from it and wx.Frame without explicitly creating a new metaclass. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3 and easygui problem

2009-02-22 Thread Peter Anderson
Gabriel Genellina said: That's very short-lived; cmp is gone in 3.0.1 (should not have existed in 3.0 in the first place). Try with: choices.sort(key=str.lower) Gabriel, That's worked fine - thank you. I think I now have a version of easygui.py that works with Python 3, probably needs a bit

Re: "metaclass conflict" error: where is noconflict ?

2009-02-22 Thread Chris Rebert
On Sun, Feb 22, 2009 at 3:31 AM, Barak, Ron wrote: >> > Applying your suggestion: >> > >> > class ListControlMeta(type(wx.Frame), type(CopyAndPaste)): >> > pass >> > >> > class ListControl(wx.Frame, CopyAndPaste): >> > def __init__(self, parent, id, title, list, max_list_width, >> > log_s

RE: "metaclass conflict" error: where is noconflict ?

2009-02-22 Thread Barak, Ron
Hi Chris, > -Original Message- > From: Chris Rebert [mailto:c...@rebertia.com] > Sent: Sunday, February 22, 2009 11:48 > To: Barak, Ron > Cc: python-list@python.org; wxpython-us...@lists.wxwidgets.org > Subject: Re: "metaclass conflict" error: where is noconflict ? > > On Sun, Feb 22, 2

Python AppStore / Marketplace

2009-02-22 Thread Marcel Luethi
Dear Community Now I'm standing here, having this great idea for a brand new rocking app... But where do I start? I want it to be multi-platform (Linux, Mac OS X, Windows). It should be easy to install and upgrade. It should be self- contained, independent of an already installed Python. And of co

Re: "Byte" type?

2009-02-22 Thread Matthew Woodcraft
"Hendrik van Rooyen" writes: > "Christian Heimes" wrote: > on the surface JN has a point - If you have to go through two > conversions, then 2.6 does not achieve what it appears to set out to > do. So the issue is simple: > - do you have to convert twice? > - If yes - why? - as he says - there

Python AppStore / Marketplace

2009-02-22 Thread Marcel Luethi
Dear Community Now I'm standing here, having this great idea for a brand new rocking app... But where do I start? I want it to be multi-platform (Linux, Mac OS X, Windows). It should be easy to install and upgrade. It should be self-contained, independent of an already installed Python. And of cou

ftpslib caveat solution?

2009-02-22 Thread jeff
The only python library that I am aware of that supports ftp + TLS is ftpslib, which is also included with M2Crypto. However, as stated in the README, there is one major caveat. Quote: """ The end-of-file marker for binary data transfers is sent by closing the connection. Many FTP servers close

Re: datetime.time and midnight

2009-02-22 Thread Mark Dickinson
On Feb 22, 9:18 am, Mark Dickinson wrote: > On Feb 21, 10:44 pm, Ethan Furman wrote: > > > --> midnight = datetime.time(0,0,0) > > --> bool(midnight) > > False > > I'd call this a bug. ...although looking at the source (see the function time_nonzero in Modules/datetimemodule.c), this behaviour i

Re: "metaclass conflict" error: where is noconflict ?

2009-02-22 Thread Chris Rebert
On Sun, Feb 22, 2009 at 1:37 AM, Barak, Ron wrote: > Hi Chris, > >> -Original Message- >> From: ch...@rebertia.com [ > mailto:ch...@rebertia.com] On >> Behalf Of Chris Rebert >> Sent: Thursday, February 19, 2009 22:58 >> To: Barak, Ron >> Cc: python-list@python.org; wxpython-us...@lists.wx

RE: "metaclass conflict" error: where is noconflict ?

2009-02-22 Thread Barak, Ron
Hi Chris, > -Original Message- > From: ch...@rebertia.com [mailto:ch...@rebertia.com] On > Behalf Of Chris Rebert > Sent: Thursday, February 19, 2009 22:58 > To: Barak, Ron > Cc: python-list@python.org; wxpython-us...@lists.wxwidgets.org > Subject: Re: "metaclass conflict" error: where is

Re: datetime.time and midnight

2009-02-22 Thread Mark Dickinson
On Feb 21, 10:44 pm, Ethan Furman wrote: > --> midnight = datetime.time(0,0,0) > --> bool(midnight) > False I'd call this a bug. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: "Byte" type?

2009-02-22 Thread Hendrik van Rooyen
"Christian Heimes" wrote: > John Nagle wrote > >If "bytes", a new keyword, works differently in 2.6 and 3.0, that was > > really > > dumb. There's no old code using "bytes". So converting code to 2.6 means > > it has to be converted AGAIN for 3.0. That's a good reason to ignore > > 2.6 as

Re: `high overhead of multiple Python processes' (was: Willmultithreading make python less popular?)

2009-02-22 Thread Hendrik van Rooyen
"Paul Rubin" wrote: > The cost of messing with the multiprocessing module instead of having > threads work properly, and the overhead of serializing Python data > structures to send to another process by IPC, instead of using the > same object in two threads. Also,

Re: reading file to list

2009-02-22 Thread William James
André Thieme wrote: > (map #(map (fn [s] (Integer/parseInt s)) (.split % "\\s")) (line-seq > (reader "blob.txt"))) An error results: java.lang.Exception: Unable to resolve symbol: reader in this context This works: (map #(map (fn [s] (Integer/parseInt s)) (.split % "\\s")) (.split (slurp "ju

  1   2   >