Good evening,
I would like to ask for help regarding Python installation ,
I'm a beginner and I would like to challenge myself to start coding using
Python language , but unfortunately I'm having problems while installing it ,
I used python.org to install the latest Windows version of Python (
you wanted to require keyword-only arguments to have default values,
that would require adding an additional check, which would be a
syntactical change.
-- Talin
--
http://mail.python.org/mailman/listinfo/python-list
(Note: PEPs in the 3xxx number range are intended for Python 3000,
however this particular PEP may be backported if there is support for
it.)
PEP: 3102
Title: Keyword-Only Arguments
Version: $Revision: 46053 $
Last-Modified: $Date: 2006-05-19 22:23:44 -0700 (Fri, 19 May 2006) $
Author: Talin
OK that worked really well. In particular, the "lastindex" property of
the match object can be used to tell exactly which group matched,
without having to sequentially search the list of groups.
In fact, I was able to use your idea to cobble together a poor man's
lexer which I am calling "reflex"
I've run in to this problem a couple of times. Say I have a piece of
text that I want to test against a large number of regular expressions,
where a different action is taken based on which regex successfully
matched. The naive approach is to loop through each regex, and stop
when one succeeds. How
Alex Martelli wrote:
> for x in whatever_other_iterable: yield x
>
> into (say)
>
> yield from whatever_other_iterable
>
> is minute and not worth changing the syntax (even though something like
> 'yield from' would mean no keywords would need to be added).
I agree that the improvement is minor,
I've been using generators to implement backtracking search for a while
now. Unfortunately, my code is large and complex enough (doing
unification on math expressions) that its hard to post a simple
example. So I decided to look for a simpler problem that could be used
to demonstrate the technique
Well, the Matrix matching function now works as described above:
@Arity( MatchMatrix( MatchInteger.n, MatchInteger.n ).x )
Now I am trying to see if I can write the rules for Derviative()...
--
http://mail.python.org/mailman/listinfo/python-list
Yes, it was a typo.
Even thought the function has not yet been bound to the name
"Factorial" when it calls the decorator, the function's __name__
attribute is set to it, so I use that to look up the name of the
generic.
Here''s the source for Arity:
def Arity( *pattern ):
"""A function decor
Been playing around a bit more with developing my python inference
engine, and I thought it might be of general interest (plus, I am
finding the criticism useful).
My original goal was to brush up on my math skills. Now, I've long felt
that the best way to learn a language *thoroughly* is to write
I like the decorator idea. Unfortunately, the version of Python I am
using is pre-decorator, and there are various issues involved in
upgrading on Mac OS X (due to the built-in Python 2.3 being used by the
OS itself.) I'll have to look into how to upgrade without breaking too
much...
Some further
I've been reading about how "lambda" is going away in Python 3000 (or
at least, that's the stated intent), and while I agree for the most
part with the reasoning, at the same time I'd be sad to see the notion
of "anonymous functions" go - partly because I use them all the time.
Of course, one can
Thanks for all the respones :) I realized up front that this suggestion
is unlikely to gain approval, for reasons eloquently stated above.
However, there are still some interesting issues raised that I would
like to discuss.
Let me first respond to a few of the comments:
>What's the difference be
Although I realize the perils of even suggesting polluting the Python
namespace with a new keyword, I often think that it would be useful to
consider defining an operator for testing whether or not an item is a
member of a category.
Currently, we have the 'in' operator, which tests for membership
I'm finding that a lot of places within my code, I want to return the
output of a generator from another generator. Currently the only method
I know of to do this is to explicitly loop over the results from the
inner generator, and yield each one:
for x in inner():
yield x
is: Do I want to continue using a subclass of dict
for this, or something more exotic?
4) I've seen a couple of code examples on the net where people use the
idiom "lambda x: (for x in [])" to represent a "null" iterator, i.e. one
that immediately terminates. H
27;is' keyword to do type comparisons a la
C# (e.g. "if x is list:") ?
-- Talin
--
http://mail.python.org/mailman/listinfo/python-list
d + x
yield x + head
return
-- Talin
--
http://mail.python.org/mailman/listinfo/python-list
18 matches
Mail list logo