Re: Securing a future for anonymous functions in Python

2005-01-11 Thread Carl Banks
) print i1, print sqrt(i1) would print 4 2 3 and then blow up with a NameError. LIke it or not, it doesn't seem as strained as trying to pile more gimmicks on Python expressions. Indeed. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: complex numbers

2005-01-12 Thread Carl Banks
It's me wrote: The world would come to a halt if all of a sudden nobody understands complex numbers anymore. :-) Actually, it would oscillate out of control. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: python and macros (again) [Was: python3: 'where' keyword]

2005-01-14 Thread Carl Banks
a European phrase so searching for it in English is futile). The closest thing I found was Or is it another case of Belgian logic, where you believe it because theres no evidence or motive whatsoever? Maybe it's Belgain logic, as opposed to Dutch logic. -- CARL BANKS -- http

Re: Zen of Python

2005-01-19 Thread Carl Banks
. :) The gist of Flat is better than nested is be as nested as you have to be, no more, because being too nested is just a mess. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: Zen of Python

2005-01-19 Thread Carl Banks
. Again, Python chose wisely. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: Funny Python error messages

2005-01-21 Thread Carl Banks
stating an absurdity. I'd say it's actually a nice bit of subtlety. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: Another scripting language implemented into Python itself?

2005-01-24 Thread Carl Banks
programming language. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: Another scripting language implemented into Python itself?

2005-01-25 Thread Carl Banks
Roy Smith wrote: Carl Banks [EMAIL PROTECTED] wrote: Imbed EMBED. My apologies for being sloppy. And with an initial capital, so it just jumps off the page at you :-) Ok. Prescriptive language isn't normally my cup of tea, but there's always something. And usually it's very silly

Re: what's OOP's jargons and complexities?

2005-01-28 Thread Carl Banks
and his advice is not good, and that he appears that his posts are just trolling in disguise. (Or, you could do what I do when I feel a need to reply: follow-up with a Flame Warriors link. For Xah, it would probably be this: http://tinyurl.com/4vor3 ) -- CARL BANKS -- http://mail.python.org

Re: variable declaration

2005-01-31 Thread Carl Banks
be why, in practice, I don't seem to encounter the misspelling-a-rebinding error too often, even though I'm prone to spelling errors. Perhaps, if someone runs into this error a lot, the problem is not with Python, but with their tendency to rebind variables too much? Just a thought. -- CARL

Re: remove duplicates from list *preserving order*

2005-02-03 Thread Carl Banks
, speed is probably more important than memory, so I'm leaning towards the second or third implementation. from itertools import * [ x for (x,s) in izip(iterable,repeat(set())) if (x not in s,s.add(x))[0] ] that's-one-ambiguously-better-solution-ly yr's, -- CARL BANKS -- http://mail.python.org

Re: A ListComp that maintains its own state (Was: Re: turing machine in an LC)

2005-02-08 Thread Carl Banks
] ] ;) There is a way to even avoid repeat if you're feeling EVIL. [ x for x in iterable if x not in locals()['_[1]'].__self__ ] Turning this into a turing machine is left as an exercise. The recipe in effect: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/204297 -- CARL BANKS -- http

Re: A ListComp that maintains its own state

2005-02-09 Thread Carl Banks
[-1] * symbol) or state[-1] for state in [[1]] for symbol in range(1, 10)] [1, 2, 6, 24, 120, 720, 5040, 40320, 362880] Nope, that's just too convenient. Now I'm going to end up doing this all the time. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: negative integer division

2005-02-09 Thread Carl Banks
circumstance. The circumstance is that an archaic language designed to be hand-optimized and has unfortuntate importabilities has ever became everyone's shizzle. (I'm hating C today; I was asked to write something in C and I can't use anything else because someone has to use to code.) -- CARL BANKS

Re: lambda and for that matter goto not forgetting sugar

