Behaviour-based interface/protocol implementation?

2011-01-24 Thread Alan Franzoni
hat already exist in the python ecosystem? b) can anybody see any flaw either in what I'd like to do ("you shouldn't do that because...") or in the way I want to do it ("It won't work because...") -- Alan Franzoni -- contact me at public@[mysurname].eu -- http://mail.python.org/mailman/listinfo/python-list

Re: Swampy Module installation

2011-01-24 Thread Alan Meyer
et further into Python. Good luck. Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: Behaviour-based interface/protocol implementation?

2011-01-25 Thread Alan Franzoni
ht work as well (call the method and see whether it crashes) and I may finally pick that approach, but I'd like not to clutter my code with explicit try...except blocks. The very same approach might help. The chance for signature mismatch is of course high when using extreme runti

Re: Behaviour-based interface/protocol implementation?

2011-01-26 Thread Alan Franzoni
e_implemented_by(oo) # -> True MyInterface.maybe_implemented_by(to) # -> True MyInterface.maybe_implemented_by(SomeObj) # -> True That's just what I'd like and I suppose can't be currently done with current ABC, PyProtocols or zope.interface implementations, right? -- Alan Franzoni -- contact me at public@[mysurname].eu -- http://mail.python.org/mailman/listinfo/python-list

Re: Behaviour-based interface/protocol implementation?

2011-01-27 Thread Alan Franzoni
ant. Yes, __instancecheck__ could be used as an alternative hook with respect to maybe_implemented_by(), but there's no such logic for signature checking. That's a minor detail, I think. -- Alan Franzoni -- contact me at public@[mysurname].eu -- http://mail.python.org/mailman/listinfo/python-list

Re: Behaviour-based interface/protocol implementation?

2011-01-27 Thread Alan Franzoni
On Thu, Jan 27, 2011 at 8:03 PM, Alan Franzoni wrote: > Yes, __instancecheck__ could be used as an alternative hook with > respect to maybe_implemented_by(), but there's no such logic for > signature checking. That's a minor detail, I think. On the contrary, now that I doubl

Re: Behaviour-based interface/protocol implementation?

2011-01-27 Thread Alan Franzoni
. def method1(self, c, d): ... could satisfy or not the very same interface, depending whether the args are passed as postional or kw. -- Alan Franzoni -- contact me at public@[mysurname].eu -- http://mail.python.org/mailman/listinfo/python-list

Re: Behaviour-based interface/protocol implementation?

2011-01-27 Thread Alan Franzoni
nstead. Maybe some stack analysis could be performed, but I'd prefer to check as much as I can *before* calling. - Sometimes I'd like to group objects depending on their *behaviour* (not their type), and then feed them somewhere else without actually calling their methods. If I can know thei

Re: Behaviour-based interface/protocol implementation?

2011-01-28 Thread Alan Franzoni
t yes, __instancecheck__ on an ABC can actually be used in place of maybe_implemented_by and hooking into isinstance(). Thanks! -- Alan Franzoni -- contact me at public@[mysurname].eu -- http://mail.python.org/mailman/listinfo/python-list

Re: how to read the last line of a huge file???

2011-01-31 Thread Alan Meyer
IX utility "tail" and see how they do it. It seems to work with equal speed no matter how large the file is and I suspect it uses MRAB's solution, but because it's written in C, it probably examines each character directly rather than calling a library routine like

Re: Looking for Remote Python Project

2011-01-31 Thread Alan Meyer
hire anyone, I'm just a programmer myself. But I'm curious about rates in India vs. the U.S., where I live and work. Thanks and good luck with your efforts to get work. Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python-os. Command Execution

2011-02-19 Thread ALAN GAULD
pened? We need a bit more context and you need to do a bity more debugging. Starting with getting rid of the bitwise and "trick" from C. All it does here is make it hard to understand whats happening. HTH, Alan G. Author of the Learn to Program web site http://www.alan-g.me.uk/ -- http://mail.python.org/mailman/listinfo/python-list

