bliptv.reader V1.0 released

2008-07-27 Thread Christian Scholz
I am pleased to announce Version 1.0 of bliptv.reader, a package for easy access to videos hosted on blip.tv. You can get it via PyPI: http://pypi.python.org/pypi/bliptv.reader What is bliptv.reader? -- bliptv.reader is a Python wrapper around the API of video hosting

Re: Attack a sacred Python Cow

2008-07-27 Thread Terry Reedy
Colin J. Williams wrote: Russ P. wrote: class MyClass: def func( , xxx, yyy): .xxx = xxx local = .yyy The use of nothing'.' has been suggested before and rejected. -- http://mail.python.org/mailman/listinfo/python-list

Re: Attack a sacred Python Cow

2008-07-27 Thread Terry Reedy
Torsten Bronger wrote: No more than Python 3.0 breaks. This proposal would break 3.0 code without sufficient reason. -- http://mail.python.org/mailman/listinfo/python-list

Re: Attack a sacred Python Cow

2008-07-27 Thread Russ P.
On Jul 26, 11:18 pm, Terry Reedy [EMAIL PROTECTED] wrote: Colin J. Williams wrote: Russ P. wrote: class MyClass: def func( , xxx, yyy): .xxx = xxx local = .yyy The use of nothing'.' has been suggested before and rejected. Where and why? --

Re: Attack a sacred Python Cow

2008-07-27 Thread Terry Reedy
Russ P. wrote: On Jul 26, 2:25 pm, Terry Reedy There is a lot of code you have not seen. Really. In informal code I use 's' and 'o' for 'self' and 'other'. I don't usually post such because it is not considered polite. So you have seen a biased sample of the universe. You take the name

Re: Insert string into string

2008-07-27 Thread Peter Otten
Mensanator wrote: I don't know why you're using stdin if you're reading from a file. From Francesco's initial post in his previous thread I inferred that he had a script like f = open(xxx.pdb) for line in f: # process line print line and was calling it python script.py outfile My

Re: Attack a sacred Python Cow

2008-07-27 Thread Russ P.
On Jul 26, 11:22 pm, Terry Reedy [EMAIL PROTECTED] wrote: Russ P. wrote: On Jul 26, 2:25 pm, Terry Reedy There is a lot of code you have not seen. Really. In informal code I use 's' and 'o' for 'self' and 'other'. I don't usually post such because it is not considered polite. So you

Re: Attack a sacred Python Cow

