Correct way to detect sequence parameter?

As of 2.6, use abstract base classes. >>> import collections >>> isinstance([], collections.Sequence) True >>> isinstance(0, collections.Sequence) False Furthermore ABC’s can be customized to account for exceptions, such as not considering strings to be sequences. Here an example: import abc import collections class Atomic(object): __metaclass__ = abc.ABCMeta @classmethod def __subclasshook__(cls, other): return not issubclass(other, collections.Sequence) … Read more

How would you implement sequences in Microsoft SQL Server?

Sql Server 2012 has introduced SEQUENCE objects, which allow you to generate sequential numeric values not associated with any table. Creating them are easy: CREATE SEQUENCE Schema.SequenceName AS int INCREMENT BY 1 ; An example of using them before insertion: DECLARE @NextID int ; SET @NextID = NEXT VALUE FOR Schema.SequenceName; — Some work happens … Read more

Sequence-zip function for c++11?

Warning: boost::zip_iterator and boost::combine as of Boost 1.63.0 (2016 Dec 26) will cause undefined behavior if the length of the input containers are not the same (it may crash or iterate beyond the end). Starting from Boost 1.56.0 (2014 Aug 7) you could use boost::combine (the function exists in earlier versions but undocumented): #include <boost/range/combine.hpp> … Read more