Advice requested on class design

2010-04-28 Thread Alan Ristow
good reason to use them, I am all for it, though. All advice appreciated, Thanks, Alan -- http://mail.python.org/mailman/listinfo/python-list

abc for generators?

2010-05-19 Thread Alan Franzoni
ator, even though it could expose the very same interface as a builtin, yield-based generator. I think it would be pretty useful. comments? -- Alan Franzoni contact me at pub...@[mysurname].eu -- http://mail.python.org/mailman/listinfo/python-list

Re: abc for generators?

2010-05-19 Thread Alan Franzoni
On 5/19/10 7:24 PM, Carl Banks wrote: > collections.Iterator That would just support the next() method. But enhanced generators interface - supporting coroutines as well - include send(), throw() and close(). -- Alan Franzoni contact me at pub...@[mysurname].eu -- http://mail.python.

Efficient binary search tree stored in a flat array?

2009-07-13 Thread Douglas Alan
I couldn't find a good algorithms forum on the Internet, so I guess I'll ask this question here instead: Is it possible to efficiently maintain a binary search tree in a flat array (i.e., without using pointers), as is typically done for a binary heap? It *is* possible, of course, to keep an order

Re: Efficient binary search tree stored in a flat array?

2009-07-13 Thread Douglas Alan
On Jul 13, 3:57 pm, a...@pythoncraft.com (Aahz) wrote: > Still, unless your list is large (more than thousands of elements), > that's the way you should go.  See the bisect module.  Thing is, the > speed difference between C and Python means the constant for insertion > and deletion is very very s

Re: Efficient binary search tree stored in a flat array?

2009-07-14 Thread Douglas Alan
On Jul 14, 7:38 am, Florian Brucker wrote: > Douglas Alan wrote: > > Thank you. My question wasn't intended to be Python specific, though. > > I am just curious for purely academic reasons about whether there is > > such an algorithm. All the sources I've skimmed

Re: Efficient binary search tree stored in a flat array?

2009-07-14 Thread Douglas Alan
On Jul 14, 8:10 am, Piet van Oostrum wrote: > Of course you can take any BST algorithm and replace pointers by indices > in the array and allocate new elements in the array. But then you need > array elements to contain the indices for the children explicitely. And why is this a problem? This is

Re: Efficient binary search tree stored in a flat array?

2009-07-14 Thread Douglas Alan
On Jul 14, 9:19 am, Scott David Daniels wrote: > It may well be that there is no good simple solution, and people avoid > writing about non-existent algorithms. I can't imagine why that should be the case. The CLRS textbook on algorithms, for instance, goes to some pains to mathematically prove

Re: Efficient binary search tree stored in a flat array?

2009-07-14 Thread Douglas Alan
I wrote: > On Jul 14, 8:10 am, Piet van Oostrum wrote: > > > Of course you can take any BST algorithm and replace pointers by indices > > in the array and allocate new elements in the array. But then you need > > array elements to contain the indices for the children explicitely. > And why is t

Unrecognized escape sequences in string literals

2009-08-09 Thread Douglas Alan
A friend of mine is just learning Python, and he's a bit tweaked about how unrecognized escape sequences are treated in Python. This is from the Python 3.0 reference manual: Unlike Standard C, all unrecognized escape sequences are left in the string unchanged, i.e., the backslash is left

Re: Unrecognized escape sequences in string literals

2009-08-09 Thread Douglas Alan
Steven D'Aprano wrote: > Why should a backslash in a string literal be an error? Because in Python, if my friend sees the string "foo\xbar\n", he has no idea whether the "\x" is an escape sequence, or if it is just the characters "\x", unless he looks it up in the manual, or tries it out in the R

Re: Unrecognized escape sequences in string literals

2009-08-09 Thread Douglas Alan
On Aug 9, 8:06 pm, Steven D'Aprano wrote: > while the behaviour your > friend wants is "treat a backslash as an error, except for these > exceptions". Besides, can't all error situations be described as, "treat the error situation as an error, except for the exception of when the situation isn't

