New Book: Programming in Python 3

2008-12-04 Thread Mark Summerfield
Hi, Now that Python 3 final has been released I thought it would be a good time to mention that there's a new book to go with it: Programming in Python 3: A Complete Introduction to the Python Language ISBN 0137129297 http://www.qtrac.eu/py3book.html I've been working on this for more than a

RELEASED Python 2.6.1

2008-12-04 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hot on the heals of Python 3.0 comes the Python 2.6.1 bug-fix release. This is the latest production-ready version in the Python 2.6 family. Dozens of issues have fixed since Python 2.6 final was released in October. Please see the NEWS file

Re: python an sqlite objects

2008-12-04 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : Bruno Most of the time, you want to serialize the instance's __dict__. Does it recreate an instance at the other end or just a dict? If you serialize a dict, you'll obviously get a dict back. Note that the point of json is *not* to replace pickle. json is a

Re: How can I do this (from Perl) in Python? (closures)

2008-12-04 Thread Duncan Booth
[EMAIL PROTECTED] wrote: I just came across http://www.perl.com/pub/a/2002/05/29/closure.html and wanted to try the canonical example of closures in Python. I came up with the following, but it fails: ### #!/usr/bin/env python def make_counter(start_num): start

Re: How can I do this (from Perl) in Python? (closures)

2008-12-04 Thread James Stroud
[EMAIL PROTECTED] wrote: from_ten = make_counter(10) from_three = make_counter(3) print from_ten() # 10 print from_ten() # 11 print from_three() # 3 print from_ten() # 12 print from_three() # 4 The error message is: UnboundLocalError: local

Re: Don't you just love writing this sort of thing :)

2008-12-04 Thread Duncan Booth
Lawrence D'Oliveiro [EMAIL PROTECTED] wrote: for \ Entry \ in \ sorted \ ( f for f in os.listdir(PatchesDir) if PatchDatePat.search(f) != None ) \ : Patch = (open,

Re: Multiple equates

2008-12-04 Thread Jeremiah Dodds
On Thu, Dec 4, 2008 at 1:19 PM, Hendrik van Rooyen [EMAIL PROTECTED]wrote: Cameron Laird [EMAIL PROTECTED] wrote: There's a realm within Pythonia that favors lambdalessness. And who, may I ask, Is the King of this realm? - Hendrik --

Pythonic design patterns

2008-12-04 Thread Slaunger
Hi comp.lang.python I am this novice Python programmer, who is not educated as a computer scientist (I am a physicist), and who (regrettably) has never read the GOF on design patterns. I find myself spending a lot of time in Python making some designs, to solve some task, which is the end turn

Re: performance question: dictionary or list, float or string?

2008-12-04 Thread bkamrani
Thanks for your questions. Here come some answer below. On Dec 2, 2:50 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Tue, 02 Dec 2008 03:41:29 -0800,bkamraniwrote: Hi Python gurus! I'm going to read in an Ascii file containing float numbers in rows and columns (say 10

Re: Pythonic design patterns

2008-12-04 Thread Michele Simionato
On Dec 4, 10:09 am, Slaunger [EMAIL PROTECTED] wrote: Hi comp.lang.python I am this novice Python programmer, who is not educated as a computer scientist (I am a physicist), and who (regrettably) has never read the GOF on design patterns. I find myself spending a lot of time in Python

TypeError: not enough arguments

2008-12-04 Thread navneet khanna
Hello Everbody I have imported a class from vb.net dll in Python. I am able to import all the functions, but its showing such error when trying to access it. g() is a simple function in dll which takes no argument but returns a string. print Class1.g() Traceback (most recent call last): File

Re: Running a Python script from crontab

2008-12-04 Thread Astley Le Jasper
On Dec 4, 12:34 am, Lawrence D'Oliveiro [EMAIL PROTECTED] central.gen.new_zealand wrote: In message [EMAIL PROTECTED], Philip Semanchuk wrote: In my experience, the environment in which a cron job runs is different from the environment in which some command line scripts run... Which is

Re: as keyword woes

2008-12-04 Thread Warren DeLano
I don't know how you infer any of those from what I said, nor from the process of introducing features in Python. None of what you say there rings at all true with anything I've experienced in Python's core or the attitudes surrounding development if the language; indeed, quite the