2005-02-10 Thread Carl Banks
in the language? Mr. Turing is rolling in his grave -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: custom classes in sets

2005-02-14 Thread Carl Banks
MD5 to decide if a file has been modified.) -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: import statement / ElementTree

2005-11-04 Thread Carl Banks
do this: from elementtree import ElementTree Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Curses programming, threads?

2004-12-03 Thread Carl Banks
to the database in a subthread, and have it set a global flag just before it exits. Animate in a loop in the main thread, checking the flag every iteration, and when it's true, you're done. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: 2D array

2004-12-08 Thread Carl Banks
with the parentheses. Because of this, I don't use the parentheses for things like multidimensional arrays. I tend to use the parentheses whenever the index is some sort of atomic value, however. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I do this? (eval() on the left hand side)

2004-12-09 Thread Carl Banks
(__name__) setattr(mod,symbol,value) Works perfectly unless you're worried about someone modifying the built in __import__. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Carl Banks
/__getitem__ paradigm isn't versatile enough to handle this situation. In that light, I'd say checking for slices is the lesser evil. As for why list objects still use getslice--they probably shouldn't. I'd file a bug report. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Carl Banks
its type is list (or str or tuple), and only call __getitem__ if it is not (i.e., only for subclasses). I don't think that would be too bad. Subclasses would still be free to override __getslice__, but wouldn't have to. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I do this? (eval() on the left hand side)

2004-12-10 Thread Carl Banks
advantage of dict methods, which I could see being a reason to use globals() as well). -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: Civilization IV uses Python for scripting

2004-12-10 Thread Carl Banks
countries that have PERL advance but not PYTHON by 50% -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: Cool object trick

2004-12-17 Thread Carl Banks
(not to mention less typing). -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I do this? (eval() on the left hand side)

2004-12-10 Thread Carl Banks
globals() is far eviler. So I must disagree with your good-natured objection. Unless there's some practical weakness of using references that I am unaware of. -- CARL BANKS (Yes, I know eviler is not a word.) -- http://mail.python.org/mailman/listinfo/python-list

Re: Zip with a list comprehension

2004-12-10 Thread Carl Banks
Certified (tm). Having said that, you might want to consider using itertools.izip instead. It works just like zip, but returns an iterator instead of a list. Good for those length-ten-million lists you wanted to iterate side-by-side. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python

Re: lies about OOP

2004-12-14 Thread Carl Banks
projecktzero wrote: He thinks that OOP has more overhead I think he's just confusing programming with marriage. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: Cool object trick

2004-12-18 Thread Carl Banks
Bengt Richter wrote: m=type('',(),{})() Nick Coghlan wrote: Heh. Look ma, Perlython! I doubt anyone could perform such a ghastly hack so simply and straightforwardly in Perl. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: How about pure virtual methods?

2004-12-20 Thread Carl Banks
a metaclass solution to a problem, or Paul Rubin decries any aspect of Python that differs from Lisp, or Aahz asserts that the GIL isn't a significant problem in practice, or all-in-fun-of-course-ly yr's, -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: Securing a future for anonymous functions in Python

2004-12-30 Thread Carl Banks
; but in the end, the divends are small compared to improving other aspects of the language. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: Why tuples use parentheses ()'s instead of something else like 's?

2004-12-30 Thread Carl Banks
be rightfully compared with the masterpieces of millenia past. Then again, millenia past didn't have Frank Gehry (i.e., the Perl of modern architecture). -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: Optional Static Typing: Part II

2005-01-04 Thread Carl Banks
, and it's not like th BDFL to throw out keywords for things that current syntax can handle. It leads me to suspect that maybe he has something up his sleeve. Hmm. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Operating System???

2005-01-06 Thread Carl Banks
that simple is better than complex and complex is better than complicated. Java does pretty well here. C++ didn't even get complicated is better than convoluted right. There's are a ton of flaws in C++ not found in Java. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: how to extract columns like awk $1 $5