Re: Unrecognized escape sequences in string literals

2009-08-10 Thread Douglas Alan
On Aug 10, 2:03 am, Steven D'Aprano wrote: > On Sun, 09 Aug 2009 17:56:55 -0700, Douglas Alan wrote: > > Because in Python, if my friend sees the string "foo\xbar\n", he has no > > idea whether the "\x" is an escape sequence, or if it is just the >

Re: Unrecognized escape sequences in string literals

2009-08-10 Thread Douglas Alan
On Aug 10, 2:10 am, Steven D'Aprano > I've never had any errors caused by this. But you've seen an error caused by this, in this very discussion. I.e., "foo\xbar". "\xba" isn't an escape sequence in any other language that I've used, which is one reason I made this error... Oh, wait a minute --

Re: Unrecognized escape sequences in string literals

2009-08-10 Thread Douglas Alan
On Aug 10, 4:37 am, Steven D'Aprano > There is at least one good reason for preferring an error, namely that it > allows Python to introduce new escape codes without going through a long, > slow process. But the rest of these complaints are terribly unconvincing. What about: o Beautiful is b

Re: Unrecognized escape sequences in string literals

2009-08-10 Thread Douglas Alan
On Aug 10, 10:58 am, Scott David Daniels wrote: > The string rules reflect C's rules, and I see little > excuse for trying to change them now. No they don't. Or at least not C++'s rules. C++ behaves exactly as I should like. (Or at least g++ does. Or rather *almost* as I would like, as by defau

Re: Unrecognized escape sequences in string literals

2009-08-10 Thread Douglas Alan
From: Steven D'Aprano wrote: > On Mon, 10 Aug 2009 00:32:30 -0700, Douglas Alan wrote: > > In C++, if I know that the code I'm looking at compiles, > > then I never need worry that I've misinterpreted what a > > string literal means. > If you don't k

Re: Unrecognized escape sequences in string literals

2009-08-11 Thread Douglas Alan
On Aug 11, 2:00 pm, Steven D'Aprano wrote: > > test.cpp:1:1: warning: unknown escape sequence '\y' > > Isn't that a warning, not a fatal error? So what does temp contain? My "Annotated C++ Reference Manual" is packed, and surprisingly in Stroustrup's Third Edition, there is no mention of the iss

Re: Unrecognized escape sequences in string literals

2009-08-11 Thread Douglas Alan
Steven D'Aprano wrote: > Because the cost isn't zero. Needing to write \\ in a string > literal when you want \ is a cost, I need to preface this entire post with the fact that I've already used ALL of the arguments that you've provided on my friend before I ever even came here with the topic, an

Re: Unrecognized escape sequences in string literals

2009-08-11 Thread Douglas Alan
On Aug 10, 11:27 pm, Steven D'Aprano wrote: > On Mon, 10 Aug 2009 08:21:03 -0700, Douglas Alan wrote: > > But you're right, it's too late to change this now. > > Not really. There is a procedure for making non-backwards compatible > changes. If you care deeply eno

Re: Unrecognized escape sequences in string literals

2009-08-11 Thread Douglas Alan
On Aug 11, 4:38 pm, Ethan Furman wrote: > Mind you, I'm not really vested in how Python *should* handle > backslashes one way or the other, but I am glad it has rules that it > follows for consitent results, and I don't have to break out a byte-code > editor to find out what's in my string litera

Re: Unrecognized escape sequences in string literals

2009-08-11 Thread Douglas Alan
I wrote: > But you're right, it's too late to change this now. P.S. But if it weren't too late, I think that your idea to have "\s" be the escape sequence for a backslash instead of "\\" might be a good one. |>ouglas -- http://mail.python.org/mailman/listinfo/python-list

Re: Unrecognized escape sequences in string literals