Re: performance question: dictionary or list, float or string?

2008-12-04 Thread bkamrani
Matt, really thanks for your comments! Even thogh it was not a direct answer to my questions, I like your coding style very much and I think you have a good point. About the number of line in the file, because I get that info from another in advance. Therefore I thought it could be hard coded.

Re: Python advocacy ... HELP!

2008-12-04 Thread Jeremiah Dodds
On Thu, Dec 4, 2008 at 1:52 AM, Michael_D_G [EMAIL PROTECTED] wrote: I am a faculty member of a cs department. We currently teach C++ in our intro to programming course. I am teaching this class and it seems to me that we would be much better served teaching python in the intro course, C++

Re: Don't you just love writing this sort of thing :)

2008-12-04 Thread Cong Ma
Lawrence D'Oliveiro wrote: for \ Entry \ in \ sorted \ ( f for f in os.listdir(PatchesDir) if PatchDatePat.search(f) != None ) \ : Patch = (open, gzip.GzipFile)[Entry.endswith(.gz)](os.path.join(PatchesDir, Entry), r) ...

Re: as keyword woes

2008-12-04 Thread James Stroud
alex23 wrote: On Dec 4, 3:42 pm, Warren DeLano [EMAIL PROTECTED] wrote: So you prefer broken code to broken rules, eh? Your customers must love that! This is exactly the kind of ivory-tower thinking I feared might be behind the decision (form over function, damn the users to hell, etc.)

Re: Pythonic design patterns

2008-12-04 Thread James Stroud
Slaunger wrote: Hi comp.lang.python I was therefore wondering if you could recommend a book or a resource concerning design patterns with special focus on the possibilities in Python? In that manner I may be able to both learn programming more pythonic AND learn the design patterns. --

Re: Mathematica 7 compares to other languages

2008-12-04 Thread Andreas Waldenburger
On Wed, 03 Dec 2008 20:38:44 -0500 Lew [EMAIL PROTECTED] wrote: Xah Lee wrote: enough babble ... Good point. Plonk. Guun dun! I vaguely remember you plonking the guy before. Did you unplonk him in the meantime? Or was that just a figure of speech? teasingly yours, /W -- My real

Re: performance question: dictionary or list, float or string?

2008-12-04 Thread bkamrani
About the piece of code you posted, there is something I don't understand. for i, line in data: where data is a file object. Is it legal to write that? I believe it results in too many values to unpack or do I miss something? /Ben On Dec 4, 10:26 am, [EMAIL PROTECTED] wrote: Matt,

Re: as keyword woes

2008-12-04 Thread M.-A. Lemburg
On 2008-12-04 06:42, Warren DeLano wrote: Why can't the parser distinguish between a standalone as keyword and .as used as an object/attribute reference? Because that would require special-casing some names as being forbidden in syntax where other names are allowed. Special cases in

Re: Pythonic design patterns

2008-12-04 Thread Michele Simionato
On Dec 4, 11:00 am, James Stroud [EMAIL PROTECTED] wrote: The cookbook has a lot of complex examples and may not provide you with the insight you are looking for. Only a small fraction of the recipes do this. Whereas I agree that the online cookbook has too many complex recipes, as far I can

Re: How can I do this (from Perl) in Python? (closures)

2008-12-04 Thread Nick Craig-Wood
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I just came across http://www.perl.com/pub/a/2002/05/29/closure.html and wanted to try the canonical example of closures in Python. I came up with the following, but it fails: def make_counter(start_num): start = start_num def

receive data through a python program from javascript

2008-12-04 Thread gaurav kashyap
Hi all, I have a javascript.I want to send some data from this javascript to a python program that is on zope on my local system... What can be the python program -- http://mail.python.org/mailman/listinfo/python-list

Re: Overriding a method at the instance level on a subclass of a builtin type

2008-12-04 Thread Aaron Brady
On Dec 3, 1:25 pm, Jason Scheirer [EMAIL PROTECTED] wrote: On Dec 2, 6:13 pm, Aaron Brady [EMAIL PROTECTED] wrote: class A: ...     def methA( self ): ...             print 'methA' ...             self.meth= self.methB ...     meth= methA ...     def methB( self ): ...            

Re: as keyword woes

