Re: [Python-Dev] Re: Simulating shells (was Re: Changing the Division Operator -- PEP 238, rev 1.12)
Paul Prescod
Michael Hudson wrote:
...
At one point I was going to use the same bits as are used in the code.co_flags field, which was probably where the bitfield idea originated.
By "keyword arguments" do you mean e.g:
compile(source, file, start_symbol, generators=1, division=0)
? I think that would be mildly painful for the one use I had in mind (the additions to codeop), and also mildly painful to implement.
Sorry, could you elaborate on why this is painful to use and implement?
Well, I don't know in detail how keyword arguments work from the C side. Your suggestion turns a roughly 4 line change I knew exactly how to do into a 20-30 line change I'd have to work on. I only said "mildly painful". The awkwardness of use would just mean using **, yes.
Considering the availability of **args, the code above looks to me like syntactic sugar for the code below:
compile(source, file, start_symbol, {'generators':1, 'division':0})
Well yes, but I think the latter is closer to what one means, which is to say passing a (i.e. one) set of options.
would be better from my point of view. I think this is a bit of a propeller-heads-only feature, to be honest, so I'm not that inclined to worry aobut the API.
I would just like to see an end to the convention of using bitfields in Python everywhere. You're just my latest target.
Fair enough. I've probably been corrupted by C on this one.
Python is not a really great bit-manipulation language!
<aside>Augmented assignment helps a *lot* here!</aside> At any rate, the fact that I'd temporarily forgotten about the existence of Jython is the more serious blunder... Cheers, M. -- . <- the point your article -> . |------------------------- a long way ------------------------| -- Cristophe Rhodes, ucam.chat
participants (1)
-
Michael Hudson