Re: [sympy] Including `as_dict` for FiniteSet

17 views
Skip to first unread message

Harsh Gupta

unread,
May 15, 2014, 2:24:48 PM5/15/14
to sy...@googlegroups.com
You should send us a PR with the implementation. There we see your
code in proper context and figure out what the problem is. Also we
don't accept patches on mailing list so you will have to send a PR
anyway if you want the code to get merged. Go through the development
workflow if you haven't already.
https://github.com/sympy/sympy/wiki/Development-workflow

Another guy is working on the same issue
https://github.com/sympy/sympy/pull/7496 and duplication of effort is
not a good thing, You should either collaborate or let only one of you
work on it. We a *lots* of issue and there is plenty of work for both
of you. We would be happy to help.

On 15 May 2014 23:32, Abhishek K Das <abhishe...@gmail.com> wrote:
> I wrote this function for FiniteSet
>
> def as_dict(self,*args):
> """
> Rewrite a FiniteSet as a Dictionary.
>
> Examples
> ========
> >>> from sympy import Symbol
> >>> from sympy.core import sets
> >>> A = FiniteSet((0, 0), (0, pi), (pi, 0), (pi, pi))
> >>> x = Symbol('x')
> >>> y = Symbol('y')
>
> >>> A.as_dict(x,y)
>
> """
> def as_dict(self,*other):
> _list = []
> for elem in self:
> _list.append(dict(zip(list(other),list(elem))))
> return _list
>
> but when I do ./bin/doctest core it shows :
>
>
> _______________________________________ sympy.core.sets.FiniteSet.as_dict
> _______________________________________
> File "sympy/core/sets.py", line 1524, in sympy.core.sets.FiniteSet.as_dict
> Failed example:
> A.as_dict(x,y)
> Exception raised:
> Traceback (most recent call last):
> File "/usr/lib/python2.7/doctest.py", line 1315, in __run
> compileflags, 1) in test.globs
> File "<doctest sympy.core.sets.FiniteSet.as_dict[5]>", line 1, in
> <module>
> A.as_dict(x,y)
> File "sympy/core/sets.py", line 1530, in as_dict
> _list.append(dict(zip(list(other),list(elem))))
> NameError: global name 'other' is not defined
>
> ============================= tests finished: 216 passed, 1 failed, in 2.51
> seconds =============================
> DO *NOT* COMMIT!
> ============================================== rst doctests start
> ===============================================
>
>
> This is the first time , I have made some changes in any file in sympy . I
> am a newbie , please tell me what are the issues with the doctest and how
> can I edit this so as
> to get the test passed ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/91fd3cef-6819-43b9-86ca-1ee54fb972b0%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Harsh

Abhishek K Das

unread,
May 15, 2014, 3:02:05 PM5/15/14
to sy...@googlegroups.com
There was a mistake in that implementation , I have corrected it and I am going through the development work-flow
to get my implementation merged
Reply all
Reply to author
Forward
0 new messages