On 9/10/12 08:07:32, Bob Martin wrote:
> in 682592 20121008 232126 "Prasad, Ramit" wrote:
>> Thomas Bach wrote:=0D=0A> Hi there,=0D=0A> =0D=0A> On Sat, Oct 06, 2012 at =
>> 03:08:38PM +, Steven D'Aprano wrote:=0D=0A> >=0D=0A> > my_tuple =3D my_=
>> tuple[:4]=0D=0A> > a,b,c,d =3D my_tuple if le
On 10/9/2012 1:07 AM, Bob Martin wrote:
in 682592 20121008 232126 "Prasad, Ramit" wrote:
Thomas Bach wrote:=0D=0A> Hi there,=0D=0A> =0D=0A> On Sat, Oct 06, 2012 at =
03:08:38PM +, Steven D'Aprano wrote:=0D=0A> >=0D=0A> > my_tuple =3D my_=
tuple[:4]=0D=0A> > a,b,c,d =3D my_tuple if len(my_tu
Bob Martin wrote
> in 682592 20121008 232126 "Prasad, Ramit" wrote:
> >Thomas Bach wrote:=0D=0A> Hi there,=0D=0A> =0D=0A> On Sat, Oct 06, 2012 at =
> >03:08:38PM +, Steven D'Aprano wrote:=0D=0A> >=0D=0A> > my_tuple =3D my_=
> >tuple[:4]=0D=0A> > a,b,c,d =3D my_tuple if len(my_tuple) =3D=3D 4 e
On 2012-10-09, Bob Martin wrote:
> in 682592 20121008 232126 "Prasad, Ramit" wrote:
>>Thomas Bach wrote:=0D=0A> Hi there,=0D=0A> =0D=0A> On Sat, Oct 06, 2012 at =
>>03:08:38PM +, Steven D'Aprano wrote:=0D=0A> >=0D=0A> > my_tuple =3D my_=
>>tuple[:4]=0D=0A> > a,b,c,d =3D my_tuple if len(my_tup
Tim Chase writes:
> On 10/09/12 02:22, Jussi Piitulainen wrote:
> >>> in 682592 20121008 232126 "Prasad, Ramit" wrote:
> > [snip mess]
> >>> How does one unpack this post? ;-)
> >>
> >> Since that's not the way it arrived here, i have to ask, how do you
> >> get these posts?
> >
> > I see a carri
On 10/09/12 02:22, Jussi Piitulainen wrote:
>>> in 682592 20121008 232126 "Prasad, Ramit" wrote:
> [snip mess]
>>> How does one unpack this post? ;-)
>>
>> Since that's not the way it arrived here, i have to ask, how do you
>> get these posts?
>
> I see a carriage return rendered as ^M at the end
Dave Angel writes:
> On 10/09/2012 02:07 AM, Bob Martin wrote:
> > in 682592 20121008 232126 "Prasad, Ramit" wrote:
[snip mess]
> > How does one unpack this post? ;-)
>
> Since that's not the way it arrived here, i have to ask, how do you
> get these posts? Are you subscribed to individual mess
On 10/09/2012 02:07 AM, Bob Martin wrote:
> in 682592 20121008 232126 "Prasad, Ramit" wrote:
>> Thomas Bach wrote:=0D=0A> Hi there,=0D=0A> =0D=0A> On Sat, Oct 06, 2012 at =
>> 03:08:38PM +, Steven D'Aprano wrote:=0D=0A> >=0D=0A> > my_tuple =3D my_=
>> tuple[:4]=0D=0A> > a,b,c,d =3D my_tuple if
in 682592 20121008 232126 "Prasad, Ramit" wrote:
>Thomas Bach wrote:=0D=0A> Hi there,=0D=0A> =0D=0A> On Sat, Oct 06, 2012 at =
>03:08:38PM +, Steven D'Aprano wrote:=0D=0A> >=0D=0A> > my_tuple =3D my_=
>tuple[:4]=0D=0A> > a,b,c,d =3D my_tuple if len(my_tuple) =3D=3D 4 else (my_=
>tuple + (None,
Thomas Bach wrote:
> Hi there,
>
> On Sat, Oct 06, 2012 at 03:08:38PM +, Steven D'Aprano wrote:
> >
> > my_tuple = my_tuple[:4]
> > a,b,c,d = my_tuple if len(my_tuple) == 4 else (my_tuple + (None,)*4)[:4]
> >
>
> Are you sure this works as you expect? I just stumbled over the following:
>
>
On 8 October 2012 22:45, Thomas Bach wrote:
> Hi there,
>
> On Sat, Oct 06, 2012 at 03:08:38PM +, Steven D'Aprano wrote:
> >
> > my_tuple = my_tuple[:4]
> > a,b,c,d = my_tuple if len(my_tuple) == 4 else (my_tuple + (None,)*4)[:4]
> >
>
> Are you sure this works as you expect? I just stumbled
Hi there,
On Sat, Oct 06, 2012 at 03:08:38PM +, Steven D'Aprano wrote:
>
> my_tuple = my_tuple[:4]
> a,b,c,d = my_tuple if len(my_tuple) == 4 else (my_tuple + (None,)*4)[:4]
>
Are you sure this works as you expect? I just stumbled over the following:
$ python
Python 3.2.3 (default, Jun 25
On 10/7/2012 1:58 PM, woooee wrote:
On Oct 6, 3:09 am, sajuptpm wrote:
I need a way to make following code working without any ValueError .
a, b, c, d = (1,2,3,4)
a, b, c, d = (1,2,3)
You cannot 'make' buggy code work -- except by changing it.
>>> a, b, c, *d = (1,2,3)
>>> d
[]
Why is it
On Oct 6, 3:09 am, sajuptpm wrote:
> I need a way to make following code working without any ValueError .
>
> >>> a, b, c, d = (1,2,3,4)
> >>> a, b, c, d = (1,2,3).
Why is it necessary to unpack the tuple into arbitrary variables.
a_tuple=(1,2,3)
for v in a_tuple:
print v
for ctr in range(le
In article ,
Chris Rebert wrote:
> But at any rate:
> shortfall = 4 - len(your_tuple)
> your_tuple += (None,) * shortfall # assuming None is a suitable default
> a, b, c, d = your_tuple
>
> If you also need to handle the "too many items" case, use slicing:
> a, b, c, d = your_tuple[:4]
I usual
On Sat, Oct 6, 2012 at 3:09 AM, sajuptpm wrote:
> Hi,
>
> I am using python 2.6.
>
> I need a way to make following code working without any ValueError .
a, b, c, d = (1,2,3,4)
a, b, c, d = (1,2,3).
>
> Note: Number of values in the tuple will change dynamically.
Then you arguably want
Hi,
I am using python 2.6.
I need a way to make following code working without any ValueError .
>>> a, b, c, d = (1,2,3,4)
>>> a, b, c, d = (1,2,3).
Note: Number of values in the tuple will change dynamically.
I know in python 3, you can do `a, b, c, *d = (1, 2, 3)` and then d will
contain an
17 matches
Mail list logo