2009-08-12 Thread Douglas Alan
On Aug 12, 3:08 am, Steven D'Aprano wrote: > On Tue, 11 Aug 2009 14:48:24 -0700, Douglas Alan wrote: > > In any case, my argument has consistently been that Python should have > > treated undefined escape sequences consistently as fatal errors, > > A reasonable positio

Re: Unrecognized escape sequences in string literals

2009-08-12 Thread Douglas Alan
On Aug 12, 3:36 am, Steven D'Aprano wrote: > On Tue, 11 Aug 2009 13:20:52 -0700, Douglas Alan wrote: > > My "Annotated C++ Reference Manual" is packed, and surprisingly in > > Stroustrup's Third Edition, there is no mention of the issue in the > > entire

Re: Unrecognized escape sequences in string literals

2009-08-12 Thread Douglas Alan
On Aug 12, 5:32 am, Steven D'Aprano wrote: > That problem basically boils down to a deep-seated > philosophical disagreement over which philosophy a > language should follow in regard to backslash escapes: > > "Anything not explicitly permitted is forbidden" > > versus > > "Anything not explicitl

Re: Unrecognized escape sequences in string literals

2009-08-13 Thread Douglas Alan
On Aug 12, 7:19 pm, Steven D'Aprano wrote: > You are making an unjustified assumption: \y is not an error. You are making in an unjustified assumption that I ever made such an assumption! My claim is and has always been NOT that \y is inately an error, but rather that treating unrecognized esca

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-14 Thread Douglas Alan
On Aug 14, 12:17 pm, Grant Edwards wrote: > On 2009-08-14, Steven D'Aprano wrote: > > On Fri, 14 Aug 2009 07:07:31 -0700, Aahz wrote: > >> "I saw `cout' being shifted "Hello world" times to the left and stopped > >> right there."  --Steve Gonedes > > > Assuming that's something real, and not i

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-15 Thread Douglas Alan
On Aug 14, 10:25 pm, Dave Angel wrote: > Benjamin Kaplan wrote: > > On Fri, Aug 14, 2009 at 12:42 PM, Douglas Alan wrote: > >> P.S. Overloading "left shift" to mean "output" does indeed seem a bit > >> sketchy, but in 15 years of C++ programming,

Re: Unrecognized escape sequences in string literals

2009-08-15 Thread Douglas Alan
On Aug 14, 1:55 pm, Steven D'Aprano wrote: > Douglas, you and I clearly have a difference of opinion on > this. Neither of us have provided even the tiniest amount > of objective, replicable, reliable data on the > error-proneness of the C++ approach versus that of > Python. The supposed superior

Re: Python or ActionScript 3.0

2009-08-15 Thread Douglas Alan
On Aug 15, 5:32 pm, Jaseem wrote: > Is python similar to actionscript 3.0 For some very rough sense of "similar" it might be, but not really. > Which is better to create a rich gui internet application? > Is it AS 3.0 with flex or python with its GUI libs? Python doesn't run in your typical we

Re: Python- javascript

