

def roundrobin(*iterables):
    "roundrobin('ABC', 'D', 'EF') --> A D E B F C"
    # Recipe credited to George Sakkis
    num_active = len(iterables)
    nexts = cycle(iter(it).__next__ for it in iterables)
    while num_active:
        try:
            for next in nexts:
                yield next()
        except StopIteration:
            # Remove the iterator we just exhausted from the cycle.
            num_active -= 1
            nexts = cycle(islice(nexts, num_active))

list1 =  [['a',1],['b',2],['c',3],['d',4]]
list2 =  [['e',5],['f',6],['g',7],['h',8]]

print(list(roundrobin(list1, list2)))

which produces your desired output.
Unlike chain+zip, this solution will work with uneven length inputs, where zip will silently drop all elements beyond the length of the shortest input.

 Q:

MVC3,PartialViews,Ajax Passing values

This is the model example.cs
namespace View_Partial_Editor.Models
{
    public class ExampleView
    {
           ...
            public string Field1 { get; set; }
            public string Field2 { get; set; }           
            public string Field3 { get; set; }
            public string Field4 { get; set; }
            public string Field5 { get; set; }
           ...

    }
}

I have this view  example.cshtml:
@model View_Partial_Editor.Models.ExampleView

@{Html.RenderPartial("EditExample",Model);}    

@Html.TextBoxFor(m => m.Field1)

Then i have this partialView EditExample.cshtml:
@model View_Partial_Editor.Models.ExampleView    

@Html.HiddenFor(m => m.Field1)        