2008-07-27 Thread Kay Schluehr
On 26 Jul., 19:20, Michele Simionato [EMAIL PROTECTED] wrote: On Jul 26, 5:28 pm, [EMAIL PROTECTED] (Aahz) wrote: IMO, you made a big mistake in combining your point with two other meaty issues (whether method definitions should include self and whether != should use __eq__() as a

Re: Attack a sacred Python Cow

2008-07-27 Thread Nikolaus Rath
Terry Reedy [EMAIL PROTECTED] writes: What he wants is to write class foo: def bar(arg): self.whatever = arg + 1 instead of class foo: def bar(self, arg) self.whatever = arg + 1 so 'self' should *automatically* only be inserted in the function declaration, and

Re: Attack a sacred Python Cow

2008-07-27 Thread Steven D'Aprano
On Sun, 27 Jul 2008 10:23:06 +0800, Marcus.CM wrote: Well after reading some of these posts on sacred python cow on the self , i would generally feel that most programmers who started with C++/Java would find it odd. You know, there are some programmers who haven't started with C++ or Java.

Re: Attack a sacred Python Cow

2008-07-27 Thread Steven D'Aprano
On Sat, 26 Jul 2008 17:14:46 -0700, Russ P. wrote: On Jul 26, 2:25 pm, Terry Reedy There is a lot of code you have not seen. Really. In informal code I use 's' and 'o' for 'self' and 'other'. I don't usually post such because it is not considered polite. So you have seen a biased sample

Re: Stripping parts of a path

2008-07-27 Thread Tim Cook
On Sun, 2008-07-27 at 04:32 +, Tim Roberts wrote: This doesn't do what you think it does. The parameter to rstrip is a set: as long as the last character is in the set 'abcdhiloprs/', it will remove it and check the next one. All of the characters in shop are in that set. Thanks for

Re: Questions on 64 bit versions of Python

2008-07-27 Thread Roel Schroeven
Tim Roberts schreef: [EMAIL PROTECTED] wrote: For Win64-Itanium users: python-2.5.2.ia64.msi For Win64-AMD64 users: python-2.5.2.amd64.msi 1. It looks like the 64 bit versions of Python for Windows are CPU vendor specific, eg. it doesn't look like there's a single, universal executable for

Re: xml.dom's weirdness?

2008-07-27 Thread Stefan Behnel
Lie wrote: Question: Is there a way to list loaded modules, including those that aren't in my namespace? such as sys.modules? Modules are not unloaded automatically just because you do not use them yourselves. If the module is imported for whatever reason by whatever other module, it stays

Rifle Ammunition Retail Store - Sportsman, Wildlife and Outdoor Supply

2008-07-27 Thread [EMAIL PROTECTED]
Giuen Interpose Outright Company – Huntingrifle, Ammunition, Optics, Navigation – Surplus Rifle Sale – Pre-Owned Rifles – Precision Rifle - Pistol A New Generation Outright Company begun in 2008 the funding for a battlefield data link that projected data onto a computer screen inside for

Re: xml.dom's weirdness?

2008-07-27 Thread Lie
On Jul 27, 3:48 pm, Stefan Behnel [EMAIL PROTECTED] wrote: Lie wrote: Question: Is there a way to list loaded modules, including those that aren't in my namespace? such as sys.modules? Modules are not unloaded automatically just because you do not use them yourselves. I'm not surprised

Re: Attack a sacred Python Cow

2008-07-27 Thread Steven D'Aprano
On Sat, 26 Jul 2008 15:58:16 -0700, Carl Banks wrote: On Jul 26, 5:07 pm, Terry Reedy [EMAIL PROTECTED] wrote: Whether or not one should write 'if x' or 'if x != 0' [typo corrected] depends on whether one means the general 'if x is any non-null object for which bool(x) == True' or the

Re: Pwnie awards

2008-07-27 Thread Fredrik Lundh
Aahz skrev: Boy, am I glad we're not listed: http://pwnie-awards.org/2008/awards.html Now, how on earth can Todd Davis get the epic fail award when the entire US identity system relies on security by marginal obscurity? Talk about blaming the messenger... /F --

Iterating through 2 files simultaneously

2008-07-27 Thread glman74
Hi folks, I am trying to tee off both stdout and stderr from a process run through Popen. As a test, I am first trying to print the output below: from subprocess import Popen,PIPE ... p1 = Popen(['cvs', 'update'], stdout=PIPE, stderr=PIPE) for (l1, l2) in zip(p1.stdout, p1.stderr): print

Re: Attack a sacred Python Cow

2008-07-27 Thread alex23
On Jul 27, 4:26 pm, Russ P. [EMAIL PROTECTED] wrote: On Jul 26, 11:18 pm, Terry Reedy [EMAIL PROTECTED] wrote: The use of nothing'.' has been suggested before and rejected. Where and why? Google is your friend: http://mail.python.org/pipermail/python-3000/2006-April/000793.html --

Re: Confounded by Python objects

2008-07-27 Thread Steven D'Aprano
On Sat, 26 Jul 2008 18:54:22 +, Robert Latest wrote: Here's an interesting side note: After fixing my Channel thingy the whole project behaved as expected. But there was an interesting hitch. The main part revolves around another class, Sequence, which has a list of Channels as attribute.

Re: Attack a sacred Python Cow

2008-07-27 Thread Lie
On Jul 27, 2:48 am, Russ P. [EMAIL PROTECTED] wrote: If, as I wrote, you permit the omission of self in method signatures defined within class definitions, then you could still insist on instance attribute qualification using self - exactly as one would when writing Java according to

ctypes - unloading implicitly loaded dlls

2008-07-27 Thread Scott Pigman
Here's what I'm struggling with (as best as I can understand it): I'm writing a program that uses functionality from two different sets of cdlls which reside in two different directories, call them 'libA.dll' and 'libB.dll'. Although I don't directly use it, both directories contain a dll with

x*x if x10

2008-07-27 Thread ssecorp
I have seen somewhere that you can write something like: x*x if x10 but exactly that doesn't work and I can't get any variation to work. it is possible to nest with an else too. how do you write it? and also, is it idiomatic? doesn't seem to add functionality, just another way of doing the

Re: bundling python with application

2008-07-27 Thread Diez B. Roggisch
Randall Smith schrieb: I'd like to bundle Python with my app, which will be targeted at Linux, Windows and Mac. Discussions I've found about this tend to lead to py2exe, freeze, etc, but I'd like to do something rather simple and am seeking advice. What I'd like to do is just copy the

Re: x*x if x10

2008-07-27 Thread Diez B. Roggisch
ssecorp schrieb: I have seen somewhere that you can write something like: x*x if x10 but exactly that doesn't work and I can't get any variation to work. it is possible to nest with an else too. how do you write it? and also, is it idiomatic? doesn't seem to add functionality, just

Re: x*x if x10

2008-07-27 Thread alex23
On Jul 27, 10:13 pm, ssecorp [EMAIL PROTECTED] wrote: I have seen somewhere that you can write something like: x*x if x10 but exactly that doesn't work and I can't get any variation to work. It's called a ternary operator. The format is: label = true-value if condition else false-value it

Re: Iterating through 2 files simultaneously

2008-07-27 Thread Rob Williscroft
wrote in news:7ae96aff-c1a7-4763-8db7- [EMAIL PROTECTED] in comp.lang.python: Hi folks, I am trying to tee off both stdout and stderr from a process run through Popen. As a test, I am first trying to print the output below: from subprocess import Popen,PIPE ... p1 = Popen(['cvs',

Read .txt file like .py file

2008-07-27 Thread King
I have a text file and contents are: Help= Code is written by xteam. value = 0.0 How do I read this file like python syntax. What I mean is first readline operation should return complete declaration of 'Help' variable. If I evaluate this string then it should create a 'Help' variable with

Re: xml.dom's weirdness?

2008-07-27 Thread Stefan Behnel
Lie wrote: I'm more concerned about the number of modules imported by making an error (from 30 on the startup to 187) and the side-effect of making an error, which makes modules such as xml.*/email.* that previously doesn't exist get imported out of the blue... Using my system Python (2.5.1

Re: Read .txt file like .py file

2008-07-27 Thread Stefan Behnel
King wrote: I have a text file and contents are: Help= Code is written by xteam. value = 0.0 How do I read this file like python syntax. What I mean is first readline operation should return complete declaration of 'Help' variable. If I evaluate this string then it should create a

Rant (was Re: x*x if x10

2008-07-27 Thread DaveM
On Sun, 27 Jul 2008 05:24:36 -0700 (PDT), alex23 [EMAIL PROTECTED] wrote: On Jul 27, 10:13 pm, ssecorp [EMAIL PROTECTED] wrote: I have seen somewhere that you can write something like: x*x if x10 but exactly that doesn't work and I can't get any variation to work. It's called a ternary

Re: Rant (was Re: x*x if x10

2008-07-27 Thread Karen Tracey
On Sun, Jul 27, 2008 at 10:17 AM, DaveM [EMAIL PROTECTED] wrote: On Sun, 27 Jul 2008 05:24:36 -0700 (PDT), alex23 [EMAIL PROTECTED] wrote: On Jul 27, 10:13 pm, ssecorp [EMAIL PROTECTED] wrote: I have seen somewhere that you can write something like: x*x if x10 but exactly that doesn't

Re: Rant (was Re: x*x if x10

2008-07-27 Thread Diez B. Roggisch
DaveM schrieb: On Sun, 27 Jul 2008 05:24:36 -0700 (PDT), alex23 [EMAIL PROTECTED] wrote: On Jul 27, 10:13 pm, ssecorp [EMAIL PROTECTED] wrote: I have seen somewhere that you can write something like: x*x if x10 but exactly that doesn't work and I can't get any variation to work. It's

Re: Rant (was Re: x*x if x10

2008-07-27 Thread Gary Herron
DaveM wrote: On Sun, 27 Jul 2008 05:24:36 -0700 (PDT), alex23 [EMAIL PROTECTED] wrote: On Jul 27, 10:13 pm, ssecorp [EMAIL PROTECTED] wrote: I have seen somewhere that you can write something like: x*x if x10 but exactly that doesn't work and I can't get any variation to

Re: Rant (was Re: x*x if x10

2008-07-27 Thread Marc 'BlackJack' Rintsch
On Sun, 27 Jul 2008 16:41:19 +0200, Diez B. Roggisch wrote: DaveM schrieb: Getting back to the list concatenation, I finally found the itertools.chain command which is the most compact and fastest (or second fastest by a trivial amount, I can't remember which). Along the way, I must have

Re: Rant (was Re: x*x if x10

2008-07-27 Thread Diez B. Roggisch
Marc 'BlackJack' Rintsch schrieb: On Sun, 27 Jul 2008 16:41:19 +0200, Diez B. Roggisch wrote: DaveM schrieb: Getting back to the list concatenation, I finally found the itertools.chain command which is the most compact and fastest (or second fastest by a trivial amount, I can't remember

Re: Rant (was Re: x*x if x10

2008-07-27 Thread ssecorp
I might be misunderstanding OP but: a+b+c+d+e is simple way of concatenating 5 lists... as a function that takes any amount of lists and concatenates them: def concat(*args): c = [] for elem in args: c += elem return c don't know if extend is faster or

Re: Insert string into string

2008-07-27 Thread Mensanator
On Jul 27, 1:41�am, Peter Otten [EMAIL PROTECTED] wrote: Mensanator wrote: I don't know why you're using stdin if you're reading from a file. From Francesco's initial post in his previous thread I inferred that he had a script like f = open(xxx.pdb) for line in f: � � # process line � �

Re: Rant (was Re: x*x if x10

2008-07-27 Thread alex23
On Jul 28, 1:26 am, ssecorp [EMAIL PROTECTED] wrote: I might be misunderstanding OP but: a+b+c+d+e is simple way of concatenating 5 lists... as a function that takes any amount of lists and concatenates them: def concat(*args): c = [] for elem in args: c +=

Re: Iterating through 2 files simultaneously

2008-07-27 Thread glman74
So import STDOUT and make stderr=STDOUT in the Popen call, you will then have one file/pipe to deal with p1.stdout. Thank you - that works great! Mahesh -- http://mail.python.org/mailman/listinfo/python-list

Re: Rant (was Re: x*x if x10

2008-07-27 Thread DaveM
On Sun, 27 Jul 2008 16:57:14 +0200, Diez B. Roggisch [EMAIL PROTECTED] wrote: Marc 'BlackJack' Rintsch schrieb: On Sun, 27 Jul 2008 16:41:19 +0200, Diez B. Roggisch wrote: DaveM schrieb: Getting back to the list concatenation, I finally found the itertools.chain command which is the most

Re: Rant (was Re: x*x if x10

2008-07-27 Thread Gary Herron
DaveM wrote: On Sun, 27 Jul 2008 16:57:14 +0200, Diez B. Roggisch [EMAIL PROTECTED] wrote: Marc 'BlackJack' Rintsch schrieb: On Sun, 27 Jul 2008 16:41:19 +0200, Diez B. Roggisch wrote: DaveM schrieb: Getting back to the list concatenation, I finally found the

Re: Rant (was Re: x*x if x10

2008-07-27 Thread Diez B. Roggisch
DaveM schrieb: On Sun, 27 Jul 2008 16:57:14 +0200, Diez B. Roggisch [EMAIL PROTECTED] wrote: Marc 'BlackJack' Rintsch schrieb: On Sun, 27 Jul 2008 16:41:19 +0200, Diez B. Roggisch wrote: DaveM schrieb: Getting back to the list concatenation, I finally found the itertools.chain command

Re: Attack a sacred Python Cow

2008-07-27 Thread Marc 'BlackJack' Rintsch
On Sat, 26 Jul 2008 21:46:31 -0700, s0suk3 wrote: (It's true that C++ has more OO features than Python, like private/ public members, virtual methods, etc. Oh yeah, again the discussion about `private`/`public` and if that's an important OOP feature. :-) Aren't *all* methods in Python

Google Group: architectgurus

2008-07-27 Thread Sudhakar Chavali
Hi I have created a group called architectgurus (http://groups.google.com/ group/architectgurus) or [EMAIL PROTECTED] . Irrespective of technology, vendor, domain I will be discussing and share my thoughts in homogenous and harmonious way. If you are interested even you can join and contribute

Re: Attack a sacred Python Cow

2008-07-27 Thread Terry Reedy
Steven D'Aprano wrote: On Sun, 27 Jul 2008 10:23:06 +0800, Marcus.CM wrote: Well after reading some of these posts on sacred python cow on the self , i would generally feel that most programmers who started with C++/Java would find it odd. You know, there are some programmers who haven't

Re: Rant (was Re: x*x if x10

2008-07-27 Thread DaveM
On Sun, 27 Jul 2008 16:41:19 +0200, Diez B. Roggisch [EMAIL PROTECTED] wrote: You obviously aren't aware of the pitfalls regarding the mis-use of or and and for this usage. snip example Well, yes, I am (and the way around the problem), but as its never caught me out (so far), I hadn't

Re: Rant (was Re: x*x if x10

2008-07-27 Thread Diez B. Roggisch
Can you tell us what you mean by several names of one object? You mean this? a = range(10) b = a id(a) == id(b) ? Passing references instead of values is an extremely important concept of many languages, without it you would end up copying most of the time. OK. I've obviously been

Re: Rant (was Re: x*x if x10

2008-07-27 Thread Terry Reedy
DaveM wrote: On Sun, 27 Jul 2008 16:57:14 +0200, Diez B. Roggisch [EMAIL PROTECTED] You'll have guessed, I'm sure, that I'm not a professional programmer. This was the third rewrite of a program to match candidate groups to examiners on a three day course I run, necessitated on this occasion

Re: Attack a sacred Python Cow

2008-07-27 Thread castironpi
On Jul 27, 2:56 am, Nikolaus Rath [EMAIL PROTECTED] wrote: Terry Reedy [EMAIL PROTECTED] writes: What he wants is to write   class foo:    def bar(arg):        self.whatever = arg + 1 instead of class foo:    def bar(self, arg)        self.whatever = arg + 1 so 'self' should

Re: Attack a sacred Python Cow

2008-07-27 Thread castironpi
On Jul 26, 4:08 am, Nikolaus Rath [EMAIL PROTECTED] wrote: Terry Reedy [EMAIL PROTECTED] writes: Nikolaus Rath wrote: Terry Reedy [EMAIL PROTECTED] writes: Torsten Bronger wrote: Hallöchen!   And why does this make the implicit insertion of self difficult? I could easily write a

Re: Questions on 64 bit versions of Python

2008-07-27 Thread Martin v. Löwis
- AMD64 (or x86-64 or x64 or EMT64 or Intel64) is a 64-bit instruction set from AMD which is an extension to the i386 instruction set, and runs 32-bit (and 16-bit) i386-code natively. But, and this is important, despite the name the instruction set is also used by Intel (though they call it

Re: Rant (was Re: x*x if x10

2008-07-27 Thread Anders J. Munch
Gary Herron wrote: A = [1,2,3] B = [4,5,6] C = [7,8,9] A+B+C [1, 2, 3, 4, 5, 6, 7, 8, 9] sum([A,B,C], []) [1, 2, 3, 4, 5, 6, 7, 8, 9] Careful now, this can be very slow. sum uses __add__, not __iadd__, which gives this approach quadratic worst-case runtime. - Anders --

method decorators and more on decorators

2008-07-27 Thread Themistoklis Bourdenas
Hi, is there any possible way to get the class or class name inside a method decorator? For example in the code sample below: def decorate(func): print type(func) return func class myclass: @decorate def foo(self): pass The output of this program will be the type of the supplied

Re: Attack a sacred Python Cow

2008-07-27 Thread Russ P.
On Jul 27, 3:11 am, alex23 [EMAIL PROTECTED] wrote: On Jul 27, 4:26 pm, Russ P. [EMAIL PROTECTED] wrote: On Jul 26, 11:18 pm, Terry Reedy [EMAIL PROTECTED] wrote: The use of nothing'.' has been suggested before and rejected. Where and why? Google is your

Re: Attack a sacred Python Cow

2008-07-27 Thread Derek Martin
On Sat, Jul 26, 2008 at 12:06:05AM -0400, Terry Reedy wrote: There is no requirement to have 'self' in the parameter list. But there is a requirement to have *something* which refers to the object instance. Why can't this be implicit with a keyword defined in python to refer to it? So the

Re: Rant (was Re: x*x if x10

2008-07-27 Thread DaveM
On Sun, 27 Jul 2008 09:28:28 -0700, Gary Herron [EMAIL PROTECTED] wrote: a = list(set(itertools.chain(*sessexam.values( a.sort() #As I write I'm wondering if I really need it sorted. Hmm... return a Didn't someone already answer that. List addition and sum() both do what

Re: Attack a sacred Python Cow

2008-07-27 Thread Derek Martin
On Sun, Jul 27, 2008 at 08:13:53AM +, Steven D'Aprano wrote: On Sun, 27 Jul 2008 10:23:06 +0800, Marcus.CM wrote: Well after reading some of these posts on sacred python cow on the self , i would generally feel that most programmers who started with C++/Java would find it odd. You

Re: Attack a sacred Python Cow

2008-07-27 Thread Russ P.
On Jul 27, 1:19 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Sat, 26 Jul 2008 17:14:46 -0700, Russ P. wrote: You take the name down to a single letter. As I suggested in an earlier post on this thread, why not take it down to zero letters? The question isn't why not,

Re: Rant (was Re: x*x if x10

2008-07-27 Thread DaveM
On Sun, 27 Jul 2008 19:46:32 +0200, Diez B. Roggisch [EMAIL PROTECTED] wrote: As a rule of thumb, don't return objects you didn't create inside a function from scratch. I wish I'd had that advice when I started learning python. It would have saved me no end of grief. DaveM --

Re: Attack a sacred Python Cow

2008-07-27 Thread Derek Martin
On Sun, Jul 27, 2008 at 08:19:17AM +, Steven D'Aprano wrote: You take the name down to a single letter. As I suggested in an earlier post on this thread, why not take it down to zero letters? The question isn't why not, but why. The status quo works well as it is, even if it isn't

Re: Confounded by Python objects

2008-07-27 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : On Sat, 26 Jul 2008 18:54:22 +, Robert Latest wrote: Here's an interesting side note: After fixing my Channel thingy the whole project behaved as expected. But there was an interesting hitch. The main part revolves around another class, Sequence, which has a list

Re: Attack a sacred Python Cow

2008-07-27 Thread Colin J. Williams
Russ P. wrote: On Jul 26, 2:25 pm, Terry Reedy There is a lot of code you have not seen. Really. In informal code I use 's' and 'o' for 'self' and 'other'. I don't usually post such because it is not considered polite. So you have seen a biased sample of the universe. You take the name

Re: Attack a sacred Python Cow

2008-07-27 Thread Bruno Desthuilliers
Torsten Bronger a écrit : Hallöchen! Bruno Desthuilliers writes: Torsten Bronger a écrit : (snip) One could surely find ways to realise this. However, the design goal should be: Make the frequent case simple, and the rare case possible. Given the (more and more prominent) use of

Re: Attack a sacred Python Cow

2008-07-27 Thread Bruno Desthuilliers
Marcus.CM a écrit : Well after reading some of these posts on sacred python cow on the self , i would generally feel that most programmers who started with C++/Java would find it odd. And its true, i agree completely there should not be a need to put self into every single member function.

Re: Attack a sacred Python Cow

2008-07-27 Thread Bruno Desthuilliers
Russ P. a écrit : On Jul 26, 11:22 pm, Terry Reedy [EMAIL PROTECTED] wrote: Russ P. wrote: On Jul 26, 2:25 pm, Terry Reedy There is a lot of code you have not seen. Really. In informal code I use 's' and 'o' for 'self' and 'other'. I don't usually post such because it is not considered

Re: Attack a sacred Python Cow

2008-07-27 Thread Bruno Desthuilliers
Lawrence D'Oliveiro a écrit : In message [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: Support OO but it doesn't have to? That sounds like saying that in some Python implementations you'll be able to use OO, but that you just might bump into a Python distribution ... Change distribution to

Re: Attack a sacred Python Cow

2008-07-27 Thread Bruno Desthuilliers
Jordan a écrit : (snip) about Python Zen: Perhaps we're just looking at an instance of a wider problem - smart people boil good ideas down into short slogans, which are nice and memorable and somewhat helpful, but can lead to bad consequences when lots of others start overusing or

with statement for two files

2008-07-27 Thread braver
Can open two files in a with statement: with open(src) as readin, open(dst,w) as writin: # WRONG: comma doesn't work ... -- so that you have transactional safety for two file descriptors? The comma syntax doesn't work, but is there a way, except for with open(src) as readin: with

Re: Rant (was Re: x*x if x10

2008-07-27 Thread Terry Reedy
DaveM wrote: On Sun, 27 Jul 2008 19:46:32 +0200, Diez B. Roggisch [EMAIL PROTECTED] wrote: As a rule of thumb, don't return objects you didn't create inside a function from scratch. Unless its job is specifically to get/fetch an object (reference thereto) from someplace the caller cannot

Re: Autocompletion and Interactive Tables in a Python IDE

2008-07-27 Thread Fabio Zadrozny
a) Intellisense (tells you what classes/methods are available and what variables go into a function) b) Code Completion (guesses your code after four letters) c) Data-Orientation; multiple data sessions can be open, data can be viewed easily Python's IDLE has only half of the first of these

Re: with statement for two files

2008-07-27 Thread Diez B. Roggisch
braver schrieb: Can open two files in a with statement: with open(src) as readin, open(dst,w) as writin: # WRONG: comma doesn't work ... -- so that you have transactional safety for two file descriptors? The comma syntax doesn't work, but is there a way, except for with open(src) as

Re: Attack a sacred Python Cow

2008-07-27 Thread Bruno Desthuilliers
Derek Martin a écrit : On Sun, Jul 27, 2008 at 08:19:17AM +, Steven D'Aprano wrote: You take the name down to a single letter. As I suggested in an earlier post on this thread, why not take it down to zero letters? The question isn't why not, but why. The status quo works well as it is,

Re: Rant (was Re: x*x if x10

2008-07-27 Thread Diez B. Roggisch
Terry Reedy schrieb: DaveM wrote: On Sun, 27 Jul 2008 19:46:32 +0200, Diez B. Roggisch [EMAIL PROTECTED] wrote: As a rule of thumb, don't return objects you didn't create inside a function from scratch. Unless its job is specifically to get/fetch an object (reference thereto) from

Where is the correct round() method?

2008-07-27 Thread josh logan
Hello, I need a round function that _always_ rounds to the higher integer if the argument is equidistant between two integers. In Python 3.0, this is not the advertised behavior of the built-in function round() as seen below: round(0.5) 0 round(1.5) 2 round(2.5) 2 I would think this is a

Taking command line arguments from another program

2008-07-27 Thread aditya shukla
Hello folks ,I have a program in which a text file is generated as an output eg C:\prog\ prog -x test.txt Right now whenever i have to read the test file i have to put its name manually in my code. eg f=open(c:\\prog\\test.txt,r) How ever i want to add the name of the test file dynamically to my

Re: Attack a sacred Python Cow

2008-07-27 Thread Russ P.
On Jul 27, 12:39 pm, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Derek Martin a écrit : On Sun, Jul 27, 2008 at 08:19:17AM +, Steven D'Aprano wrote: You take the name down to a single letter. As I suggested in an earlier post on this thread, why not take it down to zero letters?

Re: Confounded by Python objects

2008-07-27 Thread Steven D'Aprano
On Sun, 27 Jul 2008 20:04:27 +0200, Bruno Desthuilliers wrote: In general, anything that looks like this: s = '' for i in range(1): # or any big number s = s + 'another string' can be slow. Very slow. But this is way faster: s = '' for i in range(1): # or any big

Re: Attack a sacred Python Cow

2008-07-27 Thread Russ P.
On Jul 27, 3:11 pm, Russ P. [EMAIL PROTECTED] wrote: On Jul 27, 12:39 pm, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Derek Martin a écrit : On Sun, Jul 27, 2008 at 08:19:17AM +, Steven D'Aprano wrote: You take the name down to a single letter. As I suggested in an earlier

Re: Attack a sacred Python Cow

2008-07-27 Thread Steven D'Aprano
On Sun, 27 Jul 2008 12:33:16 -0700, Russ P. wrote: On Jul 27, 1:19 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Sat, 26 Jul 2008 17:14:46 -0700, Russ P. wrote: You take the name down to a single letter. As I suggested in an earlier post on this thread, why not take

Re: Attack a sacred Python Cow

2008-07-27 Thread Steven D'Aprano
On Sun, 27 Jul 2008 16:04:43 -0400, Colin J. Williams wrote: For those who don't like the way the empty first argument looks, maybe something like this could be allowed: def fun( ., cat): I don't see the need for the comma in fun. tongue firmly in cheek Or the parentheses and colon.

Re: Not entirely serious: recursive lambda?

2008-07-27 Thread Cameron Simpson
On 20Jul2008 00:08, Kay Schluehr [EMAIL PROTECTED] wrote: | Google was not my friend on this one, and I suspect there is no | answer. | | Even the Great Google can't help if you don't use the right | keywords ;) Actually, I was shown an useful Google search syntax the other day: Searching

Re: Where is the correct round() method?

2008-07-27 Thread Gary Herron
josh logan wrote: Hello, I need a round function that _always_ rounds to the higher integer if the argument is equidistant between two integers. In Python 3.0, this is not the advertised behavior of the built-in function round() as seen below: round(0.5) 0 round(1.5)

Re: Where is the correct round() method? Use math.ceil

2008-07-27 Thread Herman
Where is the correct round() method? Hello, I need a round function that _always_ rounds to the higher integer if the argument is equidistant between two integers. In Python 3.0, this is not the advertised behavior of the built-in function round() as seen below: round(0.5) 0

Re: Where is the correct round() method?

2008-07-27 Thread pigmartian
it could be that 3.0 is using banker's rounding --- rounding to the even digit. the idea behind it behind it being to reduce error accumulation when working with large sets of values. Works for me on Python 2.5 on Linux running on Intel(R) Core(TM)2 Duo CPU. What system are you on? It

Re: Where is the correct round() method?

2008-07-27 Thread josh logan
On Jul 27, 7:58 pm, Gary Herron [EMAIL PROTECTED] wrote: josh logan wrote: Hello, I need a round function that _always_ rounds to the higher integer if the argument is equidistant between two integers. In Python 3.0, this is not the advertised behavior of the built-in function round() as

Re: Where is the correct round() method?

2008-07-27 Thread josh logan
On Jul 27, 8:45 pm, pigmartian [EMAIL PROTECTED] wrote: it could be that 3.0 is using banker's rounding --- rounding to the even digit.  the idea behind it behind it being to reduce error accumulation when working with large sets of values. Works for me on Python 2.5 on Linux running on

ctypes - unloading implicitly loaded dlls

2008-07-27 Thread pigmartian
(my apologies if this is a repost, but it sure seems like the first attempt disappeared into the ether...) I'm writing a program that uses functionality from two different sets of cdlls which reside in two different directories, call them 'libA.dll' and 'libB.dll'. Although I don't directly

Re: Attack a sacred Python Cow

2008-07-27 Thread Terry Reedy
Russ P. wrote: On Jul 27, 12:39 pm, Bruno Desthuilliers All I am suggesting is that the programmer have the option of replacing self.member with simply .member, since the word self is arbitrary and unnecessary. I presume you are proposing the opposite also, that .member would internally be

Re: Attack a sacred Python Cow

2008-07-27 Thread Terry Reedy
Russ P. wrote: When I write a function in which a data member will be used several times, I usually do something like this: data = self.data so I can avoid the clutter of repeated use of self.data. Another reason people do this is for speed, even if self.data is used just once but in

write unsigned integer 32 bits to socket

2008-07-27 Thread [EMAIL PROTECTED]
hi i want to send unsigned 32 bit integer to socket, and looking for something equivalent to this method... http://livedocs.adobe.com/flex/2/langref/flash/net/Socket.html#writeUnsignedInt() is there such method / library available in python?! this is as far as i have gotten along s =

Re: Where is the correct round() method?

2008-07-27 Thread Terry Reedy
Gary Herron wrote: josh logan wrote: I need a round function that _always_ rounds to the higher integer if the argument is equidistant between two integers. In Python 3.0, this is not the advertised behavior of the built-in function round() as seen below: round(2.5) 2 Huh?

Re: Where is the correct round() method?

2008-07-27 Thread Larry Bates
josh logan wrote: Hello, I need a round function that _always_ rounds to the higher integer if the argument is equidistant between two integers. In Python 3.0, this is not the advertised behavior of the built-in function round() as seen below: round(0.5) 0 round(1.5) 2 round(2.5) 2 I

Re: like py2exe, but on a mac

2008-07-27 Thread William McBrine
On Sun, 13 Jul 2008 00:58:59 +0200, Python.Arno wrote: http://undefined.org/python/py2app.html py2app bundles Python itself into the app, right? I wonder, is there no way to create an app bundle that relies on the existing installation of Python, since OS X already comes with Python? I have a

Re: write unsigned integer 32 bits to socket

2008-07-27 Thread Larry Bates
[EMAIL PROTECTED] wrote: hi i want to send unsigned 32 bit integer to socket, and looking for something equivalent to this method... http://livedocs.adobe.com/flex/2/langref/flash/net/Socket.html#writeUnsignedInt() is there such method / library available in python?! this is as far as i have

Re: write unsigned integer 32 bits to socket

2008-07-27 Thread [EMAIL PROTECTED]
On Sun, Jul 27, 2008 at 7:01 PM, Larry Bates [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: i want to send unsigned 32 bit integer to socket, and looking for something equivalent to this method... http://livedocs.adobe.com/flex/2/langref/flash/net/Socket.html#writeUnsignedInt() is there

Re: write unsigned integer 32 bits to socket

2008-07-27 Thread Larry Bates
[EMAIL PROTECTED] wrote: On Sun, Jul 27, 2008 at 7:01 PM, Larry Bates [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: i want to send unsigned 32 bit integer to socket, and looking for something equivalent to this method...

Re: write unsigned integer 32 bits to socket

2008-07-27 Thread [EMAIL PROTECTED]
On Sun, Jul 27, 2008 at 7:17 PM, Larry Bates [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Sun, Jul 27, 2008 at 7:01 PM, Larry Bates [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: i want to send unsigned 32 bit integer to socket, and looking for something equivalent to this

I love shelf BUT

2008-07-27 Thread Sera Jackson
ok, I know its an over discussed topic. Althought I understand why it is there I cant constantly see it in my argument list in parenthesis. can someone give me an insight of the cons of a syntax like this: class Class: def self.method(arguments): etc, etc In other words def

  1   2   >