I can wrap it with list indeed. I know that six.moves.range is an iterator 
- in Python 2, it is simply xrange. But I was thinking that perhaps Graph's 
constructor should be able to understand xrange (or rather, iterators in 
general) instead of lists when the data is a dictionary of neighbours. 
Perhaps it may even be more efficient in some cases. What do you think?

On Tuesday, 6 December 2016 22:41:31 UTC+2, Frédéric Chapoton wrote:
>
> The new (python3 or six) range is an iterator. You just have to wrap it 
> with list( ) to get back to the python2 behaviour if needed.
>
>
> Le mardi 6 décembre 2016 17:31:20 UTC+1, Frédéric Chapoton a écrit :
>>
>> DO NOT TOUCH the import of range from six.moves ! This is part of our 
>> general move toward python3 !
>>
>> And do never use xrange, this is now forbidden.
>>
>> Frederic
>>
>> Le mardi 6 décembre 2016 16:26:12 UTC+1, Peleg Michaeli a écrit :
>>>
>>> I actually think that this is an unwanted behaviour of `six`.
>>>
>>> Anyway, we may let `Graph` handle xrange lists of neighbours if we want 
>>> to keep it that way.
>>>
>>> On Tuesday, 6 December 2016 17:18:29 UTC+2, Peleg Michaeli wrote:
>>>>
>>>> I have tried to move LollipopGraph into families, but there was a 
>>>> problem. In families, there's the following import:
>>>>
>>>>     from six.moves import range
>>>>
>>>> This overrides Python's range. I don't know why. The original 
>>>> implementation of Lollipop graph uses Python's range, and when it tries to 
>>>> use the new (six.moves) range it fails (with "This input cannot be turned 
>>>> into a graph").
>>>>
>>>> I can clearly fix this, by setting something like python_range = range 
>>>> before the six.moves import, but it is not very elegant. I can also use 
>>>> networkx's implementation of LollipopGraph (as done with BarbellGraph), 
>>>> but 
>>>> I am not sure you consider this as the right direction to go.
>>>>
>>>> What do you think?
>>>>
>>>> On Wednesday, 30 November 2016 00:40:21 UTC+2, Dima Pasechnik wrote:
>>>>>
>>>>>
>>>>>
>>>>> On Tuesday, November 29, 2016 at 4:42:51 PM UTC, Peleg Michaeli wrote:
>>>>>>
>>>>>> Dear list members,
>>>>>>
>>>>>> I was wondering what really makes the difference between the graph 
>>>>>> generators in `basic.py` and those in `families.py`.
>>>>>>
>>>>>> For one concrete example, I was wondering why `LollipopGraph` appears 
>>>>>> in `basic.py` and `BarbellGraph` appears in `families.py`. These two 
>>>>>> graphs 
>>>>>> are very similar.
>>>>>>
>>>>>> I ask this for a practical reason: I would like to add a couple of 
>>>>>> graph families, including the Tadpole graph (which is very similar to 
>>>>>> the 
>>>>>> Lollipop graph and the Barbell graph) and the Dipole graph (which is one 
>>>>>> of 
>>>>>> the simplest multigraphs).
>>>>>>
>>>>>> What do you think?
>>>>>>
>>>>>
>>>>> I think all of them could go into families.py
>>>>>  
>>>>>
>>>>>>
>>>>>>
>>>>>> Best,
>>>>>> Peleg.
>>>>>>
>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to