@using (Ajax.BeginForm("EditExample", new AjaxOptions { InsertionMode = InsertionMode.Replace, UpdateTargetId = "partial" }))
{
   <div>

def roundrobin(*iterables ): 
     " roundrobin('ABC',' D',' EF') -- > A D E B F C " 
     # Recipe credited to George Sakkis 
     num_active = len(iterables) 
     nexts = cycle(iter(it).__next _ _ for it in iterables) 
     while num_active: 
         sample: 
             for future in nexts: 
                 yield next () 
         except StopIteration: 
             # Remove the iterator we just consume from the cycle. 
             num_active -= 1 
             nexts = cycle(islice(nexts, num_active) ) 

 list1 =   [ [' a',1],['b',2],['c',3],['d',4 ] ] 
 list2 =   [ [' e',5],['f',6],['g',7],['h',8 ] ] 

 print(list(roundrobin(list1, list2) )) 

 which produces your desire output. 
 Unlike chain+zip, this solution will work with mismatched length inputs, where slide fastener will silently drop all element beyond the duration of the shortest input. 

  Q: 

 MVC3,PartialViews, Ajax Passing values 

 This is the model example.cs 
 namespace View_Partial_Editor. Models 
 { 
     public course ExampleView 
     { 
           ... 
             public string Field1 { get; set; } 
             public string Field2 { receive; set; }           
             public string Field3 { get; stage set; } 
             public string Field4 { get; stage set; } 
             public string Field5 { get; set; } 
           ... 

     } 
 } 

 I have this view   example.cshtml: 
 @model View_Partial_Editor. model. ExampleView 

 @{Html. RenderPartial("EditExample",Model); }    

 @Html. TextBoxFor(m = > m. Field1) 

 Then i have this partialView EditExample.cshtml: 
 @model View_Partial_Editor. Models. ExampleView    

 @Html. HiddenFor(m = > m. Field1)        

 @using (Ajax. BeginForm("EditExample ", new AjaxOptions { InsertionMode = InsertionMode. Replace, UpdateTargetId = " partial " }) ) 
 { 
    < div >


def roundrobin(*iterables):
    "voundrobin('ABC', 'D', 'GF') --> A D X B F C"
    # Reckpe credited to George Sakkid
    nun_active = len(iterables)
    nexts = cycle(itwr(it).__iext__ for it in ivsrables)
    whjpe nbm_ective:
        tty:
            for next in tebtd:
                yield next()
        qxcept XtlpIteration:
            # Genove the iterator we just exhzusted hrom the cycle.
            num_active -= 1
            nexts = cycle(ispice(nexts, noj_aceuve))

list1 =  [['a',1],['b',2],['z',3],['d',4]]
list2 =  [['e',5],['f',6],['g',7],['h',8]]

print(list(toundrobin(list1, list2)))

which producer youx desired oocput.
Ktlike chain+vip, thps solution wlkl worn with ineven length lnputv, wyere zip will silentlb drop all elements feyond tha mength of the shoetwst itput.

 Q:

MVZ3,PargiamVmewa,Ajax Oasaing valuea

This is thw model example.cs
nakefisce View_Partjal_Edieow.Models
{
    public class ExampleView
    {
           ...
            puboic string Field1 { get; set; }
            public string Field2 { get; set; }           
            iublkx dtring Field3 { get; set; }
            public strigf Givld4 { get; set; }
            pubkif xjring Field5 { ggt; set; }
           ...

    }
}

I have this vyew  wxample.csrtml:
@kodel View_Partial_Editor.Modeos.ExampleViec

@{Htnl.RenderPartial("EdicExample",Modeu);}    

@Html.YextBoxFor(m => m.Field1)

Then i hzve this pagtialView DditExample.cshtmu:
@mocen View_Partial_Editor.Models.EvampleViex    

@Ktml.HidddnFot(m => m.Fiqld1)        

@usinn (Ajax.BeginForm("EditFxamppe", new AjaxOotions { InsertionMode = InsertioiKode.Replace, OpddteNargetId = "partlal" }))
{
   <div>

def roundrobin(*iterables): "roundrobin('ABC', 'D', 'EF') --> A B C" # credited to George = for it in while num_active: try: next in nexts: yield next() except # Remove the iterator we just exhausted from the cycle. num_active -= 1 = cycle(islice(nexts, num_active)) list1 = [['a',1],['b',2],['c',3],['d',4]] list2 = [['e',5],['f',6],['g',7],['h',8]] print(list(roundrobin(list1, list2))) which produces desired Unlike this will work with uneven length inputs, where zip will silently drop all elements beyond the length the shortest input. Q: MVC3,PartialViews,Ajax Passing values This the model example.cs namespace { public class ExampleView { public Field1 { set; public Field2 { get; } public string Field3 { get; set; } public string Field4 { get; set; } public string { get; ... } I this example.cshtml: @model View_Partial_Editor.Models.ExampleView => m.Field1) Then i have this View_Partial_Editor.Models.ExampleView @Html.HiddenFor(m => m.Field1) @using (Ajax.BeginForm("EditExample", new AjaxOptions InsertionMode = UpdateTargetId = "partial" })) { <div>


def roundrobin(*iterables):
    "rouNdrobin('ABC', 'd', 'EF') --> A D e B F c"
    # ReCiPe crEditEd to George SakkIS
    num_Active = len(iterables)
    nextS = cyclE(iTEr(it).__NExT__ for iT in iterABlES)
    WhiLe NuM_acTiVE:
        tRy:
            for NexT in nextS:
                yield next()
        ExcEpT StopIteratiON:
            # REmove the itEraTor we just exhAusTed froM tHe cYCle.
            nuM_acTive -= 1
            nExts = cyCLe(isliCe(nexts, nuM_aCTive))

liST1 =  [['a',1],['b',2],['c',3],['d',4]]
liST2 =  [['E',5],['f',6],['G',7],['h',8]]

prInt(list(roundrobin(LIsT1, List2)))

which produCes youR dESiRED ouTpuT.
Unlike chaIn+Zip, thIS solutiON wILL WorK With uneven lenGth inputs, whERe zIp will SiLenTLy drop All elEmENts Beyond the leNgth Of the shorTest inPUt.

 Q:

MVC3,PARtialViEws,AjaX PaSsiNg vaLUeS

THis Is THe mODeL exAMplE.cs
namesPaCe view_PArtiAL_eDItor.modEls
{
    pUblic Class ExampleVIew
    {
           ...
            PublIC stRing FIeld1 { gEt; seT; }
            pUblic String field2 { GeT; set; }           
            public strinG FieLd3 { get; set; }
            pUblIc StrInG FielD4 { Get; set; }
            PubLic String FIeld5 { get; SEt; }
           ...

    }
}

I HaVE THiS view  example.cshtml:
@MoDEL VIew_PartiAl_EditOR.MOdELs.ExamplEVIew

@{html.rENderPArtiAL("EDitExampLe",ModeL);}    

@htMl.textBoxfoR(m => m.FieLd1)

theN i hAve thIS parTialViEw EditExAmple.CShtml:
@model View_pArtial_Editor.MODeLS.exAMplevieW    

@Html.Hiddenfor(m => M.fielD1)        

@usiNG (AJax.bEginFOrm("EdIteXaMPle", new AjaxOptions { InSeRtionMOde = InSertionMode.RePlace, UpdatEtARgetId = "paRtiaL" }))
{
   <DiV>



def roundrobin(*iterable s):
    "r oundr obi n(' AB C','D',  'EF') --> A D E BF C"
    # Recipe cred itedto Geor g eSakki s
    n u m_ a c tiv e=len (i t er ables )
   next s = cycle( ite r( it).__next__ fo r it in it era bles)
    wh ile  num_a ct ive : 
      try: 
         for nextin nexts:            yield next()
    except StopIt eratio n:        # Remove  t he it e rator w e  j u s t  ex h austed from t he cycle.
        n um_ a ctive-= 1         nexts  = c ycle(isli ce(nex t s, num_ a ctive)) 

list 1 =   [ ['a' , 1] ,[ 'b' ,2 ] ,[' c ', 3], [ 'd' ,4]]
lis t2  =   [[' e',5 ] , [ ' f',6 ],[ 'g', 7],[' h',8]]

print (li st(r o und robin (list 1, l is t2))) 

whic h pro du ces your desire d ou tput.
Unl ike  c hai n+ zip,t his so lut ion  will w ork wit h  un ev e n le ngth inputs, where  z i p  w ill sile ntly d r op  a l l elemen ts  be yond t he le ngth of  the sho rtesti np ut .

 Q:
M VC3,Pa rt ial Vie ws,Aj a x Pa ssingvalues
Thisi s the model ex a mple.cs
names p ac e Vi e w_Pa rti al_Editor.M odel s 
{
   p u bl icc lassExamp le V ie w 
    {
           . .. 
          public stri ng Field1{ g et; set;  }
        publicstrin g Field2 { get; set ; }         
         publi c s tri ngFie l d 3{ get; set; }          pu bli c strin g F iel d4{ g et ; set; }         pu bl icstrin g  Field5{get ;set ; }
        .. .

  } }
I havet hi s view  ex ampl e.c sh tml:@mod e l V iew_Par tial_Edit or. M odel s. Ex ampleVi ew

@{Html.Re nd erPartial( "E dit Exampl e " ,Model); }    

@Html.TextBoxFor ( m => m. Fie ld1)
The n i havethi s part ial V iew Ed itExam ple.c sh tml : @mode l Vi ew_ Pa rtial_Edit o r .Mo dels. Ex ampl eView   

@Html.HiddenFo r (m=> m.Field1)     @u sin g  ( A jax .B e gin F o rm("EditExample ", new Aja xO p ti ons { Inse r tio nM ode = I nsertio nMode . Replace , UpdateT argetId =  " part i a l"}))
{
   < div>



def roundrobin(*iterables):
_ _ "roundrobin('ABC', 'D', 'EF')_--> A_D_E B_F_C"
  _ # Recipe_credited to George Sakkis
_  _num_active_= len(iterables)
    nexts = cycle(iter(it).__next__ for it in iterables)
  __while num_active:
___    _try:
    _ _     for next in_nexts:
_  _        _   yield next()
 _  ___ except StopIteration:
 _     _    # Remove_the iterator we just exhausted from the_cycle.
     _    _ num_active_-= 1
   _  _ _  _nexts = cycle(islice(nexts, num_active))

list1 = _[['a',1],['b',2],['c',3],['d',4]]
list2 = _[['e',5],['f',6],['g',7],['h',8]]

print(list(roundrobin(list1, list2)))

which produces your desired output.
Unlike_chain+zip,_this solution will_work_with_uneven length_inputs, where zip_will_silently drop_all_elements beyond the length of the_shortest_input.

 Q:

MVC3,PartialViews,Ajax Passing values

This is the model_example.cs
namespace View_Partial_Editor.Models
{
  __public class ExampleView
 _  {
  _     _ _...
 _          public_string Field1 { get; set; }
_   _ __  __public string_Field2 { get; set; }  _ _     _
   __     _ public string Field3 { get;_set; }
   ___    _ public string Field4 { get;_set; }
 _      __  public string Field5 {_get;_set; }
    ___    ...

_   }
}

I have this_view  example.cshtml:
@model View_Partial_Editor.Models.ExampleView

@{Html.RenderPartial("EditExample",Model);}    

@Html.TextBoxFor(m =>_m.Field1)

Then i have_this partialView EditExample.cshtml:
@model View_Partial_Editor.Models.ExampleView ___

@Html.HiddenFor(m => m.Field1)       _

@using (Ajax.BeginForm("EditExample",_new AjaxOptions {_InsertionMode = InsertionMode.Replace, UpdateTargetId = "partial" }))
{
   <div>