2005-01-07 Thread Carl Banks
. The title of that particular section is Emulating container types, which is not what you're doing, so it doesn't apply here. For built-in types, iterators are at work. The list iterator probably doesn't even call getitem, but accesses the items directly from the C structure. -- CARL BANKS

Re: sorting on keys in a list of dicts

2005-01-07 Thread Carl Banks
an exception. Stick the index in there, and that possibility is gone. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: python3: 'where' keyword

2005-01-08 Thread Carl Banks
. +1 -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: python3: 'where' keyword

2005-01-08 Thread Carl Banks
. This wouldn't be a problem parsing, of course, because where would be a keyword. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: python3: 'where' keyword

2005-01-08 Thread Carl Banks
Paul Rubin wrote: Carl Banks [EMAIL PROTECTED] writes: You misunderstand. BTW, Peter, I guess I should have said I misunderstand, but it can be legal if you consider it part of the statements, since it appears the author did intend it to be part of an expression. There where is not part

Re: python3: accessing the result of 'if'

2005-01-08 Thread Carl Banks
where line=f.readline(): . do_something_with(line) The main problem here (as some would see it) is that you can't do something this: . if m 20 where (def m(): a(); b()): -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: python3: accessing the result of 'if'

2005-01-08 Thread Carl Banks
Nick Coghlan wrote: Carl Banks wrote: What if the condition you wanted to test wasn't the same as the thing you want to save? In other words, how would you convert this? . where: . m = something() . if m 20: . do_something_with(m) Yeah, this problem eventually occurred

Re: python3: accessing the result of 'if'

2005-01-08 Thread Carl Banks
that expression. What I proposed was really nothing more than a convenient way to sneak an extra binding inside an elif clause. (The real point here is not to use this on if-clauses, but on elif-clauses.) -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: python3: 'where' keyword

2005-01-09 Thread Carl Banks
distinct. I like things that belong in statements to stay in statements, and things that belong in expressions to stay in expressions. And a suite, be it a def statement, a where block, or whatever, belongs in a statement, not an expression. -- CARL BANKS -- http://mail.python.org/mailman/listinfo

Re: python3: 'where' keyword

2005-01-10 Thread Carl Banks
Paul Rubin wrote: Carl Banks [EMAIL PROTECTED] writes: And a suite, be it a def statement, a where block, or whatever, belongs in a statement, not an expression. So do you approve of the movement to get rid of the print statement? Any little incremental change in Python you could make

Re: python3: 'where' keyword

2005-01-10 Thread Carl Banks
Paul Rubin wrote: Carl Banks [EMAIL PROTECTED] writes: So do you approve of the movement to get rid of the print statement? Any little incremental change in Python you could make by having or not having a print statement would be minor compared to the H-Bomb of ugliness we'd get

Re: python3: 'where' keyword

2005-01-10 Thread Carl Banks
you're trying to get me to admit something. I'm not falling for it. If you have a point to make, why don't you just make it? -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: python3: 'where' keyword

2005-01-10 Thread Carl Banks
Paul Rubin wrote: Carl Banks [EMAIL PROTECTED] writes: When I asked you to do this, it was just a rhetorical way to tell you that I didn't intend to play this game. It's plain as day you're trying to get me to admit something. I'm not falling for it. If you have a point to make, why

Re: super() and multiple inheritance

2005-12-01 Thread Carl Banks
probably overlooking some basic stuff here, Unfortunately, it doesn't appear that you are. You'll have to choose between calling base class __init__s old-style, or fiddling with their argument lists. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: super() and multiple inheritance

2005-12-01 Thread Carl Banks
it in all future code for all classes. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 308 accepted - new conditional expressions

2005-09-30 Thread Carl Banks
Reinhold Birkenfeld wrote: X if C else Y Oh well. Just about any conditional is better than no conditional. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Intersection of lists/sets -- with a catch

