Issue42478
Created on 2020-11-26 23:35 by wyko.ter.haar, last changed 2021-07-17 21:14 by andrei.avk.
| Messages (8) | |||
|---|---|---|---|
| msg381921 - (view) | Author: Wyko ter Haar (wyko.ter.haar) | Date: 2020-11-26 23:35 | |
It would be really nice if we could get an iterator just like ip_network.hosts() that iterates over the interfaces in a subnet. |
|||
| msg381927 - (view) | Author: Eric V. Smith (eric.smith) * ![]() |
Date: 2020-11-27 02:18 | |
I'm not sure what you mean by iterating over the interfaces in a subnet. Could you give an example? |
|||
| msg381932 - (view) | Author: Wyko ter Haar (wyko.ter.haar) | Date: 2020-11-27 09:04 | |
Literally just the same thing as .hosts(), except outputting interface objects instead of addresses. Maybe it could be a flag in .hosts() instead, something like "cast_as_interface". Sincerely, Wyko ter Haar On Fri, Nov 27, 2020, 3:18 AM Eric V. Smith <report@bugs.python.org> wrote: > > Eric V. Smith <eric@trueblade.com> added the comment: > > I'm not sure what you mean by iterating over the interfaces in a subnet. > Could you give an example? > > ---------- > nosy: +eric.smith > > _______________________________________ > Python tracker <report@bugs.python.org> > <https://bugs.python.org/issue42478> > _______________________________________ > |
|||
| msg381934 - (view) | Author: Wyko ter Haar (wyko.ter.haar) | Date: 2020-11-27 09:14 | |
>>> X = ip_network("10.0.0.0/24")
>>> H= X.hosts(as_interfaces= True)
>>> next(H)
IPv4Interface('10.0.0.0/24')
>>> next(H)
IPv4Interface('10.0.0.1/24')
Something like that. Sure, I could cast the output of hosts as an
interface, but then it would be missing the netmask.
Sincerely,
Wyko ter Haar
On Fri, Nov 27, 2020, 10:04 AM Wyko ter Haar <report@bugs.python.org> wrote:
>
> Wyko ter Haar <wyko.ter.haar@gmail.com> added the comment:
>
> Literally just the same thing as .hosts(), except outputting interface
> objects instead of addresses. Maybe it could be a flag in .hosts() instead,
> something like "cast_as_interface".
>
> Sincerely,
>
> Wyko ter Haar
>
> On Fri, Nov 27, 2020, 3:18 AM Eric V. Smith <report@bugs.python.org>
> wrote:
>
> >
> > Eric V. Smith <eric@trueblade.com> added the comment:
> >
> > I'm not sure what you mean by iterating over the interfaces in a subnet.
> > Could you give an example?
> >
> > ----------
> > nosy: +eric.smith
> >
> > _______________________________________
> > Python tracker <report@bugs.python.org>
> > <https://bugs.python.org/issue42478>
> > _______________________________________
> >
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue42478>
> _______________________________________
>
|
|||
| msg381935 - (view) | Author: Wyko ter Haar (wyko.ter.haar) | Date: 2020-11-27 09:16 | |
Starting at .1, not .0. Sincerely, Wyko ter Haar On Fri, Nov 27, 2020, 10:14 AM Wyko ter Haar <wyko.ter.haar@gmail.com> wrote: > >>> X = ip_network("10.0.0.0/24") > >>> H= X.hosts(as_interfaces= True) > >>> next(H) > IPv4Interface('10.0.0.0/24') > >>> next(H) > IPv4Interface('10.0.0.1/24') > > Something like that. Sure, I could cast the output of hosts as an > interface, but then it would be missing the netmask. > > Sincerely, > > Wyko ter Haar > > On Fri, Nov 27, 2020, 10:04 AM Wyko ter Haar <report@bugs.python.org> > wrote: > >> >> Wyko ter Haar <wyko.ter.haar@gmail.com> added the comment: >> >> Literally just the same thing as .hosts(), except outputting interface >> objects instead of addresses. Maybe it could be a flag in .hosts() >> instead, >> something like "cast_as_interface". >> >> Sincerely, >> >> Wyko ter Haar >> >> On Fri, Nov 27, 2020, 3:18 AM Eric V. Smith <report@bugs.python.org> >> wrote: >> >> > >> > Eric V. Smith <eric@trueblade.com> added the comment: >> > >> > I'm not sure what you mean by iterating over the interfaces in a subnet. >> > Could you give an example? >> > >> > ---------- >> > nosy: +eric.smith >> > >> > _______________________________________ >> > Python tracker <report@bugs.python.org> >> > <https://bugs.python.org/issue42478> >> > _______________________________________ >> > >> >> ---------- >> >> _______________________________________ >> Python tracker <report@bugs.python.org> >> <https://bugs.python.org/issue42478> >> _______________________________________ >> > |
|||
| msg381998 - (view) | Author: Terry J. Reedy (terry.reedy) * ![]() |
Date: 2020-11-28 12:54 | |
Wyko, when responding by email, please delete the message you are responding to, as it is redundant when posted to the web page. |
|||
| msg381999 - (view) | Author: Wyko ter Haar (wyko.ter.haar) | Date: 2020-11-28 12:55 | |
You bet. Totally forgot when I was replying on my phone :) |
|||
| msg397732 - (view) | Author: Andrei Kulakov (andrei.avk) * ![]() |
Date: 2021-07-17 21:14 | |
Related (with PR up): https://bugs.python.org/issue42861 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2021-07-17 21:14:40 | andrei.avk | set | nosy:
+ andrei.avk messages: + msg397732 |
| 2020-11-28 12:55:41 | wyko.ter.haar | set | messages: + msg381999 |
| 2020-11-28 12:55:11 | terry.reedy | set | components: + Library (Lib) |
| 2020-11-28 12:54:56 | terry.reedy | set | versions:
+ Python 3.10, - Python 3.9 nosy: + terry.reedy, ncoghlan messages: + msg381998 stage: test needed |
| 2020-11-27 09:16:07 | wyko.ter.haar | set | messages: + msg381935 |
| 2020-11-27 09:14:41 | wyko.ter.haar | set | messages: + msg381934 |
| 2020-11-27 09:04:25 | wyko.ter.haar | set | messages: + msg381932 |
| 2020-11-27 02:18:36 | eric.smith | set | nosy:
+ eric.smith messages: + msg381927 |
| 2020-11-26 23:35:44 | wyko.ter.haar | create | |