2009-08-15 Thread Douglas Alan
On Aug 15, 8:02 pm, Mike Paul wrote: > I'm trying to scrap a dynamic page with lot of javascript in it. > Inorder to get all the data from the page i need to access the > javascript. But i've no idea how to do it. I'm not sure exactly what you are trying to do, but scraping websites that use a l

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-15 Thread Douglas Alan
On Aug 15, 10:19 pm, Steven D'Aprano wrote: > On Sat, 15 Aug 2009 13:01:43 -0700, Douglas Alan wrote: > > P.S. I find it strange, however, that anyone who is not okay with > > "abusing" operator overloading in this manner, wouldn't also take > > umbra

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-15 Thread Douglas Alan
On Aug 16, 1:05 am, Steven D'Aprano wrote: > On Sat, 15 Aug 2009 20:00:23 -0700, Douglas Alan wrote: > > So, as far as I can tell, Python has no real authority to throw stones > > at C++ on this little tiny particular issue. > I think you're being a tad over-defensiv

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-16 Thread Douglas Alan
On Aug 16, 4:22 am, Steven D'Aprano wrote: > I don't like normal assignment. After nearly four decades of mathematics > and programming, I'm used to it, but I don't think it is especially good. > It confuses beginners to programming: they get one set of behaviour > drilled into them in maths clas

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-16 Thread Douglas Alan
On Aug 16, 4:48 am, Erik Max Francis wrote: > Douglas Alan wrote: > > Personally, my favorite is Lisp, which looks like > > >    (set! y (+ y 1)) > > For varying values of "Lisp."  `set!` is Scheme. Yes, I'm well aware! There are probably as many

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-16 Thread Douglas Alan
On Aug 16, 8:45 am, MRAB wrote: > No, APL is strictly right-to-left. > >      -> x > > means "goto x". > > Writing to the console is: > >      [] <- myVar > > Reading from the console is: > >      myVar <- [] Ah, thanks for the correction. It's been 5,000 years since I used APL! |>ouglas -- ht

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-16 Thread Douglas Alan
On Aug 16, 6:18 am, Steven D'Aprano wrote: > On Sun, 16 Aug 2009 01:41:41 -0700, Douglas Alan wrote: > > I would definitely not like a language that obscures assignment by > > moving it over to the right side of lines. > One could argue that left-assigned-from-right

Re: Saving (unusual) linux filenames

2010-08-31 Thread Alan Meyer
a comma\,." However, because the comma won't appear at all in the URL-encoded version, it has the virtue of still allowing you to split on commas. You must of course also URL encode the '%' as %25, e.g., "Here is a comma (%2C) and this (%2C) is a percent sign." Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: Arguments from the command line

2010-09-06 Thread Alan Gauld
; as the commit name) Take a look at the Talking to the User topic in my tutorial which has a section on reading command line arguments. Interestingly, most of the queries I get on that section are from GUI users who don't understand the concept of command line arguments! :-) -- Alan G

Re: Commercial or Famous Applicattions.?

2010-11-08 Thread Alan Gauld
here. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ -- http://mail.python.org/mailman/listinfo/python-list

Re: web hosting, first hand experiences?

2011-07-03 Thread Alan Harris-Reid
and they know a huge amount about Python web applications. Nothing seems to be too much trouble for them. They also provide a 60-day money-back guarantee, so you can try-before-you-buy. Best wishes, Alan Harris-Reid --

Re: py to exe converter