2005-10-18 Thread Carl Banks
(set.b) ] Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: map vs. list-comprehension

2005-06-29 Thread Carl Banks
that no language feature serves(*), so rest assured it's not going to disappear. (*) Excepting izip, of course, which is more useful than zip and probably should also be a builtin. -- Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-03 Thread Carl Banks
. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-03 Thread Carl Banks
to. A realistic list comp would look something like this in a real program: [ x**2 + y**2 for (x,y) in izip(xlist,ylist) ] Now there's no longer much advantage in conciseness for the map version (seeing that you'd have to define a function to pass to map), and this is more readable. -- CARL

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-03 Thread Carl Banks
Christopher Subich wrote: Carl Banks wrote: Listcomps et al. cannot do everything map, lambda, filter, and reduce did. Listcomps are inferior for functional programming. But, you see, functional is not the point. Streamlining procedural programs is the point, and I'd say listcomps

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-04 Thread Carl Banks
Steven D'Aprano wrote: Carl Banks wrote: The shamelessness with which you inflated the verbosity of the latter is hilarious. [snip] [ x**2 + y**2 for (x,y) in izip(xlist,ylist) ] Now there's no longer much advantage in conciseness for the map version (seeing that you'd have

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-04 Thread Carl Banks
Christopher Subich wrote: Carl Banks wrote: Christopher Subich wrote: I've heard this said a couple times now -- how can listcomps not completely replace map and filter? If you're doing heavy functional programming, listcomps are tremendously unwieldy compared to map et al

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-04 Thread Carl Banks
Christopher Subich wrote: That said, Python itself is mostly a procedural language, with the functional tools really being bolted on[1]. [etc., snip] Yeah, that's pretty much what I said in the first place. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: consistency: extending arrays vs. multiplication ?

2005-07-24 Thread Carl Banks
it now. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: Path inherits from basestring again

2005-07-24 Thread Carl Banks
it should be, and not a hack to accommodate poor code. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: zipfile decompress problems

2006-01-16 Thread Carl Banks
is that, when downloading zip files from a service of some sort, they often seem to have appended comments. (This file downloaded from www.extremezipfiles.com, blah blah blah.) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: beta.python.org content

2006-01-26 Thread Carl Banks
the no-style litmus test (i.e.,whether you can still read and understand the site with the style sheets disabled.) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: appending to a list via properties

2006-02-11 Thread Carl Banks
sneaky and not commonly useful enough to get serious consideration for the standard library. But definitely submit it to Python Cookbook: http://aspn.activestate.com/ASPN/Python/Cookbook/ Carl Banks P.S. to get rid of temporary variables while using regular lists: growing_lists = foo,qux while

Re: appending to a list via properties

2006-02-11 Thread Carl Banks
Alex Martelli wrote: Carl Banks [EMAIL PROTECTED] wrote: ... class better_list (list): tail = property(None, list.append) This is an impressive, spiffy little class. Yes, nice use of property. growing_lists = foo,qux while some_condition: for (s,x) in zip

Re: Unexpected behaviour of getattr(obj, __dict__)

2006-02-14 Thread Carl Banks
Then, id(Parrot.f) == id(Parrot.g) True your-milage-may-vary-ly yr's, Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Carl Banks
. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 354: Enumerations in Python

2006-02-28 Thread Carl Banks
Stefan Rank wrote: on 28.02.2006 07:50 Carl Banks said the following: Ben Finney wrote: This PEP specifies an enumeration data type for Python. [snip] Here's why I think it's not too useful to begin with: the benefits of the enum you describe here are pretty weak. I need

Re: C++ OpenGL rendering, wxPython GUI?

2006-02-28 Thread Carl Banks
calls. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: lambda closure question

2005-02-19 Thread Carl Banks
, that can be done too: . setattr(myclass,item,(lambda x:(lambda self: func(self,x)))(item)) You may not be aware of it, but what you're trying to do is called currying; you might want to search the Python Cookbook for recipes on it. -- CARL BANKS -- http://mail.python.org/mailman/listinfo

Re: lambda closure question

2005-02-19 Thread Carl Banks
jfj wrote: Carl Banks wrote: Ted Lilley wrote: Unfortunately, it doesn't work. It seems the closure keeps track of the variable fed to it dynamically - if the variable changes after [...] At least, that's the explanation I'm deducing from this behavior. And that's

Re: lambda closure question

2005-02-20 Thread Carl Banks
, add complexity and hurts performance. And it's a pretty common situation; a lot of recursive algorithms can make very good use of this. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: lambda closure question

2005-02-20 Thread Carl Banks
Carl Banks wrote: Say you have a suite of functions, all of which are called by some main function and each other, and all of which need to access a lot of the same data. The best, most straightforward way to do it is to have the common data be a local variable of the main function, and nest

Re: lambda closure question

2005-02-21 Thread Carl Banks
Mike Meyer wrote: Carl Banks [EMAIL PROTECTED] writes: Say you have a suite of functions, all of which are called by some main function and each other, and all of which need to access a lot of the same data. The best, most straightforward way to do it is to have the common data

Re: lambda closure question

2005-02-21 Thread Carl Banks
a point. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: assert 0, foo vs. assert(0, foo)

2005-02-23 Thread Carl Banks
, it considers that a tuple. For example, if you try this with print: print (hello,world) you see that in prints out a tuple value, rather than treating hello and world as arguments. Same thing with assert. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: any Python equivalent of Math::Polynomial::Solve?

2005-02-26 Thread Carl Banks
-ly yr's, -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: any Python equivalent of Math::Polynomial::Solve?

2005-02-27 Thread Carl Banks
Carl Banks wrote: . from Numeric import * . from LinearAlgebra import * . . def quinticroots(p): . cm = zeros((5,5),Float32) . cm[0,1] = cm[1,2] = cm[2,3] = cm[3,4] = 1.0 . cm[4,0] = -p[0] . cm[4,1] = -p[1] . cm[4,2] = -p[2] . cm[4,3] = -p[3] . cm[4,4] = -p

Re: accessor/mutator functions

2005-02-28 Thread Carl Banks
of the attribute at run time. That's what they're for. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: Scoping issue with import

2005-02-28 Thread Carl Banks
dangerously, you could do something like this from my_main_mod: import my_imported_mod my_imported_mod.myfun = myfun I don't recommend it, though, because my_imported_mod is no longer self-contained (i.e., it's a module not modular). -- CARL BANKS -- http://mail.python.org/mailman

