James Stroud wrote:
[EMAIL PROTECTED] wrote:
Please check for sanity and approve for posting at python-dev.
In Visual Basic there is the keyword with which allows an object-
name to be declared as governing the following statements. For
example:
with quitCommandButton
.enabled = true
[EMAIL PROTECTED] wrote:
Please check for sanity and approve for posting at python-dev.
Technically, you can post it yourself to python-dev, but you'll just
get bounced back here to discuss it with us. ;-)
In Visual Basic there is the keyword with which allows an object-
name to be declared
Paul Boddie [EMAIL PROTECTED] wrote:
Now I hear that the word with is being discussed for a different
purpose in Py 3 as a result of a PEP and I don't want to conflict with
that.
The with keyword appears in 2.5 onwards.
...but needs a from __future__ import with_statement in 2.5 itself.
Please check for sanity and approve for posting at python-dev.
In Visual Basic there is the keyword with which allows an object-
name to be declared as governing the following statements. For
example:
with quitCommandButton
.enabled = true
.default = true
end with
This is syntactic sugar for:
[EMAIL PROTECTED] wrote:
Please check for sanity and approve for posting at python-dev.
In Visual Basic there is the keyword with which allows an object-
name to be declared as governing the following statements. For
example:
with quitCommandButton
.enabled = true
.default = true
end
I like this one for some reason. Just the using self would save hella
typing in a lot of classes. I would favor a convention with leading dots
to disambiguate from other variables. This wouldn't conflict with, say,
floats, because variable names can't begin with a number.
Excellent. Now we
jamadagni wrote:
I like this one for some reason. Just the using self would save hella
typing in a lot of classes. I would favor a convention with leading dots
to disambiguate from other variables. This wouldn't conflict with, say,
floats, because variable names can't begin with a number.
jamadagni wrote:
I like this one for some reason. Just the using self would save hella
typing in a lot of classes. I would favor a convention with leading dots
to disambiguate from other variables. This wouldn't conflict with, say,
floats, because variable names can't begin with a number.
James Stroud [EMAIL PROTECTED] wrote:
I like this one for some reason. Just the using self would save
hella typing in a lot of classes. I would favor a convention with
leading dots to disambiguate from other variables. This wouldn't
conflict with, say, floats, because variable names can't
[EMAIL PROTECTED] wrote:
In Visual Basic there is the keyword with which allows an
object- name to be declared as governing the following statements.
For example:
with quitCommandButton
.enabled = true
.default = true
end with
This is syntactic sugar for:
On Apr 14, 5:06 pm, Duncan Booth [EMAIL PROTECTED] wrote:
I can't see how it is going to save you any typing over what you can
already do.
The suggested example:
The suggested example is only a small case. I realize that the main
usage would be when there are a lot of repetitive usages when
Personally, I'd never use it.
You are free to avoid using it of course. :)
In more complex modules, when you are
looking for, e. g., self.myVar and anotherObject.myVar,
this using statement decreases readability and maintainability
(in full text searching). IMHO.
Why? Just search for self
Your idea isn't new and has already been discussed lots of time
before. It was once planned to be implemented in py3k, but no longer
is.
One of the problems is that with a using statement, you always have
to decide whether your code repeats some prefix enough times to use a
using statement.
You already can emulate the using statement like this:
You can emulate only assignments like this. How would you emulate
function calls, like the ones in my example?
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
In Visual Basic there is the keyword with which allows an object-
name to be declared as governing the following statements. For
example:
with quitCommandButton
.enabled = true
.default = true
end with
This is syntactic sugar for:
BJörn Lindqvist [EMAIL PROTECTED] wrote:
? Not having to bother with petty things like that is an advantage.
Javascript has with-statements that are equivalent to your
using-statements but from what I've seen most programmers avoid them.
They don't increase readability one bit.
That is at
jamadagni [EMAIL PROTECTED] wrote:
If you are going to reference self.quit a lot of times then it makes
sense to also assign it to a local variable and then you already get
even fewer characters (239):
But you realize readability decreases considerably.
Not as much as it would with your
On 14 Apr 2007 07:24:32 -0700, jamadagni [EMAIL PROTECTED] wrote:
You already can emulate the using statement like this:
You can emulate only assignments like this. How would you emulate
function calls, like the ones in my example?
You can't, of course. But using the with statement:
using
On 4/14/07, BJörn Lindqvist [EMAIL PROTECTED] wrote:
On 14 Apr 2007 07:24:32 -0700, jamadagni [EMAIL PROTECTED] wrote:
You already can emulate the using statement like this:
You can emulate only assignments like this. How would you emulate
function calls, like the ones in my example?
On Apr 14, 4:42 am, [EMAIL PROTECTED] wrote:
This also is
similar to the C++ using keyword which exposes the members of a
namespace to access without specifying the namespace scope for each
reference. For example after giving using namespace std; I can
change all references to std::cout to
On Apr 14, 12:57 pm, 7stud [EMAIL PROTECTED] wrote:
On Apr 14, 4:42 am, [EMAIL PROTECTED] wrote:
This also is
similar to the C++ using keyword which exposes the members of a
namespace to access without specifying the namespace scope for each
reference. For example after giving using
BJörn Lindqvist schrieb:
On 4/14/07, BJörn Lindqvist [EMAIL PROTECTED] wrote:
On 14 Apr 2007 07:24:32 -0700, jamadagni [EMAIL PROTECTED] wrote:
You already can emulate the using statement like this:
You can emulate only assignments like this. How would you emulate
function calls, like
jamadagni wrote:
Bjoern Schliessmann wrote:
In more complex modules, when you are
looking for, e. g., self.myVar and anotherObject.myVar,
this using statement decreases readability and maintainability
(in full text searching). IMHO.
Why? Just search for self and you turn up using self.
On Apr 15, 2:01 am, Bjoern Schliessmann usenet-
[EMAIL PROTECTED] wrote:
self.myVar -- something lost, something gained, IMHO.
So, the gain is the loss of something different? If you say so.
My mistake - I should have said no pain, no gain.
IMHO, the ability to find something quickly
On Sat, 14 Apr 2007 03:42:52 -0700, samjnaa wrote:
Please check for sanity and approve for posting at python-dev.
In Visual Basic there is the keyword with which allows an object-
name to be declared as governing the following statements. For
example:
with quitCommandButton
.enabled =
25 matches
Mail list logo