On 06/12/2013 16:51, Piotr Dobrogost wrote:
[...]
I thought of that argument later the next day. Your proposal does
unify access if the old obj.x syntax is removed.
As long as obj.x is a very concise way to get attribute named 'x' from
object obj it's somehow odd that identifier x is treated n
On Friday, December 6, 2013 3:07:51 PM UTC+1, Neil Cerutti wrote:
> On 2013-12-04, Piotr Dobrogost
>
> wrote:
>
> > On Wednesday, December 4, 2013 10:41:49 PM UTC+1, Neil Cerutti
> > wrote:
>
> >> not something to do commonly. Your proposed syntax leaves the
> >> distinction between valid and i
On 2013-12-04, Piotr Dobrogost
wrote:
> On Wednesday, December 4, 2013 10:41:49 PM UTC+1, Neil Cerutti
> wrote:
>> not something to do commonly. Your proposed syntax leaves the
>> distinction between valid and invalid identifiers a problem
>> the programmer has to deal with. It doesn't unify acces
On Wed, 04 Dec 2013 12:35:14 -0800, Piotr Dobrogost wrote:
> Right. If there's already a way to have attributes with these
> "non-standard" names (which is a good thing)
No it is not a good thing. It is a bad thing, and completely an accident
of implementation that it works at all.
Python does
On Thursday, December 5, 2013 8:13:49 AM UTC+5:30, Ian wrote:
> On Wed, Dec 4, 2013 at 3:09 AM, rusi wrote:
> > On Wednesday, December 4, 2013 2:27:28 PM UTC+5:30, Ian wrote:
> >> On Tue, Dec 3, 2013 at 11:31 PM, rusi wrote:
> >> > Its a more fundamental problem than that:
> >> > It emerges from
On 12/4/2013 6:42 PM, Piotr Dobrogost wrote:
On Wednesday, December 4, 2013 11:11:56 PM UTC+1, Terry Reedy wrote:
The discussion of keystrokes is also a side-track.
To great degree, yes. Having said that I find extra 11 keystrokes
needed to access some attributes to be a freaking big and
unj
On 12/04/2013 06:58 PM, Terry Reedy wrote:
On 12/4/2013 3:46 PM, Mark Lawrence wrote:
On 04/12/2013 20:35, Piotr Dobrogost wrote:
there should be a variant of dot access allowing to access
these "non-standard" named attributes, too.
More opinion. I am sure that I am not the only developer wh
On 12/4/2013 3:46 PM, Mark Lawrence wrote:
On 04/12/2013 20:35, Piotr Dobrogost wrote:
On Wednesday, December 4, 2013 2:06:44 AM UTC+1, Tim Chase wrote:
I think random832 is saying that the designed purpose of setattr()
was to dynamically set attributes by name, so they could later be
accessed
On Wed, Dec 4, 2013 at 3:09 AM, rusi wrote:
> On Wednesday, December 4, 2013 2:27:28 PM UTC+5:30, Ian wrote:
>> On Tue, Dec 3, 2013 at 11:31 PM, rusi wrote:
>> > Its a more fundamental problem than that:
>> > It emerges from the OP's second post) that he wants '-' in the attributes.
>> > Is that
On 04/12/2013 20:07, Piotr Dobrogost wrote:
[...]
Unless we compare with what we have now, which gives 9 (without space) or 10
(with space):
x = obj.'value-1'
x = getattr(obj, 'value-1')
That is not a significant enough savings to create new syntax.
Well, 9 characters is probably significa
On 12/4/13 6:57 PM, Piotr Dobrogost wrote:
On Thursday, December 5, 2013 12:09:52 AM UTC+1, Ethan Furman wrote:
Perhaps you should look
at different ways of spelling your identifiers? Why can't you use an
underscore instead of a hyphen?
So that underscore could be left for use inside fields'
In article ,
Dennis Lee Bieber wrote:
> Spaces? I present to you two FORTRAN statements
>
> DO 10 I = 3 . 14159
> and
> DO10I = 3 , 1 4 1 5 9
>
> Which is the loop and which is the assignment?
I know it's rude to quote oneself, but
On 12/04/2013 03:57 PM, Piotr Dobrogost wrote:
On Thursday, December 5, 2013 12:09:52 AM UTC+1, Ethan Furman wrote:
Perhaps you should look at different ways of spelling your identifiers?
Why can't you use an underscore instead of a hyphen?
So that underscore could be left for use inside fie
On Thursday, December 5, 2013 12:09:52 AM UTC+1, Ethan Furman wrote:
> Perhaps you should look
> at different ways of spelling your identifiers? Why can't you use an
> underscore instead of a hyphen?
So that underscore could be left for use inside fields' names?
However I think we could use some
On Wednesday, December 4, 2013 11:11:56 PM UTC+1, Terry Reedy wrote:
>
> The discussion of enlarging the scope of 'identifier' is not relevant as
> you are not proposing that. In particular, you are not asking that
> obj.value-1 get the 'value-1' attribute of obj.
Right.
> The discussion of k
On 12/04/2013 02:13 PM, Piotr Dobrogost wrote:
On Wednesday, December 4, 2013 10:41:49 PM UTC+1, Neil Cerutti wrote:
On 2013-12-04, Piotr Dobrogost <> wrote:
Right. If there's already a way to have attributes with these
"non-standard" names (which is a good thing)
At best its a neutral thing
On Wed, 4 Dec 2013 14:05:11 -0800 (PST), Piotr Dobrogost
wrote:
Object's attributes and dictionary's keys are quite different
things.
Right. So if you need arbitrary keys, use a dict. Attributes are
keyed by identifiers, which are constrained. No problem.
--
DaveA
--
https://mail.python.or
On Wednesday, December 4, 2013 10:41:49 PM UTC+1, Neil Cerutti wrote:
> On 2013-12-04, Piotr Dobrogost <> wrote:
>
> > Right. If there's already a way to have attributes with these
> > "non-standard" names (which is a good thing)
>
> At best its a neutral thing. You can use dict for the same
> pu
On 12/4/2013 3:07 PM, Piotr Dobrogost wrote:
You have proposed to make non-identifier attribute names 'official',
rather than discouraged, by abbreviating
> x = getattr(obj, 'value-1')
or
x = obj.__dict__['value-1'] # implementation detail
as
x = obj.'value-1'
The discussion of enlarging th
On Tuesday, December 3, 2013 6:48:38 PM UTC+1, Dave Angel wrote:
> On Tue, 3 Dec 2013 09:14:49 -0800 (PST), Piotr Dobrogost
>
> wrote:
>
> > What is the reason there's no "natural" syntax allowing to access
> > attributes with names not being valid Python identifiers in a similar
> > way to ot
On Wednesday, December 4, 2013 10:41:49 PM UTC+1, Neil Cerutti wrote:
>
> not something to do commonly. Your proposed syntax leaves the
> distinction between valid and invalid identifiers a problem the
> programmer has to deal with. It doesn't unify access to
> attributes the way the getattr and se
On 12/04/2013 12:55 PM, Mark Lawrence wrote:
On 04/12/2013 20:22, Ethan Furman wrote:
On 12/04/2013 12:07 PM, Piotr Dobrogost wrote:
If there ought to be only one way to access attributes then it should
be dot notation.
Not "only one way", it's "one obvious way".
Not "one obvious way" it
On 2013-12-04, Piotr Dobrogost wrote:
> On Wednesday, December 4, 2013 2:06:44 AM UTC+1, Tim Chase wrote:
>>
>> I think random832 is saying that the designed purpose of setattr()
>> was to dynamically set attributes by name, so they could later be
>> accessed the traditional way; not designed from
On 12/04/2013 12:58 PM, Jerry Hill wrote:
On Wed, Dec 4, 2013 at 3:35 PM, Piotr Dobrogost
wrote:
Right. If there's already a way to have attributes with these "non-standard" names (which is a good
thing) then for uniformity with dot access to attributes with "standard" names there should be a
On Wednesday, December 4, 2013 2:23:24 PM UTC+1, Roy Smith wrote:
> In article <17gt99hg615jfm7bdid26185884d2pf...@4ax.com>,
>
> Tim Roberts <> wrote:
>
> > Piotr Dobrogost <> wrote:
>
> > >Attribute access syntax being very concise is very often preferred
> > >to dict's interface.
>
> > It
On Wed, Dec 4, 2013 at 3:35 PM, Piotr Dobrogost
wrote:
> Right. If there's already a way to have attributes with these "non-standard"
> names (which is a good thing) then for uniformity with dot access to
> attributes with "standard" names there should be a variant of dot access
> allowing to a
On 04/12/2013 20:22, Ethan Furman wrote:
On 12/04/2013 12:07 PM, Piotr Dobrogost wrote:
If there ought to be only one way to access attributes then it should
be dot notation.
Not "only one way", it's "one obvious way".
--
~Ethan~
Not "one obvious way" it's "There should be one-- and prefe
On 12/04/2013 12:07 PM, Piotr Dobrogost wrote:
If there ought to be only one way to access attributes then it should
be dot notation.
Not "only one way", it's "one obvious way".
The obvious way to deal with objects that do not have legal identifier names is
with a dict.
--
~Ethan~
--
https
On 04/12/2013 20:35, Piotr Dobrogost wrote:
On Wednesday, December 4, 2013 2:06:44 AM UTC+1, Tim Chase wrote:
I think random832 is saying that the designed purpose of setattr()
was to dynamically set attributes by name, so they could later be
accessed the traditional way; not designed from the
On Wednesday, December 4, 2013 2:06:44 AM UTC+1, Tim Chase wrote:
>
> I think random832 is saying that the designed purpose of setattr()
> was to dynamically set attributes by name, so they could later be
> accessed the traditional way; not designed from the ground-up to
> support non-identifier na
On Wednesday, December 4, 2013 6:45:05 AM UTC+1, Tim Roberts wrote:
>
> It is not "very concise". It is slightly more concise.
>
> x = obj.value1
> x = dct['value1']
>
> You have saved 3 keystrokes.
Actually only 1 as you should have compared these:
x = obj.'value-1'
x = dct['value-1
Op 04-12-13 14:02, rusi schreef:
> On Wednesday, December 4, 2013 6:02:18 PM UTC+5:30, Antoon Pardon wrote:
>> Op 04-12-13 13:01, rusi schreef:
>>> On Wednesday, December 4, 2013 3:59:06 PM UTC+5:30, Antoon Pardon wrote:
Op 04-12-13 11:09, rusi schreef:
> I used the spaces case to indicate
On 12/04/2013 03:30 AM, Jussi Piitulainen wrote:
rusi writes:
How do we decide which '-' are valid identifier components --
hyphens and which minus-signs?
I think the OP might be after the JavaScript mechanism where an
attribute name can be any string, the indexing brackets are always
availab
In article <17gt99hg615jfm7bdid26185884d2pf...@4ax.com>,
Tim Roberts wrote:
> Piotr Dobrogost wrote:
> >
> >Attribute access syntax being very concise is very often preferred
> >to dict's interface.
>
> It is not "very concise". It is slightly more concise.
>
> x = obj.value1
> x =
On Wednesday, December 4, 2013 6:02:18 PM UTC+5:30, Antoon Pardon wrote:
> Op 04-12-13 13:01, rusi schreef:
> > On Wednesday, December 4, 2013 3:59:06 PM UTC+5:30, Antoon Pardon wrote:
> >> Op 04-12-13 11:09, rusi schreef:
> >>> I used the spaces case to indicate the limit of chaos.
> >>> Other ch
Op 04-12-13 13:01, rusi schreef:
> On Wednesday, December 4, 2013 3:59:06 PM UTC+5:30, Antoon Pardon wrote:
>> Op 04-12-13 11:09, rusi schreef:
>>> I used the spaces case to indicate the limit of chaos.
>>> Other characters (that
>>> already have uses) are just as problematic.
>>
>> I don't agree
On Wednesday, December 4, 2013 3:59:06 PM UTC+5:30, Antoon Pardon wrote:
> Op 04-12-13 11:09, rusi schreef:
> > I used the spaces case to indicate the limit of chaos.
> > Other characters (that
> > already have uses) are just as problematic.
>
> I don't agree with the latter. As it is now python c
On Wed, Dec 4, 2013 at 10:30 PM, Jussi Piitulainen
wrote:
> Hm. Can't specific classes be made to behave this way even now by
> implementing suitable underscored methods?
Yup. Definitely possible. I don't think it'd be a good idea, though,
not without somehow changing every dict method into a sta
rusi writes:
> On Wednesday, December 4, 2013 2:27:28 PM UTC+5:30, Ian wrote:
> > On Tue, Dec 3, 2013 at 11:31 PM, rusi wrote:
> > > Its a more fundamental problem than that:
> > > It emerges from the OP's second post) that he wants '-' in the
> > > attributes. Is that all?
> > >
> > > Where does
On Wednesday, December 4, 2013 4:03:14 PM UTC+5:30, Chris Angelico wrote:
> On Wed, Dec 4, 2013 at 9:09 PM, rusi wrote:
> > OP wants attribute identifiers like
> > outer_fieldset-inner_fieldset-third_field.
> > Say I have a python expression:
> > obj.outer_fieldset-inner_fieldset-third_field
>
>
On 2013-12-04 21:33, Chris Angelico wrote:
> I don't think so. What the OP asked for was:
>
> my_object.'valid-attribute-name-but-not-valid-identifier'
>
> Or describing it another way: A literal string instead of a token.
> This is conceivable, at least, but I don't think it gives any
> advantag
On Wed, Dec 4, 2013 at 9:09 PM, rusi wrote:
> OP wants attribute identifiers like outer_fieldset-inner_fieldset-third_field.
> Say I have a python expression:
> obj.outer_fieldset-inner_fieldset-third_field
I don't think so. What the OP asked for was:
my_object.'valid-attribute-name-but-not-vali
Op 04-12-13 11:09, rusi schreef:
> On Wednesday, December 4, 2013 2:27:28 PM UTC+5:30, Ian wrote:
>> On Tue, Dec 3, 2013 at 11:31 PM, rusi wrote:
>>> Its a more fundamental problem than that:
>>> It emerges from the OP's second post) that he wants '-' in the attributes.
>>> Is that all?
>>>
>>> Wh
On Wednesday, December 4, 2013 2:27:28 PM UTC+5:30, Ian wrote:
> On Tue, Dec 3, 2013 at 11:31 PM, rusi wrote:
> > Its a more fundamental problem than that:
> > It emerges from the OP's second post) that he wants '-' in the attributes.
> > Is that all?
> >
> > Where does this syntax-enlargement sto
On 12/03/2013 09:45 PM, Tim Roberts wrote:
Piotr Dobrogost wrote:
Attribute access syntax being very concise is very often preferred
to dict's interface.
It is not "very concise". It is slightly more concise.
x = obj.value1
x = dct['value1']
You have saved 3 keystrokes. That is
On Tue, Dec 3, 2013 at 11:31 PM, rusi wrote:
> Its a more fundamental problem than that:
> It emerges from the OP's second post) that he wants '-' in the attributes.
> Is that all?
>
> Where does this syntax-enlargement stop? Spaces? Newlines?
At non-strings.
>>> setattr(foo, 21+21, 42)
Tracebac
On Wednesday, December 4, 2013 11:15:05 AM UTC+5:30, Tim Roberts wrote:
> Piotr Dobrogost wrote:
> >
> >Attribute access syntax being very concise is very often preferred
> >to dict's interface.
>
> It is not "very concise". It is slightly more concise.
>
> x = obj.value1
> x = dct['val
Piotr Dobrogost wrote:
>
>Attribute access syntax being very concise is very often preferred
>to dict's interface.
It is not "very concise". It is slightly more concise.
x = obj.value1
x = dct['value1']
You have saved 3 keystrokes. That is not a significant enough savings to
create
On 2013-12-03 15:47, Piotr Dobrogost wrote:
> > The getattr function is meant for when your attribute name is in a
> > variable. Being able to use strings that aren't valid identifiers
> > is a side effect.
>
> Why do you say it's a side effect?
I think random832 is saying that the designed pu
On Tuesday, December 3, 2013 6:31:58 PM UTC+1, Ethan Furman wrote:
>
> When would you have attribute names that are not valid identifiers?
>
See my answer to rand's post.
--
https://mail.python.org/mailman/listinfo/python-list
On Tuesday, December 3, 2013 7:03:41 PM UTC+1, rand...@fastmail.us wrote:
> On Tue, Dec 3, 2013, at 12:14, Piotr Dobrogost wrote:
>
> > Hi!
>
> > I find global getattr() function awkward when reading code.
> > What is the reason there's no "natural" syntax allowing to access
> > attributes with n
On Tue, Dec 3, 2013, at 12:14, Piotr Dobrogost wrote:
> Hi!
>
> I find global getattr() function awkward when reading code.
> What is the reason there's no "natural" syntax allowing to access
> attributes with names not being valid Python identifiers in a similar way
> to other attributes?
> Somet
On 12/03/2013 09:14 AM, Piotr Dobrogost wrote:
I find global getattr() function awkward when reading code.
What is the reason there's no "natural" syntax allowing to
access attributes with names not being valid Python
identifiers in a similar way to other attributes?
Something along the line
On Tue, 3 Dec 2013 09:14:49 -0800 (PST), Piotr Dobrogost
wrote:
I find global getattr() function awkward when reading code.
Me too.
What is the reason there's no "natural" syntax allowing to access
attributes with names not being valid Python identifiers in a similar
way to other attributes
On 12/3/13 12:14 PM, Piotr Dobrogost wrote:
Hi!
I find global getattr() function awkward when reading code.
What is the reason there's no "natural" syntax allowing to access attributes
with names not being valid Python identifiers in a similar way to other attributes?
Something along the line o
Hi!
I find global getattr() function awkward when reading code.
What is the reason there's no "natural" syntax allowing to access attributes
with names not being valid Python identifiers in a similar way to other
attributes?
Something along the line of
my_object.'valid-attribute-name-but-not-va
56 matches
Mail list logo