Re: Python Script to convert firewall rules

2014-12-13 Thread Kashif Rana
Hi Jason Thank you very much. Appreciated ! But the first requirement was to convert format1 to format2 as below: set interface ethernet2/5 ip 10.17.10.1/24 (format 1) set interfaces ge-0/0/0 unit 0 family inet address 10.17.10.1/24 (format 2) (set, interface, ip) = (set, interfaces, family inet

Re: Python Script to convert firewall rules

2014-12-13 Thread Jason Friedman
> Thanks for the reply. I am learning python using CBT nuggets for python. But > If you can refer me some good course, that should be practical then it would > be great. > > For my requirement, if you can give me the best approach to start with or > high level steps or give me some sample cod, I

Re: [Python-Dev] Python 2.x and 3.x use survey, 2014 edition

2014-12-13 Thread Nick Coghlan
On 13 Dec 2014 05:19, "Petr Viktorin" wrote: > > Also keep in mind that not all Python libraries are on PyPI. > For non-Python projects with Python bindings (think video players, > OpenCV, systemd, Samba), distribution via PyPI doesn't make much > sense. And since the Python bindings are usually s

Re: numpy question (fairly basic, I think)

2014-12-13 Thread Steven D'Aprano
Albert-Jan Roskam wrote: > Hi, > > I am new to numpy. I am reading binary data one record at a time (I have > to) and I would like to store all the records in a numpy array which I > pre-allocate. Below I try to fill the empty array with exactly one record, > but it is filled with as many rows as

Re: Creating interactive command-line Python app?

2014-12-13 Thread Steven D'Aprano
Akira Li wrote: > Steven D'Aprano writes: > >> rfreundlic...@colonial.net wrote: >> >>> um, what if I want to USE a command line for python WITHOUT downloading >>> or installing it >> >> Who are you talking to? What is the context? >> >> Like all software, you can't use Python apps without a

numpy question (fairly basic, I think)

2014-12-13 Thread Albert-Jan Roskam
Hi, I am new to numpy. I am reading binary data one record at a time (I have to) and I would like to store all the records in a numpy array which I pre-allocate. Below I try to fill the empty array with exactly one record, but it is filled with as many rows as there are columns. Why is this? It

Re: [Python-Dev] Python 2.x and 3.x use survey, 2014 edition

2014-12-13 Thread Zachary Ware
On Sat, Dec 13, 2014 at 9:51 AM, Grant Edwards wrote: > On 2014-12-10, Bruno Cauet wrote: > >> Nathaniel, I'm not sure about that: even if the code is 2- and 3-compatible >> you'll pick one runtime. > > Why do you say that? > > I have both installed. I use both. Sometimes it depends on which >

Re: Python Script to convert firewall rules

2014-12-13 Thread Kashif Rana
On Saturday, December 13, 2014 6:31:34 AM UTC+4, Jason Friedman wrote: > Thanks for the reply. Yes I can make the all possible keywords/values for > both formate. But after that what gonna be the logic to convert one format to > other format. Like to convert one line below are the keywords: > >

Re: Creating interactive command-line Python app?

2014-12-13 Thread Akira Li
Steven D'Aprano writes: > rfreundlic...@colonial.net wrote: > >> um, what if I want to USE a command line for python WITHOUT downloading or >> installing it > > Who are you talking to? What is the context? > > Like all software, you can't use Python apps without all their dependencies > being

Re: [Python-Dev] Python 2.x and 3.x use survey, 2014 edition

2014-12-13 Thread Grant Edwards
On 2014-12-10, Bruno Cauet wrote: > Nathaniel, I'm not sure about that: even if the code is 2- and 3-compatible > you'll pick one runtime. Why do you say that? I have both installed. I use both. Sometimes it depends on which OS/distro I'm running, sometimes other reasons prevail. -- Grant

Re: Python 2.x and 3.x use survey, 2014 edition

2014-12-13 Thread Marko Rauhamaa
Steven D'Aprano : > Marko Rauhamaa wrote: > >> At work, Python 2.3 is the version in one environment > > Good grief! What's the OS you are using for that? RHEL 4. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 2.x and 3.x use survey, 2014 edition

2014-12-13 Thread Steven D'Aprano
Marko Rauhamaa wrote: > At work, Python 2.3 is the version in one environment Good grief! What's the OS you are using for that? -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 2.x and 3.x use survey, 2014 edition

2014-12-13 Thread Marko Rauhamaa
"Giampaolo Rodola'" : > What I'm saying is that for a very long time a considerable number of > libraries haven't been ported to python 3 Ok, that's at least half the fault of the library developers. > Names such as Twisted, gevent, eventlet, python-daemon and paramiko > means that literally hun

Re: Creating interactive command-line Python app?

2014-12-13 Thread Steven D'Aprano
rfreundlic...@colonial.net wrote: > um, what if I want to USE a command line for python WITHOUT downloading or > installing it Who are you talking to? What is the context? Like all software, you can't use Python apps without all their dependencies being installed. If you use the Linux operat

Re: Python 2.x and 3.x use survey, 2014 edition

2014-12-13 Thread Giampaolo Rodola'
On Thu, Dec 11, 2014 at 10:32 PM, Ben Finney wrote: > > "Giampaolo Rodola'" writes: > > > I still think the only *real* obstacle remains the lack of important > > packages such as twisted, gevent and pika which haven't been ported > > yet. > > What disqualifies other obstacles from being “*real*

Re: Creating interactive command-line Python app?

2014-12-13 Thread rfreundlich21
um, what if I want to USE a command line for python WITHOUT downloading or installing it -- https://mail.python.org/mailman/listinfo/python-list

Re: list comprehension return a list and sum over in loop

2014-12-13 Thread pecore
KK Sasa writes: > Hi there, > > The list comprehension is results = [d2(t[k]) for k in > xrange(1000)], where d2 is a function returning a list, say > [x1,x2,x3,x4] for one example. So "results" is a list consisting of > 1000 lists, each of length four. Here, what I want to get is the sum > of 10

Re: Extension of while syntax

2014-12-13 Thread Steven D'Aprano
Nelson Crosby wrote: > I was thinking a bit about the following pattern: > > value = get_some_value() > while value in undesired_values: > value = get_some_value() > > I've always hated code that looks like this. Partly due to the repetition, > but partly also due to the fact that without be

Re: list comprehension return a list and sum over in loop

2014-12-13 Thread Mark Lawrence
On 13/12/2014 03:04, KK Sasa wrote: Sorry, i should say I'm using pythonxy, maybe it imports other things. That is good to know but without any context it's rather difficult to relate it to anything. Some people may have photographic memories and so remember everything that's been said in a

Re: is_ as method or property?

2014-12-13 Thread Steven D'Aprano
Mateusz Loskot wrote: > On 12 December 2014 at 12:26, Chris Angelico wrote: >> On Fri, Dec 12, 2014 at 10:21 PM, Mateusz Loskot >> wrote: >>> I've got several cases which are not obvious to me. >>> For instance, class Foo has a boolean attribute, read-write, >>> which I see a couple of realisati