Hi all.
I have custom resource editor and wish python to be scripting language
in it. But I don't want to lose ability of debugging which I currently
have implementing all logic in C++.
So the question is: Is there suitable library for simple python gui
debugger, or may be there are some other
Hi.
It would be great to be able to reverse usage/definition parts in
haskell-way with "where" keyword. Since Python 3 would miss lambda, that
would be extremly useful for creating readable sources.
Usage could be something like:
>>> res = [ f(i) for i in objects ] where:
>>> def f(x):
>>>
Bengt Richter wrote:
It also allows the necessary but uninteresting setup for an expression
to be moved "out of the way", bringing the expression that does the real
work to prominence.
Killer app for this keyword:
class C(object):
x = property(get, set) where:
def get(self):
return "Sill
Nick Coghlan wrote:
It also allows the necessary but uninteresting setup for an expression
to be moved "out of the way", bringing the expression that does the
real work to prominence.
Killer app for this keyword:
class C(object):
x = property(get, set) where:
def get(self):
return "Si
Carl Banks wrote:
As a compromise, howabout:
. if m > 20 where m=something():
. do_something_with(m)
That's good, but first idea was about 'where' block that contains any
expressions, that we need, for example function definition. the syntax
you proposed has same problems as 'lambda'.
The ma
Peter Hansen wrote:
>>> print words[3], words[5] where:
>>> words = input.split()
- defining variables in "where" block would restrict their visibility
to one expression
Then your example above doesn't work... print takes a
sequence of expressions, not a tuple as you seem to think.
sorry, I
Paul Rubin wrote:
You mean I can't say
# compute sqrt(2) + sqrt(3)
x = (sqrt(a) where:
a = 2.) \
+ sqrt (a) where:
a = 3.
No, I'd prefer to not embed 'where' into expression.
--
http://mail.python.org/mailman/listinfo/python-list
Nick Coghlan wrote:
Current:
assignment_stmt ::= (target_list "=")+ expression_list
augmented_assignment_stmt ::=target augop expression_list
New:
assignment_stmt ::= (target_list "=")+ expression_list [where_clause]
augmented_assignment_stmt ::=target augop expression_list
[where_
Nick Coghlan wrote:
sorry, I used "expression" carelessly.
I mean that
>>> print words[3], words[5]
is a single expression
(and that would be in Python 3, when print would be subtituted with
write()/writeln()).
'statement' is the appropriate word in Python's grammar.
thanks )
And I don't think we
Paul Rubin wrote:
What would be the advantage of that over this?
. x = sqrt(a) + sqrt(b) where:
. a = 2.0
. b = 3.0
The idea of "where" is to allow re-using variable names instead of
having to keep track of which ones are in use. I just tried to give a
very simple example of how you might
Alex Martelli wrote:
Indeed, the fact that many MANY more people are familiar with SQL than
with Haskell may be the strongest practical objection to this choice of
syntax sugar; the WHERE clause in an SQL SELECT has such wildly
different semantics from Haskell's "where" that it might engender huge
And about examples for usage "where" keyword
reading http://manatee.mojam.com/~skip/python/fastpython.html I
understand that almost every example should use that keyword =)
--
http://mail.python.org/mailman/listinfo/python-list
Nyx42 wrote:
Second program (pygame + pyopenGL):
Py2exe can't import OpenGL.GL and OpenGL.GLU :(
about that, may be names of imports are generated in runtime, so you can
try to specify them directly
options = {"py2exe": {"packages": ["OpenGL.GL","OpenGL.GLU"]}},
--
http://mail.python.org/mailman/
Hi.
How does GvR suggestions on removing map(), reduce(), filter() correlate
with the following that he wrote himself (afaik):
http://www.python.org/doc/essays/list2str.html
?
--
http://mail.python.org/mailman/listinfo/python-list
Paul Rubin wrote:
How does GvR suggestions on removing map(), reduce(), filter()
correlate with the following that he wrote himself (afaik):
http://www.python.org/doc/essays/list2str.html
I think that article was written before list comprehensions were added
to Python.
anyway list comprehensions ar
Steve Holden wrote:
Andrey Tatarinov wrote:
Hi.
How does GvR suggestions on removing map(), reduce(), filter()
correlate with the following that he wrote himself (afaik):
http://www.python.org/doc/essays/list2str.html
>
And note that the summary in the conclusiogn BEGINS with "Rule num
Nick Coghlan wrote:
And about examples for usage "where" keyword
reading http://manatee.mojam.com/~skip/python/fastpython.html I
understand that almost every example should use that keyword =)
I suspect polluting the outer namespace would still be faster, since
Python wouldn't have to create the
Nick Coghlan wrote:
Abstract
The proposal is to add the capacity for statement local namespaces to
Python. This allows a statement to be placed at the current scope, while
the statement's 'setup code' is indented after the statement::
with:
I think using 'with' keyword can c
rbt wrote:
If I have a Python list that I'm iterating over and one of the objects
in the list raises an exception and I have code like this:
try:
do something to object in list
except Exception:
pass
Does the code just skip the bad object and continue with the other
objects in the list,
Nick Coghlan wrote:
Semantics
-
The code::
with:
translates to::
def unique_name():
unique_name()
Bleh. Not only was my proposed grammar change wrong, my suggested
semantics are wrong, too.
Raise your hand if you can see the problem with applying the above
semantics to the
So of the four keywords suggested so far ('where', 'with', 'in',
'using'), I'd currently vote for 'using' with 'where' a fairly close
second. My vote goes to 'using' because it has a fairly clear meaning
('execute the statement using this extra information'), and doesn't have
the conflicting ex
Miki Tebeka wrote:
So the question is: Is there suitable library for simple python gui
debugger, or may be there are some other techniques for debugging
embedded scripts?
What I usually do is add
from pdb import set_trace
in the embedded module somewhere and then add a call to set_trace
(brea
Steve Holden wrote:
Nick Coghlan wrote:
Luis M. Gonzalez wrote:
Hi there,
I'd like to know if there is a way to add and else condition into a
list comprehension. I'm sure that I read somewhere an easy way to do
it, but I forgot it and now I can't find it...
for example:
z=[i+2 for i in range(10) if
Nick Coghlan wrote:
Nick Coghlan wrote:
Semantics
-
The code::
with:
translates to::
def unique_name():
unique_name()
I've come to the conclusion that these semantics aren't what I would
expect from the construct. Exactly what I would expect can't really be
expressed in cur
Nick Coghlan wrote:
# Anonymous functions
use res:
def f(x):
d = {}
exec x in d
return d
in:
res = [f(i) for i in executable]
as for me, I found construction "use :" unobvious and confusing.
Also there is great possibility to forget some of variables names.
I think that syntax
wher
nell wrote:
First the "10x in advance" means thanks in advance.
The main importance of protecting my code is to save headache of
customers that want to be smart and change it and then complain on bugs
also you can try to use py2exe
--
http://mail.python.org/mailman/listinfo/python-list
Rahul wrote:
I want to compute dot product of two vectors stored as lists a and b.a
and b are of the same length.
one simple way is
sum(a[i]*b[i] for i in range(len(a)))
btw, imho the most "Pythonic" would be:
sum(i*j for (i,j) in zip(a,b))
--
http://mail.python.org/mailman/listinfo/python-list
27 matches
Mail list logo