2011-03-21 Thread Alan Harris-Reid
On 19:59, PATRICIA MEDINA wrote: I know there is a converter for python 2.x to executable file, but is there one for python 3.x yet? I use cx_Freeze without any problems (//cx-freeze.sourceforge.net/) HTH Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: py to exe converter

2011-03-21 Thread Alan Harris-Reid
According to //sourceforge.net/projects/py2exe/files/, the latest version only goes as far as Python2.5 :-( Alan On 21/03/2011 19:47, Santoso Wijaya wrote: There's also py2exe: http://www..py2exe.org/

Re: Jargons of Info Tech industry

2005-08-25 Thread Alan J. Flavell
On Thu, 25 Aug 2005, Mike Schilling wrote: [Off Topic discussion of netiquette, seen on comp.lang.perl.misc:] > Gosh, if you say they should be, there's no point trying to have an > intelligent discussion, is there? Discussion about netiquette on any of these cross-posted groups cannot by defi

Re: dot products

2004-12-20 Thread Alan G Isaac
[Rahul]. > I want to compute dot product of two vectors stored as lists a and b.a > and b are of the same length from scipy import dot ans=dot(a,b) This times faster than the alternatives I have seen mentioned so far, given scipy. Cheers, Alan Isaac -- http://mail.python.org/mailman/li

Re: dot products

2004-12-20 Thread Alan G Isaac
"Alan G Isaac" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > This times faster than the alternatives I have seen mentioned so far, > given scipy. Actually, since I am new to 'timeit', I probably should check that I am not overlooking something. Es

Re: Is this a good use for lambda

2004-12-20 Thread Alan G Isaac
n. Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a good use for lambda

2004-12-21 Thread Alan G Isaac
issue is valid, of course. But then, it has been one of the standard justifications for lambda. Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Brief Code Review Please - Learning Python

2015-12-06 Thread Jason Alan Smith
Hello List Members, I am beginning to learn Python, and I've adapted some code from Google into the function below. I'm also looking at the PEP 8 style guide. I'd appreciate a brief code review so I can start this journey off on a solid foundation. :) * I've already changed my editor f

Brief Code Review Please - Learning Python

2015-12-06 Thread Jason Alan Smith
Hello List Members, I am beginning to learn Python, and I've adapted some code from Google into the function below. I'm also looking at the PEP 8 style guide. I'd appreciate a brief code review so I can start this journey off on a solid foundation. :) * I've already changed my editor f

Re: how do "real" python programmers work?

2006-01-13 Thread Alan J. Salmoni
n Fortran, the interactive nature can make statistical analysis quicker. All the best! Alan. -- http://mail.python.org/mailman/listinfo/python-list

handling many default values

2006-11-10 Thread Alan G Isaac
(self,**kwargs): #set lots of default values ... #set the deviations from defaults self.__dict__.update(kwargs) Is this a reasonable approach overall? (Including the last line.) Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: Fredrik Lundh [was "Re: explicit self revisited"]

2006-11-12 Thread Alan G Isaac
On Sun, 12 Nov 2006 02:14:32 -0500, Doug <[EMAIL PROTECTED]> wrote: > I was going to link to > a definition of FUD to show I really meant to use that term. Oooh. If you had just mentioned your dyslogia, it would have saved us all some time. Thanks! Alan -- http://mail.python.org/mail

Re: Programmatically finding "significant" data points

2006-11-14 Thread Alan J. Salmoni
If the order doesn't matter, you can sort the data and remove x * 0.5 * n where x is the proportion of numbers you want. If you have too many similar values though, this falls down. I suggest you check out quantiles in a good statistics book. Alan. Peter Otten wrote: > erikcw wrote:

Re: The Python Papers Edition One

2006-11-27 Thread Alan J. Salmoni
These are two I can think of but there must be more. Any suggestions? I think that this is great work guys - I'll see if I can take some time to submit some of the code I developed a few years ago. All the best! Alan Łukasz Langa wrote: > Fredrik Lundh: > > Tennessee Lee

Looking for an interpreter that does not request internet access

2007-06-25 Thread James Alan Farrell
also because I feel it unsafe. Can anyone recommend an interpreter that does not access the internet when it starts (or when it is running, unless I specifically write a program that causes it to do so, so as a browser)? James Alan Farrell -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for an interpreter that does not request internet access

2007-06-28 Thread James Alan Farrell
On Tue, 26 Jun 2007 03:50:11 -, John Roth <[EMAIL PROTECTED]> wrote: >On Jun 25, 7:07 pm, James Alan Farrell <[EMAIL PROTECTED]> wrote: >> Hello, >> I recently installed new anti-virus software and was surprised the >> next time I brought up IDLE, that it wa

Re: Looking for an interpreter that does not request internet access

2007-06-28 Thread James Alan Farrell
On Mon, 25 Jun 2007 20:41:59 -0500, Robert Kern <[EMAIL PROTECTED]> wrote: >James Alan Farrell wrote: >> Hello, >> I recently installed new anti-virus software and was surprised the >> next time I brought up IDLE, that it was accessing the internet. >> &g

Re: bool behavior in Python 3000?

2007-07-10 Thread Alan G Isaac
produces ints. Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

comparison with None

2007-04-18 Thread Alan G Isaac
>>> None >= 0 False >>> None <= 0 True Explanation appreciated. Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: change of random state when pyc created??

2007-05-09 Thread Alan G Isaac
his suggests that an explicit warning is warranted. Cheers, Alan Isaac PS I know ordered dicts are under discussion; what about ordered sets? -- http://mail.python.org/mailman/listinfo/python-list

Re: change of random state when pyc created??

2007-05-09 Thread Alan G Isaac
uot;"" Even this does not tell me that if I use a specified implementation that my results can vary from run to run. That is, it still does not communicate that rerunning an *unchanged* program with an *unchanged* implementation can produce a change in results. Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

vocab question

2007-04-13 Thread Alan G Isaac
ference is fine & helpful, as long as its not an entire course on BNF.) Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: vocab question

