In article <7f82416a-53be-41b3-9503-1492454cc...@upsg2000gro.googlegroups.com>,
RunThePun wrote:
>On Sep 1, 3:00=A0am, a...@pythoncraft.com (Aahz) wrote:
>> In article .com>,
>> RunThePun =A0 wrote:
>>>On Aug 30, 10:33=3DA0pm, a...@pythoncraft.com (Aahz) wrote:
In article ups=3D
>>>.com>,
>>
On Sep 1, 3:00 am, a...@pythoncraft.com (Aahz) wrote:
> In article
> ,
>
>
>
>
>
> RunThePun wrote:
> >On Aug 30, 10:33=A0pm, a...@pythoncraft.com (Aahz) wrote:
> >> In article >.com>,
> >> RunThePun =A0 wrote:
>
> >>>I made a DictMixin where the keys are filenames and the values are the
> >>>f
In article ,
RunThePun wrote:
>On Aug 30, 10:33=A0pm, a...@pythoncraft.com (Aahz) wrote:
>> In article .com>,
>> RunThePun =A0 wrote:
>>>
>>>I made a DictMixin where the keys are filenames and the values are the
>>>file contents. It was very simple and easy to do thanks to DictMixin.
>>>
>>>For e
On Aug 30, 10:33 pm, a...@pythoncraft.com (Aahz) wrote:
> In article
> ,
>
>
>
>
>
> RunThePun wrote:
>
> >I made a DictMixin where the keys are filenames and the values are the
> >file contents. It was very simple and easy to do thanks to DictMixin.
>
> >For example this code writes "abc" in a
In article ,
RunThePun wrote:
>
>I made a DictMixin where the keys are filenames and the values are the
>file contents. It was very simple and easy to do thanks to DictMixin.
>
>For example this code writes "abc" in a file named "temp.txt" and
>prints the contents of the file named "swallow", the
PS. Sorry for sending 2 posts -- the latter is the correct one.
Cheers,
*j
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 29, 1:58 pm, Carl Banks wrote:
> On Aug 28, 10:37 pm, Joshua Judson Rosen wrote:
>
>
>
>
>
> > Carl Banks writes:
>
> > > On Aug 28, 2:42 pm, Terry Reedy wrote:
>
> > > > Carl Banks wrote:
> > > > > I don't think it needs a syntax for that, but I'm not so sure a method
> > > > > to modif
On Aug 28, 10:37 pm, Joshua Judson Rosen wrote:
> Carl Banks writes:
>
> > On Aug 28, 2:42 pm, Terry Reedy wrote:
>
> > > Carl Banks wrote:
> > > > I don't think it needs a syntax for that, but I'm not so sure a method
> > > > to modify a value in place with a single key lookup wouldn't
> > > >
On Sat, 29 Aug 2009 01:23:59 -0400, Joshua Judson Rosen wrote:
> Robert Kern writes:
>>
>> On 2009-08-28 16:42 PM, Terry Reedy wrote:
>> > Carl Banks wrote:
>> >
>> > > I don't think it needs a syntax for that, but I'm not so sure a
>> > > method to modify a value in place with a single key looku
Carl Banks writes:
>
> On Aug 28, 2:42 pm, Terry Reedy wrote:
>
> > Carl Banks wrote:
> > > I don't think it needs a syntax for that, but I'm not so sure a method
> > > to modify a value in place with a single key lookup wouldn't
> > > occasioanally be useful.
> >
> > Augmented assignment does th
Robert Kern writes:
>
> On 2009-08-28 16:42 PM, Terry Reedy wrote:
> > Carl Banks wrote:
> >
> > > I don't think it needs a syntax for that, but I'm not so sure a
> > > method to modify a value in place with a single key lookup
> > > wouldn't occasioanally be useful.
> >
> > Augmented assignment d
On Aug 28, 2:42 pm, Terry Reedy wrote:
> Carl Banks wrote:
> > I don't think it needs a syntax for that, but I'm not so sure a method
> > to modify a value in place with a single key lookup wouldn't
> > occasioanally be useful.
>
> Augmented assignment does that.
Internally uses two lookups, one
On 2009-08-28 16:42 PM, Terry Reedy wrote:
Carl Banks wrote:
I don't think it needs a syntax for that, but I'm not so sure a method
to modify a value in place with a single key lookup wouldn't
occasioanally be useful.
Augmented assignment does that.
No, it uses one __getitem__ and one __set
Carl Banks wrote:
I don't think it needs a syntax for that, but I'm not so sure a method
to modify a value in place with a single key lookup wouldn't
occasioanally be useful.
Augmented assignment does that.
For instance:
def increment(value):
return value+1
d = { 'a': 1 }
d
On Aug 26, 11:49 pm, RunThePun wrote:
> Anybody have any more ideas? I think python should/could havev a
> syntax for overriding this behaviour, i mean, obviously the complexity
> of supporting all operators with the getitem syntax could introduce
> alot of clutter. But maybe there's an elegant so
In article <21e57363-4e92-41cb-9907-5aef96ad0...@o15g2000yqm.googlegroups.com>,
RunThePun wrote:
>
>Anybody have any more ideas? I think python should/could havev a
>syntax for overriding this behaviour, i mean, obviously the complexity
>of supporting all operators with the getitem syntax could i
On 2009-08-27 01:49 AM, RunThePun wrote:
Anybody have any more ideas? I think python should/could havev a
syntax for overriding this behaviour, i mean, obviously the complexity
of supporting all operators with the getitem syntax could introduce
alot of clutter. But maybe there's an elegant solut
On Aug 27, 6:58 am, Robert Kern wrote:
> On 2009-08-26 20:00 PM, Jan Kaliszewski wrote:
>
>
>
>
>
> > 27-08-2009 o 00:48:33 Robert Kern wrote:
>
> >> On 2009-08-26 17:16 PM, RunThePun wrote:
> >>> I'd like to build a database wrapper using DictMixin and allow items
> >>> to be appended by my own
On 2009-08-26 20:00 PM, Jan Kaliszewski wrote:
27-08-2009 o 00:48:33 Robert Kern wrote:
On 2009-08-26 17:16 PM, RunThePun wrote:
I'd like to build a database wrapper using DictMixin and allow items
to be appended by my own code. The problem is += is always understood
as setitem and getitem pl
27-08-2009 o 00:48:33 Robert Kern wrote:
On 2009-08-26 17:16 PM, RunThePun wrote:
I'd like to build a database wrapper using DictMixin and allow items
to be appended by my own code. The problem is += is always understood
as setitem and getitem plainly.
d = MyDict()
d['a'] = 1
# this is the p
27-08-2009 o 00:48:33 Robert Kern wrote:
On 2009-08-26 17:16 PM, RunThePun wrote:
I'd like to build a database wrapper using DictMixin and allow items
to be appended by my own code. The problem is += is always understood
as setitem and getitem plainly.
d = MyDict()
d['a'] = 1
# this is the p
I haven't tested it, but did you encounter a problem defining __iadd__ in
the class definition?
See:
http://docs.python.org/reference/datamodel.html#object.__iadd__
Cheers,
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xav
On 2009-08-26 17:16 PM, RunThePun wrote:
I'd like to build a database wrapper using DictMixin and allow items
to be appended by my own code. The problem is += is always understood
as setitem and getitem plainly.
d = MyDict()
d['a'] = 1
# this is the problem code that's I'd like to override. It'
I'd like to build a database wrapper using DictMixin and allow items
to be appended by my own code. The problem is += is always understood
as setitem and getitem plainly.
d = MyDict()
d['a'] = 1
# this is the problem code that's I'd like to override. It's always
setitem('a', getitem('a') + 3)
d['
24 matches
Mail list logo