Giter VIP home page Giter VIP logo

Comments (5)

xueyumusic avatar xueyumusic commented on June 19, 2024

It seems that C implement does not support tuple value type, but python implement could compatible with tuple...

from btrees.

tseaver avatar tseaver commented on June 19, 2024

I'm not clear what issue you are reporting. Can you show a traceback?

from btrees.

xueyumusic avatar xueyumusic commented on June 19, 2024

The issue I want to report could be shown as this example. If I use C implement, it reports an error, however if I use Python implement, it is right

Use C multiunion:

In [1]: import BTrees

In [2]: from BTrees.OOBTree import OOBTree

In [3]: from BTrees.IFBTree import IFSet

In [4]:

In [4]:  t=OOBTree()

In [5]: t["a"]=(1,2,3)

In [6]: t["b"]=IFSet((4,5,6))

In [7]: BTrees.family32.IF.multiunion(t.values())
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-7-b83097e5a1a2> in <module>()
----> 1 BTrees.family32.IF.multiunion(t.values())

TypeError: invalid argument

Use Python multiunion:

In [1]: import BTrees

In [2]: from BTrees.OOBTree import OOBTree

In [3]: from BTrees.IFBTree import IFSet

In [4]:

In [4]: t=OOBTree()

In [5]: t["a"]=(1,2,3)

In [6]: t["b"]=IFSet((4,5,6))

In [7]: BTrees.family32.IF.multiunion(t.values())
Out[7]: BTrees.IFBTree.IFSet([1, 2, 3, 4, 5, 6])

from btrees.

jamadden avatar jamadden commented on June 19, 2024

Looks to me like the C implementation is "right". But I think that's undefined behavior (what is a union of a typed, ordered set, and a random tuple even supposed to mean?) so don't be surprised at either outcome, or if it formats your hard drive.

from btrees.

jamadden avatar jamadden commented on June 19, 2024

The interface definition for multiuniion explicitly spells out which types can be used as arguments (sets and tree sets, buckets and btrees, single integers).

The online help, however, simply says "Each [argument] must be an integer set, or convertible to one via the set iteration protocol." Now, it's talking about the internal set iteration protocol using the C SetIteration struct, but it's very reasonable to imagine that it means "anything you can use as a constructor to a set" e.g., "any iterable of integers."

I don't think it would be hard to extend the internal SetIteration protocol to support arbitrary iterables of integers.

from btrees.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.