2007-04-13 Thread Alan G Isaac
Steven Bethard wrote: > As far as I > know, there's no official term for the first four elements of a class > statement. I'd probably call it the class statement header. That will have to do for now. Thanks! Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: pairs from a list

2008-01-23 Thread Alan G Isaac
id not occur to me that there might be an interesting distinction among these cases for the question of how to get sequential pairs from a list. How would one draw these distinctions in this case? Thanks, Alan Isaac PS Just for context, the sequential pairs were needed in a simulation, but

Re: Python printing!

2008-01-23 Thread Alan G Isaac
SMALLp wrote: > Hy. How to use printer in python. http://tgolden.sc.sabren.com/python/win32_how_do_i/print.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Formatting arrays using myarrayy.tolist()

2008-02-06 Thread Alan G Isaac
http://www.scipy.org/Cookbook/InputOutput> hth, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Python 3: range objects cannot be sliced

2009-01-16 Thread Alan G Isaac
Is the behavior below expected? Documented? (The error msg is misleading.) Thanks, Alan Isaac >>> x = range(20) >>> s = slice(None,None,2) >>> x[s] Traceback (most recent call last): File "", line 1, in TypeError: sequence index must be integer, not 

Re: Python 3: range objects cannot be sliced

2009-01-16 Thread Alan G Isaac
On 1/16/2009 1:15 PM Paul Rubin apparently wrote: range is an iterator now. Try itertools.islice. Well yes, it behaves like xrange did. But (also like xrange) it supports indexing. (!) So why not slicing? I expected this (to keep it functionally more similar to the old range). Alan Isaac

Re: Python 3: range objects cannot be sliced

2009-01-16 Thread Alan G Isaac
It is documented: http://docs.python.org/3.0/library/stdtypes.html#sequence-types-str-bytes-bytearray-list-tuple-range -- http://mail.python.org/mailman/listinfo/python-list

tuple methods: documentation missing

2009-01-16 Thread Alan G Isaac
pes support the following methods: index() and count()." Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: tuple methods: documentation missing

2009-01-16 Thread Alan G Isaac
Alan G Isaac wrote: http://docs.python.org/3.0/library/stdtypes.html#sequence-types-str-bytes-bytearray-list-tuple-range I see no mention of the tuple methods? Right after the paragraph "Most sequence types support the following operations." it seems appropriate to have one sta

Re: tuple methods: documentation missing

2009-01-17 Thread Alan G Isaac
On 1/16/2009 6:44 PM Terry Reedy apparently wrote: http://bugs.python.org/issue4966 Is this another lacuna or am I overlooking it? I cannot find the 3.0 documentation of string formatting with the ``%`` operator. Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Python 3: exec arg 1

2009-01-17 Thread Alan G Isaac
ec`` cannot handle a TextIOWrapper? Bottom line: has ``execfile(filename)`` really become ``exec(open(filename).read())``? Is this a good thing? Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3: exec arg 1

2009-01-17 Thread Alan G Isaac
Alan G Isaac wrote: Is it intentional that ``exec`` cannot handle a TextIOWrapper? Bottom line: has ``execfile(filename)`` really become ``exec(open(filename).read())``? Is this a good thing? On 1/17/2009 4:20 PM Terry Reedy apparently wrote: Yes. Yes. OK. Why? Alan Isaac -- http

Re: Python 3: exec arg 1

