On Wed, Jun 18, 2008 at 10:55:32PM -0700, Alex Martelli wrote:
- On Wed, Jun 18, 2008 at 9:58 PM, Cesare Di Mauro [EMAIL PROTECTED] wrote:
- Very very, interesting. Thanks. :)
-
- Somebody thinks that Python is unsuitable to implement a DSL: IMO your
example prove the contrary. :D
-
- As long
On Thu, Jun 19, 2008 at 4:54 AM, C. Titus Brown [EMAIL PROTECTED] wrote:
More generally, I've never understood why some people insist that
certain features make Ruby better for DSLs -- are code blocks really
that important to DSLs? Or is it just the lack of parens??
Code blocks let
At 04:54 AM 6/19/2008 -0700, C. Titus Brown wrote:
More generally, I've never understood why some people insist that
certain features make Ruby better for DSLs -- are code blocks really
that important to DSLs? Or is it just the lack of parens??
Comparison to JavaScript suggests that it's the
Very very, interesting. Thanks. :)
Somebody thinks that Python is unsuitable to implement a DSL: IMO your example
prove the contrary. :D
Cesare
In data 16 giugno 2008 alle ore 01:12:46, Alex Martelli [EMAIL PROTECTED] ha
scritto:
+1 on updating the FAQ. Maybe we could even have it notice
On Wed, Jun 18, 2008 at 9:58 PM, Cesare Di Mauro [EMAIL PROTECTED] wrote:
Very very, interesting. Thanks. :)
Somebody thinks that Python is unsuitable to implement a DSL: IMO your
example prove the contrary. :D
As long as you're willing to do the DSL within the strictures of
Python syntax,
In data 15 giugno 2008 alle ore 02:24:43, Greg Ewing [EMAIL PROTECTED] ha
scritto:
...and which should *not* be used in most cases, for
the same reason.
All those tutorials that start out with 'from something
import *' are doing a lot of harm to the impressionable
minds of new programmers,
-1 to this 'on' statement.
On Sat, Jun 14, 2008 at 10:14 PM, Nick Coghlan [EMAIL PROTECTED] wrote:
It isn't that a Pascal-with-style statement can't be achieved, it's that it
is pointless syntactic sugar in Python. Just use o =
long_complicated_object_name instead.
+1 to this reason.
--
+1 on updating the FAQ. Maybe we could even have it notice that a
read-only version of the desired semantic for 'with' is easily hacked
with the *current* semantic of 'with'...:
@contextlib.contextmanager
def readonly(anobj):
caller_globals = sys._getframe(2).f_globals
saved_globals =
Cesare Di Mauro wrote:
OK, but nobody have questioned about removing 'from something import *' just to
help noobs...
I'm not advocating removing it from the language, far
from it. I agree there are legitimate uses for it in
rare cases.
I just wish that people wouldn't use it in tutorials,
On Sat, 14 Jun 2008 04:19:30 pm Cesare Di Mauro wrote:
A with statement (such as Pascal's one) can be implemented adding a
new scope resolution on top of LEGB. So, taking the FAQ's example,
and using a new keyword (because with is already assigned to a
different kind of work):
def foo(a):
On Sat, Jun 14, 2008 at 10:16 AM, Steven D'Aprano [EMAIL PROTECTED] wrote:
I am a great fan of Pascal-style with blocks, and I'd love Python to get
something like them. But I have concluded that they simply aren't
practical in Python. Your suggestion sounds reasonable at first glance,
but it
At 08:19 AM 6/14/2008 +0200, Cesare Di Mauro wrote:
Assignament must work on the object's namespace, of course:
def foo(a):
on a:
x += 1
print x
will be equivalent to:
def foo(a):
a.x += 1
print a.x
Er, you need a syntactic disambiguation here to distinguish
attributes
In data 14 giugno 2008 alle ore 08:55:58, Martin v. Löwis [EMAIL PROTECTED]
ha scritto:
This probably belongs to python-ideas or some such, but I don't
think this approach can work. People will want to assign to local
variables in an ob block, and then be surprised that the
assignment
Cesare Di Mauro schrieb:
Also, taking the Tk example that I used, it can be changed in the following way:
on Button(self) as b:
b.text = QUIT
b.fg = red
b.command = self.quit
pack({side: left})
on Button(self) as b:
In data 14 giugno 2008 alle ore 11:03:09, Simon Cross [EMAIL PROTECTED] ha
scritto:
After having read all the examples in the thread so far, let's never
add anything like this to Python ever. It breaks so many of the
import this guidelines it's scary. The biggest loss is readability.
Sure in
On Sat, Jun 14, 2008 at 5:05 PM, Cesare Di Mauro [EMAIL PROTECTED] wrote:
In data 14 giugno 2008 alle ore 21:33:40, Georg Brandl [EMAIL PROTECTED] ha
scritto:
So what is the advantage to
b = Button(self)
b.text = QUIT
b.fg = red
b.command = self.quit
?
Georg
In this example there
Just take a look at the example I reported: don't you find it easier to read?
No, not at all. I actually *like* having to specify the object on a
method call. I find C++/Java code very hard to read which invokes a
method without specifying this. infront of the call - in particular
when you are
In data 14 giugno 2008 alle ore 22:09:28, Guilherme Polo [EMAIL PROTECTED] ha
scritto:
on Tkinter:
on ScrolledText.ScrolledText(master, width=60, height=37):
insert(END, self.log.getText())
configure(state=DISABLED)
see(END)
pack(fill=BOTH)
Then you have to start
In data 14 giugno 2008 alle ore 22:09:56, Martin v. Löwis [EMAIL PROTECTED]
ha scritto:
No, not at all. I actually *like* having to specify the object on a
method call. I find C++/Java code very hard to read which invokes a
method without specifying this. infront of the call - in particular
On Sat, Jun 14, 2008 at 9:53 PM, Cesare Di Mauro [EMAIL PROTECTED] wrote:
Just take a look at the example I reported: don't you find it easier to read?
Sure, it's perhaps a bit easier on the eyes, but readability includes
understanding what's the code does.
Let's take an example:
on Tkinter:
On Sat, Jun 14, 2008 at 10:19 PM, Cesare Di Mauro [EMAIL PROTECTED] wrote:
from Tkinter import *
I discourage this too. :)
Schiavo
Simob
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
On Sat, Jun 14, 2008 at 1:24 PM, Simon Cross [EMAIL PROTECTED] wrote:
On Sat, Jun 14, 2008 at 10:19 PM, Cesare Di Mauro [EMAIL PROTECTED] wrote:
from Tkinter import *
I discourage this too. :)
And so do I, every single time I teach Python (which is pretty often,
even though many of those
Cesare Di Mauro wrote:
However, I don't agree with the FAQ on this point. I think that a
Pascal-like with statement can be achieved, even with a dynamic
language such as Python, and in a simple way.
It's not so much a matter of whether it *can* be done, but
whether there's any substantial
Cesare Di Mauro wrote:
The same happens with:
from Tkinter import *
which is a fair common instruction...
...and which should *not* be used in most cases, for
the same reason.
All those tutorials that start out with 'from something
import *' are doing a lot of harm to the impressionable
Cesare Di Mauro wrote:
I agree: Python's with statement does have a completely different
meaning of the same Pascal Co 's statement.
However, I don't agree with the FAQ on this point. I think that a
Pascal-like with statement can be achieved, even with a dynamic
language such as Python, and in
The Python FAQ has the following entry:
4.26 Why doesn't Python have a with statement like some other languages?
From:
http://www.python.org/doc/faq/general/
Even if the content is still relevant (I know nothing of the use of
'with' outside Python), the entry probably needs at least
26 matches
Mail list logo