Re: accessor/mutator functions

2005-03-01 Thread Carl Banks
Steve Holden wrote: Carl Banks wrote: Don't use getattr and setattr unless you have to construct the name of the attribute at run time. That's what they're for. Well, they are surely helpful in delegation contexts as well, or do I misunderstand? I consider that a degenerate form

Re: How would you program this?

2005-03-02 Thread Carl Banks
forcing 2 variables, which is only 81 combinations; definitely doable. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: enum question

2005-03-05 Thread Carl Banks
of it. However, Python is versatile enough that you can get something to that effect if you really need it. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: programmatically calling a function

2005-03-05 Thread Carl Banks
. Either this or gloabls() will work fine. Please don't use eval for stuff like this: that's not what it's for and it has the potential to be dangerous. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: programmatically calling a function

2005-03-05 Thread Carl Banks
Carl Banks wrote: Doug Schwarz wrote: I don't see how getattr solves the original problem. What, exactly, is the first argument to getattr? mod = __import__(__this__) That should be __import__(__name__) Silly me. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python

Re: firefox python plugin

2005-03-08 Thread Carl Banks
is write a small wrapper extension that starts the Python interpretter to do the dirty work. The dialog box may be easier done in the extension itself and not in Python subprocess. For details, google for tutorials on writing Firefox extensions. -- CARL BANKS -- http://mail.python.org/mailman

