Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multi-Dimm Array or Class?
#1
I'm working on a config converter for firewalls. (Take ASA config, make it a Palo Alto config, or a Juniper config, etc).

What I'm actually trying to do is store the following type of data

rule1, src-intf, src-zone, dst-intf, dst-zone, allowed, protocol, port
rule2, src-intf, src-zone, dst-intf, dst-zone, allowed, protocol, port
rule3, src-intf, src-zone, dst-intf, dst-zone, allowed, protocol, port
rule4, src-intf, src-zone, dst-intf, dst-zone, allowed, protocol, port

I'm wonder when the decision point is to use a class, or simply use a multi-dimm array?
Would I do something like?:
class SecurityPolicies:
  def __init__(self):
    self.description = description
    self.src_intf = src_intf
	self.src_zone = src_zone
	self.dst_intf = dst_intf
	self.dst_zone = dst_zone
	self.pmt_deny = allowed

original_lines = original_file.readlines()
for counter in range(len(original_lines)):	
Policy[counter] = SecurityPolicies
** note syntax may not be 100% accurate

or is it simply easier to just use multi-dimm arrays?

Thanks for advice in advance
PappaBear
Reply


Messages In This Thread
Multi-Dimm Array or Class? - by PappaBear - May-02-2019, 05:14 PM
RE: Multi-Dimm Array or Class? - by buran - May-02-2019, 05:23 PM
RE: Multi-Dimm Array or Class? - by PappaBear - May-02-2019, 07:04 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Multi-class iterator Pedroski55 2 2,409 Jan-02-2021, 12:29 AM
Last Post: Pedroski55
  Applying Multi-Class Classification instead of binary classification alex80 1 1,516 Sep-18-2020, 07:39 AM
Last Post: alex80
  class random var write to array storzo 5 2,925 Aug-02-2019, 03:26 PM
Last Post: storzo
  multi-dimm array -- dynamic PappaBear 3 2,578 May-03-2019, 03:47 AM
Last Post: buran
  Best construct? Array, class, other? PappaBear 1 2,985 May-10-2017, 06:02 PM
Last Post: nilamo
  What work faster and take less memory array or class? Kamilbek 1 3,148 Apr-20-2017, 05:32 PM
Last Post: Larz60+
  Fast method of searching a string in a multi-dimension array? draems 6 6,019 Feb-20-2017, 01:02 PM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020