2008-12-04 Thread James Mills
One of the things I'd like to point out here is what we've been learning in new job during Induction Training... That is, it's part of the coding standard and design standards to name variables sensibly. For instance, naming a variable db when it's really a database object is a no no. Instead

Re: as keyword woes

2008-12-04 Thread Aaron Brady
On Dec 4, 4:43 am, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Thu, 4 Dec 2008 01:28:56 -0800, Warren DeLano [EMAIL PROTECTED] declaimed the following in comp.lang.python: In addition, note that my choice of a concise method identifier affects only my users.  Python's introduction of a

Re: as keyword woes

2008-12-04 Thread Aaron Brady
On Dec 4, 3:28 am, Warren DeLano [EMAIL PROTECTED] wrote: Have you even looked at multiprocessing? Multiprocessing solves some problems, but it is unsuitable for high-frequency handoffs of large (in memory) objects between many independent threads/processes -- the HPC object/data flow

Re: as keyword woes

2008-12-04 Thread James Mills
On Thu, Dec 4, 2008 at 9:04 PM, Aaron Brady [EMAIL PROTECTED] wrote: [... snip ...] Does the OP hold the following should be legal? if if or or: and( for ) if not: while( def ) I most certainly hope not! :) --JamesMills -- -- -- Problems are solved by method --

Re: Don't you just love writing this sort of thing :)

2008-12-04 Thread Harold Fellermann
On Dec 4, 10:39 am, Cong Ma [EMAIL PROTECTED] wrote: Lawrence D'Oliveiro wrote: for \         Entry \     in \         sorted \           (             f for f in os.listdir(PatchesDir) if PatchDatePat.search(f) != None           ) \ :     Patch = (open,

Re: as keyword woes

2008-12-04 Thread Eduardo O. Padoan
On Thu, Dec 4, 2008 at 7:44 AM, James Stroud [EMAIL PROTECTED] wrote: alex23 wrote: On Dec 4, 3:42 pm, Warren DeLano [EMAIL PROTECTED] wrote: So you prefer broken code to broken rules, eh? Your customers must love that! This is exactly the kind of ivory-tower thinking I feared might be

hi

2008-12-04 Thread anum
www.digitalarena.tk -- http://mail.python.org/mailman/listinfo/python-list

Microsoft MVP Donald Belcham to Speak on Visual Studio, C# vNext, Aspect Oriented Programming, Live Mesh

2008-12-04 Thread Shaguf
Microsoft MVP Donald Belcham to Speak on Visual Studio, C# vNext, Aspect Oriented Programming, Live Mesh Bangalore, December 1, 2008: When writing Microsoft technology-related applications to have strong separations of concerns you inevitably run across some items that, while appearing as

Re: python an sqlite objects

2008-12-04 Thread skip
Bruno If you serialize a dict, you'll obviously get a dict back. Note Bruno that the point of json is *not* to replace pickle. json is a Bruno *data* serialization format meant to represent basic types Bruno (dicts, lists, strings and numbers) in human readable and Bruno

Re: as keyword woes

2008-12-04 Thread alex23
On Dec 4, 7:28 pm, Warren DeLano [EMAIL PROTECTED] wrote: But who's leaving who exactly?  Surely a language as beautiful as Python will easily transcend the limitations of its flagship implementation (if or to the extent that such an implementation cannot keep pace with the times).  That's all

Re: performance question: dictionary or list, float or string?

2008-12-04 Thread alex23
On Dec 4, 8:12 pm, [EMAIL PROTECTED] wrote: About the piece of code you posted, there is something I don't understand.         for i, line in data: where data is a file object. Is it legal to write that? I believe it results in too many values to unpack or do I miss something? From the

Re: How can I do this (from Perl) in Python? (closures)