Re: Accessing files installed with distutils

2005-03-08 Thread Carl Banks
-- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: Code evaluation at function definition execution time (was Re: Compile time evaluation (aka eliminating default argument hacks))

2005-03-10 Thread Carl Banks
): . flo = open(filename) . try: f(flo) . finally: f.close() . return None . return descriptor -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: Code evaluation at function definition execution time (was Re: Compile time evaluation (aka eliminating default argument hacks))

2005-03-10 Thread Carl Banks
Carl Banks wrote: I could, however, see myself using the slightly more complicated descriptor such as this (for a wholly different reason, though): . def call_with_open_file(filename): . def descriptor(func): . flo = open(filename) . try: f(flo) . finally

Re: Python becoming less Lisp-like

2005-03-15 Thread Carl Banks
. The numerical types and two kinds of classes are examples. I'm very surprised about this, because Python is a production language, but I'm happy, too. Yeah, well that's the price you gotta pay when remedying old mistakes or restrictions. -- CARL BANKS -- http://mail.python.org/mailman/listinfo

Re: Lisp-likeness

2005-03-15 Thread Carl Banks
+ y ... return add ...closures.append(defineadder(i)) ... closures[5](1000) 1005 -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: Lisp-likeness

2005-03-16 Thread Carl Banks
Michele Simionato wrote: Carl Banks: If Python did it the way Scheme did, this would be pretty useless. But notice that Scheme has no problems whatsoever: (define (toplevel) (define a 1) (define (f) (display a)) (set! a 2) (f)) (toplevel) prints 2 the same as in Python

Re: Lisp-likeness

2005-03-16 Thread Carl Banks
Marcin 'Qrczak' Kowalczyk wrote: The issue is about the semantics of loops: whether they introduce a new variable for each iteration, or change the value of a single variable. Yes, I see what you are saying now. Good point. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python

Re: Pre-PEP: Dictionary accumulator methods

2005-03-19 Thread Carl Banks
because it's too vague; it's pretty obvious what it does as an iterator, but not as a method of dict. I could live with tally, though. As for a short name for the other one, maybe fileas or fileunder? -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Carl Banks
by indentation is a slam dunk for me. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: Stylistic question about inheritance

2005-03-31 Thread Carl Banks
seems to get along fine without the ability to do isinstance(foo,file_like_object); probably better off in the end for it. So I'd say you should generally not do it. Inheritence is for when different classes need to share functionality. -- CARL BANKS -- http://mail.python.org/mailman/listinfo

Re: StopIteration in the if clause of a generator expression

2005-04-01 Thread Carl Banks
: . pass However, I would guess the Python gods wouldn't approve of this use of StopIteration, and so would make no sacrifices to get it. Nevertheless, it seems likely to be how a list comprehension would behave in Python 3.0, so maybe we should do it. -- CARL BANKS -- http://mail.python.org

Re: Ternary Operator in Python

2005-04-01 Thread Carl Banks
operator has one operand; a binary operator has two operands; a ternary operator has three operands. Python has none built-in, Not so fast, my friend. What about the expression 0.0 a 1.0? -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

Re: Ternary Operator in Python

2005-04-01 Thread Carl Banks
Terry Reedy wrote: Carl Banks [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] A unary operator has one operand; a binary operator has two operands; ternary operator has three operands. Python has none built-in, Not so fast, my friend. What about the expression 0.0 a 1.0

Re: Unexpected timing results with file I/O

2008-02-04 Thread Carl Banks
scheduler is perhaps more efficient (for a given number of total writes) when it can combine many writes at the same time. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Why does list have no 'get' method?

2008-02-07 Thread Carl Banks
it rarely does. The Python treatment of booleans is, by far, my biggest gripe with Python. (Which, you know, is a pretty good thing to have as a biggest gripe.) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   7   8   9   10   >