This has changed. It was pointed out that & should do and AND/INTERSECTION and | should do an OR/UNION. You should use
>>> rows3 = rows1 | rows2" to do the union. On Monday, 18 February 2019 10:47:20 UTC-8, Michael Becker wrote: > > Dear Web2py Team, > > in your web documentation for combining rows it says: > > "You can do union of the records in two sets of rows: > >>> rows3 = rows1 & rows2" > > This worked with PyDal 17.08 where method __and__ of Rows Class in > objects.py was defined as: > > def __and__(self, other): > .... > records = self.records + other.records > .... > > In PyDal 17.11 method __and__ of Rows Class in objects.py is defined as: > > def __and__(self, other): > .... > records = [] > other_records = list(other.records) > for record in self.records: > if record in other_records: > records.append(record) > other_records.remove(record) > > This will return no combination of two recordsets but a logical AND of two > recordsets which is always an empty list if there are no duplicate records > in the two sets. > > Is this intended or is just a 'not' missing to do a real UNION of the > recordsets, removing duplicates? > In this case it would also remain a problem when 'self.records' is shorter > than 'other_records', because you would loose records of 'other_records' > > Please let me know if this will be changed, or if there will be another > recommended way of combining rows. > > Many thanks in advance, > Michael > > > > > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