2008-12-04 Thread Nick Craig-Wood
Duncan Booth [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I just came across http://www.perl.com/pub/a/2002/05/29/closure.html and wanted to try the canonical example of closures in Python. I came up with the following, but it fails: def make_counter(start_num): start =

Re: RELEASED Python 3.0 final

2008-12-04 Thread Iain King
On Dec 4, 1:51 am, Barry Warsaw [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On behalf of the Python development team and the Python community, I am happy to announce the release of Python 3.0 final. Python 3.0 (a.k.a. Python 3000 or Py3k) represents a major

Re: performance question: dictionary or list, float or string?

2008-12-04 Thread bkamrani
On Dec 4, 1:28 pm, alex23 [EMAIL PROTECTED] wrote: On Dec 4, 8:12 pm, [EMAIL PROTECTED] wrote: About the piece of code you posted, there is something I don't understand.         for i, line in data: where data is a file object. Is it legal to write that? I believe it results in too

Re: Pythonic design patterns

2008-12-04 Thread Gerhard Häring
Slaunger wrote: Hi comp.lang.python I am this novice Python programmer, who is not educated as a computer scientist (I am a physicist), and who (regrettably) has never read the GOF on design patterns. [...] I guess I could boost my productivity by learning these well-proven and

funny generator behaviour

2008-12-04 Thread Edvin Fuglebakk
I have written a generator that puzzles me: The generator is supposed to create ordered selections of a set of objects. repetition of objects is allowed and the selections should be of a size determined by a pramter to the generator. Now, if I try to accummulate the generated selections into

Re: RELEASED Python 3.0 final

2008-12-04 Thread Gerhard Häring
Iain King wrote: [...] Props. I just looked through the What's New and the change log, but I couldn't find the answer to something: has any change been made to how tabs and spaces are used as indentation? Can they still be (inadvisably) mixed in one file? Or, more extremely, has one or the

Re: python an sqlite objects

2008-12-04 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : Bruno If you serialize a dict, you'll obviously get a dict back. Note Bruno that the point of json is *not* to replace pickle. json is a Bruno *data* serialization format meant to represent basic types Bruno (dicts, lists, strings and numbers) in human

Re: RELEASED Python 3.0 final

2008-12-04 Thread Ionut Vancea
Hello, On Thu, Dec 4, 2008 at 1:51 AM, Barry Warsaw [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- We will continue to support and develop both Python 3 and Python 2 for the foreseeable future, and you can safely choose either version (or both) to use in your projects. Which

Re: receive data through a python program from javascript

2008-12-04 Thread Bruno Desthuilliers
gaurav kashyap a écrit : Hi all, I have a javascript.I want to send some data from this javascript to a python program that is on zope on my local system... google for Ajax. What can be the python program Anything on your zope instance that can handle an HTTP request. From the server side

sys.exit and '-i'

2008-12-04 Thread Ulrich Eckhardt
Hi! The unittest module will invoke sys.exit() after running the tests in order to signal success or failure. However, I sometimes don't want to exit the interpreter but instead e.g. inspect some state or just keep the window open. Normally, using '-i' as commandline argument works, but not in

Re: Multiple Versions of Python on Windows XP

2008-12-04 Thread Colin J. Williams
Glenn Linderman wrote: The equivalent of those commands is available via Windows Explorer, Tools / Folder Options, File Types, scroll-scroll-scroll your way to .py, Click Advanced, fiddle, copy paste apply, and other twaddle. Yes, but what's needed is a further level of indirection.

Re: time.sleep() and Tkinter after()?

2008-12-04 Thread Davy
On Dec 5, 3:05 am, Hendrik van Rooyen [EMAIL PROTECTED] wrote: Davy [EMAIL PROTECTED] wrote: I have used Tkinter after() to do loop update GUI in my previous post. And I tried to change after() to time.sleep(), but it seems doesn't work at all, the Queue send and receive data properly, but

Re: RELEASED Python 3.0 final

2008-12-04 Thread Istvan Albert
Congratulations on a fantastic work! -- http://mail.python.org/mailman/listinfo/python-list

Re: RELEASED Python 3.0 final

2008-12-04 Thread Roy H. Han
Hi, This is great, however, the link to the What's New page appears to be broken. http://docs.python.org/dev/3.0/whatsnew/3.1.html RHH On Thu, Dec 4, 2008 at 8:37 AM, Istvan Albert [EMAIL PROTECTED]wrote: Congratulations on a fantastic work! --

Re: RELEASED Python 3.0 final

2008-12-04 Thread Ionut Vancea
Hi On Thu, Dec 4, 2008 at 1:54 PM, Roy H. Han [EMAIL PROTECTED] wrote: Hi, This is great, however, the link to the What's New page appears to be broken. http://docs.python.org/dev/3.0/whatsnew/3.1.html replace 3.1 with 3.0 :), so it has to be:

operational amplifier

2008-12-04 Thread sona
An operational amplifier, often called an op-amp , is a DC-coupled high-gain electronic voltage amplifier with differential inputs and, usually, a single output. Typically the output of the op-amp is controlled either by negative feedback, which largely determines the magnitude of its output

Re: as keyword woes

2008-12-04 Thread Steven D'Aprano
On Wed, 03 Dec 2008 17:15:21 -0800, Matimus wrote: Couldn't we have continued along just fine using a smarter parser without elevating as to reserved status (and thus potentially breaking a 10+ years of existing code)? Nothing broke your code. It works just fine under the version it was

Re: Python advocacy ... HELP!

2008-12-04 Thread Sebastian Kaliszewski
Michael_D_G wrote: how do I refute the notion that Python is a marginal language because according to TOBIE it only less than a 6% market share. According to the same TIOBE, C++ has less than 11%. So it must be niche then as well :) -- Never underestimate the power of human stupidity -- L.

Re: Mathematica 7 compares to other languages

2008-12-04 Thread Lew
Andreas Waldenburger wrote: On Wed, 03 Dec 2008 20:38:44 -0500 Lew [EMAIL PROTECTED] wrote: Xah Lee wrote: enough babble ... Good point. Plonk. Guun dun! I vaguely remember you plonking the guy before. Did you unplonk him in the meantime? Or was that just a figure of speech? I have

Python Runtime Method Call Binding

2008-12-04 Thread k3xji
Hi, Is there a way to hook a function call in python? I know __getattr__ is doing for variables, it is giving us a chance before a field is initialized. Do we have same functionality for methods? Example: class Foo(object): def __call_method__(self, ...) # just pseudo print 'A

schizophrenic view of what is white space

2008-12-04 Thread Robin Becker
Is python of two minds about what is white space. I notice that split, strip seem to regard u'\xa0' (NO-BREAK SPACE) as white, but that code is not matched by the \s pattern. If this difference is intended can we rely on it continuing? u'a b'.split() [u'a', u'b'] u'a\xa0b'.split() [u'a',

Re: schizophrenic view of what is white space

2008-12-04 Thread Jean-Paul Calderone
On Thu, 04 Dec 2008 14:27:49 +, Robin Becker [EMAIL PROTECTED] wrote: Is python of two minds about what is white space. I notice that split, strip seem to regard u'\xa0' (NO-BREAK SPACE) as white, but that code is not matched by the \s pattern. If this difference is intended can we rely on

Re: as keyword woes

2008-12-04 Thread Steven D'Aprano
On Thu, 04 Dec 2008 20:53:38 +1000, James Mills wrote: Readability of your code becomes very important especially if you're working with many developers over time. 1. Use sensible meaningful names. 2. Don't use abbreviations. This is excellent advice, but remember, what is a sensible

Re: funny generator behaviour

2008-12-04 Thread pruebauno
On Dec 4, 8:00 am, Edvin Fuglebakk [EMAIL PROTECTED] wrote: I have written a generator that puzzles me: The generator is supposed to create ordered selections of a set of objects. repetition of objects is allowed and the selections should be of a size determined by a pramter to the generator.

Re: RELEASED Python 3.0 final

2008-12-04 Thread greg
On Dec 3, 7:51 pm, Barry Warsaw [EMAIL PROTECTED] wrote: On behalf of the Python development team and the Python community, I   am happy to announce the release of Python 3.0 final. Way to go and congratulations! --greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Runtime Method Call Binding

2008-12-04 Thread Bruno Desthuilliers
k3xji a écrit : Hi, Is there a way to hook a function call in python? I know __getattr__ is doing for variables, it is giving us a chance before a field is initialized. Note that since the introduction of the new-style object model - that is, in Python 2.2 -, computed attributes are better

Re: python to parse excel file csv format

2008-12-04 Thread Jay Jesus Amorin
This is what i have done and its giving me error. #!/usr/bin/env python import csv, sys, os filename = (sys.argv[1]) reader = csv.reader(open(filename, rb), delimiter=',', quoting=csv.QUOTE_NONE) try: #for row in reader: for fmodes,fname in reader: os.chmod(fname,fmodes) except

Re: Python advocacy ... HELP!

2008-12-04 Thread Cousin Stanley
I have looked at several interesting academic papers, on doing just this approach. I have also looked through the python web page to get examples of industry players using python in a non-trivial way. Yes, I know, Google, Microsoft, Sun, CIA website running on Plone, NOAA, NASA. If

m2crypto loading cert file from memory buffer

2008-12-04 Thread netpork
started using m2crypto recently, it works pretty well by now, i just have one question: ctx = SSL.Context('sslv3') ctx.load_cert_chain('client.pem') anyone knows a way of loading cert file from memory buffer and not from a file? i just do not want to have my cert file in the directory of my app

Re: Python Runtime Method Call Binding

2008-12-04 Thread Diez B. Roggisch
k3xji wrote: Hi, Is there a way to hook a function call in python? I know __getattr__ is doing for variables, it is giving us a chance before a field is initialized. Do we have same functionality for methods? Example: class Foo(object): def __call_method__(self, ...) # just

Re: Pythonic design patterns

2008-12-04 Thread Steven D'Aprano
On Thu, 04 Dec 2008 01:09:08 -0800, Slaunger wrote: I find myself spending a lot of time in Python making some designs, to solve some task, which is the end turn out to be closely related to well established design patterns / programming idioms, which other users in this forum has been kind

ANN: New Book: Programming in Python 3

2008-12-04 Thread Mark Summerfield
Now that Python 3 final has been released I thought it would be a good time to mention that there's a new book to go with it: Programming in Python 3: A Complete Introduction to the Python Language ISBN 0137129297 http://www.qtrac.eu/py3book.html I've been working on this for more than a year,

Re: funny generator behaviour

2008-12-04 Thread Aaron Brady
On Dec 4, 7:00 am, Edvin Fuglebakk [EMAIL PROTECTED] wrote: ... def orderedCombinations(pool, k):         Generator yielding ordered selections of size k with repetition from pool.         if k == 1:         for m in pool:             yield [m]     if k 1:         for m in pool:  

Re: python to parse excel file csv format

2008-12-04 Thread MRAB
Jay Jesus Amorin wrote: This is what i have done and its giving me error. #!/usr/bin/env python import csv, sys, os filename = (sys.argv[1]) reader = csv.reader(open(filename, rb), delimiter=',', quoting=csv.QUOTE_NONE) try: #for row in reader: for fmodes,fname in reader: fmodes

Re: RELEASED Python 3.0 final

2008-12-04 Thread J Kenneth King
Barry Warsaw [EMAIL PROTECTED] writes: On behalf of the Python development team and the Python community, I am happy to announce the release of Python 3.0 final. Yay! Thanks for all the great work. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonic design patterns

2008-12-04 Thread George Sakkis
On Dec 4, 10:02 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Thu, 04 Dec 2008 01:09:08 -0800, Slaunger wrote: I find myself spending a lot of time in Python making some designs, to solve some task, which is the end turn out to be closely related to well established

Re: Pythonic design patterns

2008-12-04 Thread Marco Mariani
George Sakkis wrote: This is all very good, but don't drink the design pattern Kool-Aid and start pushing design patterns everywhere. (Not everything needs to be a singleton. No, really.) Obligatory reading: http://www.mortendahl.dk/thoughts/blog/view.aspx?id=122 By the way, it's a fact

EBCDIC -- ASCII

2008-12-04 Thread martinjamesevans
I'm having a problem trying to use the codecs package to aid me in converting some bytes from EBCDIC into ASCII. I have some 8bit text that is in mixed format. I extract the bytes that are coded for EBCDIC and would like to display them correctly. The bytes that are EBCDIC could values 0-255, I'm

Re: Python Runtime Method Call Binding

2008-12-04 Thread Steven D'Aprano
On Thu, 04 Dec 2008 06:23:28 -0800, k3xji wrote: Hi, Is there a way to hook a function call in python? I know __getattr__ is doing for variables, What do you mean variables? Do you mean attributes? it is giving us a chance before a field is initialized. What field? Is a field the

simplest way to strip a comment from the end of a line?

2008-12-04 Thread Joe Strout
I have lines in a config file which can end with a comment (delimited by # as in Python), but which may also contain string literals (delimited by double quotes). A comment delimiter within a string literal doesn't count. Is there any easy way to strip off such a comment, or do I need to

Please fix your clock [was Re: Multiple equates]

2008-12-04 Thread Steven D'Aprano
Hendrik, I think your PC's clock is wrong. You seem to be posting from the future. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python advocacy ... HELP!

2008-12-04 Thread Tim Rowe
2008/12/4 Michael_D_G [EMAIL PROTECTED]: I am a faculty member of a cs department. We currently teach C++ in our intro to programming course. I am teaching this class and it seems to me that we would be much better served teaching python in the intro course, C++ for Data structures, as we do

UnicodeDecodeError quick question

2008-12-04 Thread patrick . waldo
Hi Everyone, I am using Python 2.4 and I am converting an excel spreadsheet to a pipe delimited text file and some of the cells contain utf-8 characters. I solved this problem in a very unintuitive way and I wanted to ask why. If I do, csvfile.write(cell.encode(utf-8)) I get a

Re: Please fix your clock [was Re: Multiple equates]

2008-12-04 Thread Andreas Waldenburger
On 04 Dec 2008 15:53:21 GMT Steven D'Aprano [EMAIL PROTECTED] wrote: Hendrik, I think your PC's clock is wrong. You seem to be posting from the future. So? Maybe he is. What's your problem? /W -- My real email address is constructed by swapping the domain with the recipient (local part).

Re: funny generator behaviour

2008-12-04 Thread pruebauno
On Dec 4, 8:00 am, Edvin Fuglebakk [EMAIL PROTECTED] wrote: I have written a generator that puzzles me: The generator is supposed to create ordered selections of a set of objects. repetition of objects is allowed and the selections should be of a size determined by a pramter to the generator.

Re: UnicodeDecodeError quick question

2008-12-04 Thread Tim Golden
[EMAIL PROTECTED] wrote: Hi Everyone, I am using Python 2.4 and I am converting an excel spreadsheet to a pipe delimited text file and some of the cells contain utf-8 characters. I solved this problem in a very unintuitive way and I wanted to ask why. If I do,

Python 3 read() function

2008-12-04 Thread Cro
Good day. I have installed Python 3 and i have a problem with the builtin read() function. [code] huge = open ( 'C:/HUGE_FILE.pcl', 'rb', 0 ) import io vContent = io.StringIO() vContent = huge.read() # This line takes hours to process !!! vSplitContent = vContent.split (

Re: simplest way to strip a comment from the end of a line?

2008-12-04 Thread eric
On Dec 4, 4:50 pm, Joe Strout [EMAIL PROTECTED] wrote: I have lines in a config file which can end with a comment (delimited   by # as in Python), but which may also contain string literals   (delimited by double quotes).  A comment delimiter within a string   literal doesn't count.  Is there

Re: funny generator behaviour

2008-12-04 Thread pruebauno
On Dec 4, 8:00 am, Edvin Fuglebakk [EMAIL PROTECTED] wrote: I have written a generator that puzzles me: The generator is supposed to create ordered selections of a set of objects. repetition of objects is allowed and the selections should be of a size determined by a pramter to the generator.

Re: RELEASED Python 3.0 final

2008-12-04 Thread bearophileHUGS
Gerhard Häring: As you have probably guessed: nothing changed here. Also see:http://www.python.org/dev/peps/pep-0666/ What? Do you mean it's possible to mix tabs and spaces still? Why? Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: time.sleep() and Tkinter after()?

2008-12-04 Thread Hendrik van Rooyen
Davy [EMAIL PROTECTED] wrote: Although I don't understand your explanation very well(I guess maybe .after() re-schedule is better than .sleep unresponsive in GUI application?)I will take it as a golden rule. I did not in fact try to explain it - I was trying to get you to think a bit wider, as

Re: as keyword woes

2008-12-04 Thread Chris Mellon
On Wed, Dec 3, 2008 at 11:42 PM, Warren DeLano [EMAIL PROTECTED] wrote: Why was it necessary to make as a reserved keyword? I can't answer for the Python developers as to why they *did* make it a reserved word. But I can offer what I believe is a good reason why it *should* be a reserved

Re: Please fix your clock [was Re: Multiple equates]

2008-12-04 Thread Hendrik van Rooyen
Steven D'Aprano stev..urce.com.au wrote: Hendrik, I think your PC's clock is wrong. You seem to be posting from the future. I always knew I was more advanced than other people... :-) Well spotted! Thanks - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: as keyword woes

2008-12-04 Thread Chris Mellon
On Thu, Dec 4, 2008 at 8:45 AM, Steven D'Aprano [EMAIL PROTECTED] wrote: On Thu, 04 Dec 2008 20:53:38 +1000, James Mills wrote: Readability of your code becomes very important especially if you're working with many developers over time. 1. Use sensible meaningful names. 2. Don't use

Re: as keyword woes

2008-12-04 Thread Matimus
On Dec 4, 6:08 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Wed, 03 Dec 2008 17:15:21 -0800, Matimus wrote: Couldn't we have continued along just fine using a smarter parser without elevating as to reserved status (and thus potentially breaking a 10+ years of existing

Re: Python advocacy ... HELP!

2008-12-04 Thread Hendrik van Rooyen
Tim Rowe [EMAIL PROTECTED] wrote: Try asking Are we teaching computer science, so that the students will be able to cope with whatever they meet once they graduate, or are we teaching computer programming, in a couple of specific languages, so that the students will be completely unprepared

Re: Python 3 read() function

2008-12-04 Thread Christian Heimes
Cro wrote: Good day. I have installed Python 3 and i have a problem with the builtin read() function. [code] huge = open ( 'C:/HUGE_FILE.pcl', 'rb', 0 ) import io vContent = io.StringIO() vContent = huge.read() # This line takes hours to process !!! vSplitContent = vContent.split (

Re: Please fix your clock [was Re: Multiple equates]

2008-12-04 Thread Hendrik van Rooyen
Andreas Waldenburger [EMAIL PROTECTED] On 04 Dec 2008 15:53:21 GMT Steven D'Aprano [EMAIL PROTECTED] wrote: Hendrik, I think your PC's clock is wrong. You seem to be posting from the future. So? Maybe he is. What's your problem? It was probably playing hob with his threading

Re: EBCDIC -- ASCII

2008-12-04 Thread Michael Ströder
[EMAIL PROTECTED] wrote: I'm having a problem trying to use the codecs package to aid me in converting some bytes from EBCDIC into ASCII. Which EBCDIC variant? sEBCDIC = unicode(sSource, 'cp500', 'ignore') Are you sure CP500 is the EBCDIC variant for the language you want?

Re: Python 3 read() function

2008-12-04 Thread Cro
Do you really mean io.StringIO? I guess you want io.BytesIO() .. Christian Mmm... i don't know. I also tried : [code] IDLE 3.0 import io vContent = io.BytesIO() huge = io.open(C:\HUGE_FILE.pcl,'r+b',0) vContent = huge.read() [/code] It still waits a lot... i don't have the patience to

Re: funny generator behaviour

2008-12-04 Thread Arnaud Delobelle
Edvin Fuglebakk [EMAIL PROTECTED] writes: I have written a generator that puzzles me: The generator is supposed to create ordered selections of a set of objects. repetition of objects is allowed and the selections should be of a size determined by a pramter to the generator. Now, if I try

Re: as keyword woes

2008-12-04 Thread John Nagle
Warren DeLano wrote: Why was it necessary to make as a reserved keyword? Embrace the pain. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: EBCDIC -- ASCII

2008-12-04 Thread Ulrich Eckhardt
[EMAIL PROTECTED] wrote: I've tried starting with something like this, but I assume it is expecting the source to be in unicode already? e.g. (pretend the second half are EBCDIC characters) sAll = This bit is ASCII, this bit ebcdic Why pretend? You can use this: abcde\x81\x82\x83\x84

Re: Python 3 read() function

2008-12-04 Thread Jerry Hill
On Thu, Dec 4, 2008 at 11:48 AM, Christian Heimes [EMAIL PROTECTED] wrote: Cro wrote: vContent = io.StringIO() vContent = huge.read() # This line takes hours to process !!! Do you really mean io.StringIO? I guess you want io.BytesIO() .. I don't think it matters. Here's a quick comparison

  1   2   3   4   >