python-igraph icon indicating copy to clipboard operation
python-igraph copied to clipboard

The tutorial shows old igraph/python versions

Open szhorvat opened this issue 4 years ago • 7 comments

The tutorial shows Python 2.7 and igraph 0.6 in the example outputs. This should be updated to recent versions since we don't even support Python 2.7.

szhorvat avatar Sep 10 '21 06:09 szhorvat

Good catch, we should also take away star imports and include a plot with matplotlib I think

iosonofabio avatar Sep 13 '21 06:09 iosonofabio

Version numbers updated in 9bde4c2. I think the star imports are okay; personally, I don't mind star imports when someone is working interactively in a Python prompt, I'm only against star imports in Python files.

I'll push an update to igraph.org soon.

ntamas avatar Sep 20 '21 12:09 ntamas

The main issue is solved, but since we're here: many people copy-paste from the tutorial into their files and notebooks I believe, so I wondered about the star import too.

Not a big deal I think, but perhaps to discuss again as we ramp up our examples and docs over the next months

Edit: just realized I'm the only one who worries about the star import haha! Let's just close this issue as soon as the new version numbers hit the server.

iosonofabio avatar Sep 20 '21 21:09 iosonofabio

just realized I'm the only one who worries about the star import

No, I also don't like it, it obscures very much where something is coming from and makes it difficult to read. I do understand that it's sometimes easy to use though. I personally use the ig abbreviation for import, similar to np for numpy and pd for pandas.

vtraag avatar Sep 21 '21 17:09 vtraag

Oh the cavalry had arrived! Yes I use ig too, we could start promoting it that way in the docs?

iosonofabio avatar Sep 21 '21 21:09 iosonofabio

It's up to you guys; personally, I never use notebooks so I don't know what's the convention there. I tend to be overly pedantic in my own code and use explicit imports (i.e. from igraph import Graph) even in interactive prompts so I don't have a strong preference for or against using import igraph as ig. (This seems to have been invented by the community anyway as I have never advocated abbreviating igraph as ig anywhere).

ntamas avatar Sep 24 '21 10:09 ntamas

This seems to have been invented by the community anyway as I have never advocated abbreviating igraph as ig anywhere

I've been probably just imitating what is done for numpy and related packages. Explicit imports is also fine, but for a tutorial that brings overly many imports I think.

vtraag avatar Sep 24 '21 12:09 vtraag