]> git.alrj.org Git - bold.git/blobdiff - Bold/BinArray.py
Cleaning and refactoring.
[bold.git] / Bold / BinArray.py
diff --git a/Bold/BinArray.py b/Bold/BinArray.py
new file mode 100644 (file)
index 0000000..84d5725
--- /dev/null
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+
+# kate: space-indent on; indent-width 2; mixedindent off; indent-mode python;
+
+# Copyright (C) 2009 Amand 'alrj' Tihon <amand.tihon@alrj.org>
+#
+# This file is part of bold, the Byte Optimized Linker.
+#
+# You can redistribute this file and/or modify it under the terms of the
+# GNU Lesser General Public License as published by the Free Software
+# Foundation, version 2.1.
+
+from array import array
+import struct
+
+class BinArray(array):
+  """A specialized array that contains bytes"""
+  def __new__(cls, data=None):
+    if data:
+      return array.__new__(BinArray, "B", data)
+    else:
+      return array.__new__(BinArray, "B")