2009-01-18 Thread Alan G Isaac
Alan G Isaac wrote: Is it intentional that ``exec`` cannot handle a TextIOWrapper? Bottom line: has ``execfile(filename)`` really become ``exec(open(filename).read())``? Is this a good thing? On 1/17/2009 4:20 PM Terry Reedy apparently wrote: Yes. Yes. Alan G Isaac wrote: OK. Why

Re: string formatting documentation

2009-01-19 Thread Alan G Isaac
}}{0}'.format('wtf?').format('wtf?') to '%%s%s' % 'wtf?' % 'wtf?' According to PEP 4, "obsolete" means "deprecated". So the compact, simple, and useful old string formatting is really deprecated? Ouch. Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: string formatting documentation

2009-01-19 Thread Alan G Isaac
On Mon, 19 Jan 2009 14:44:01 +, Alan G Isaac wrote: we are supposed to prefer '{0:>10}'.format('wtf?') to '%10s' % 'wtf?' and '{{0}}{0}'.format('wtf?').format('wtf?') to '%%s%s' % 'wtf?' % 'w

Re: string formatting documentation

2009-01-19 Thread Alan G Isaac
strings. In 3.0, only the str type (text strings with Unicode support) supports this method; the bytes type does not. The plan is to eventually make this the only API for string formatting, and to start deprecating the % operator in Python 3.1. Thanks! Alan Isaac -- http://mail.python.org/mailman

Re: string formatting documentation

2009-01-19 Thread Alan G Isaac
On 1/19/2009 5:03 PM Terry Reedy apparently wrote: I have not seen 3.0 emit a % deprecation warning. Point taken. But the vocabulary of PEP 4 suggests that "obsolete" and "deprecated" are synonyms, and PEP 4 lists obsolete modules without deprecation warnings.

Re: Python 3: exec arg 1

2009-01-20 Thread Alan G Isaac
On 1/18/2009 9:36 AM Alan G Isaac apparently wrote: I do not much care about the disappearance of ``execfile``. I was asking, why is it a **good thing** that ``exec`` does not accept a TextIOWrapper? Or is it just not implemented yet? What is the gain from this particular backwards

Re: Python 3: exec arg 1

2009-01-22 Thread Alan G Isaac
On 1/20/2009 3:53 PM Rob Williscroft apparently wrote: http://bugs.python.org/issue1762972 (*) Useful. Thanks. Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3: range objects cannot be sliced

2009-01-25 Thread Alan G Isaac
On 1/16/2009 3:13 PM Alan G Isaac apparently wrote: > It is documented: > http://docs.python.org/3.0/library/stdtypes.html#sequence-types-str-bytes-bytearray-list-tuple-range But then again, the opposite is also documented, since `range` is a sequence type. Quoting: Sequence

Re: print formating for matrix/table

2009-01-27 Thread Alan G Isaac
You could try SimpleTable: http://code.google.com/p/econpy/source/browse/trunk/utilities/text.py fwiw, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

slicings: 3 questions

2009-01-29 Thread Alan G Isaac
kes them "internal"? http://docs.python.org/3.0/library/stdtypes.html#internal-objects Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: slicings: 3 questions

2009-01-29 Thread Alan G Isaac
On Thu, Jan 29, 2009 at 10:01 AM, Alan G Isaac wrote: 1. I seem not to understand something obvious at http://docs.python.org/3.0/reference/expressions.html#slicings (I assume I'm just not reading this right.) What is an example of a slicing using a "slice_list"? On 1/29/200

Re: slicings: 3 questions

2009-01-29 Thread Alan G Isaac
On Thu, Jan 29, 2009 at 10:01 AM, Alan G Isaac wrote: 2. It seems that slice objects and range objects are awfully similar in many ways. Is this "appearance only", or was there any discussion of unifying them? Curious for insight... On 1/29/2009 1:37 PM Chris Rebert appare

Re: slicings: 3 questions

2009-01-29 Thread Alan G Isaac
ng that a legitimate slice object was being created. Thanks! Alan -- http://mail.python.org/mailman/listinfo/python-list

<    4   5   6   7   8   9   10   11   12   13   >