bool-hybrid-array 9.11.14__py3-none-any.whl → 9.11.16__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,16 +4,16 @@ from types import ModuleType,FunctionType
4
4
  try:from . import compile_core as core
5
5
  except:from . import core
6
6
  from .core import __builtins__,builtins
7
- try:from . import int_array
7
+ try:from . import int_array,float_array
8
8
  except:pass
9
- __version__ = "9.11.14"
9
+ __version__ = "9.11.16"
10
10
  public_objects = []
11
11
  for name in dir(core):
12
12
  if not name.startswith("_"):
13
13
  obj = getattr(core, name)
14
14
  if isinstance(obj, (type, ModuleType)) or callable(obj):
15
15
  public_objects.append(name)
16
- __all__ = public_objects + ["__version__","__builtins__","core","builtins","__dict__","int_array"]
16
+ __all__ = public_objects + ["__version__","__builtins__","core","builtins","__dict__","int_array","float_array"]
17
17
  globals().update({
18
18
  name: getattr(core, name)
19
19
  for name in public_objects
@@ -306,4 +306,41 @@ print(f"第二次出队: {q.dequeue()}") # 输出:F(直接从 self.b 弹出
306
306
 
307
307
  print(f"出队2个元素后: {q}") # 输出:BHA_Queue([T,T,F,T,F])
308
308
 
309
-
309
+ #float_array子包(9.11.15版本新增)
310
+
311
+ # 1. 初始化数组
312
+ f_arr = float_array.FloatHybridArray([1.1, 2.2, 3.3, 4.4, 5.5])
313
+
314
+ # 2. 获取元素
315
+ first_elem = f_arr[0] # 获取第一个元素:BHA_Float(1.1)
316
+ print(f"第一个元素:{first_elem}")
317
+
318
+ # 3. 修改元素
319
+ f_arr[1] = 9.9 # 修改第二个元素为 9.9
320
+ print(f"修改后第二个元素:{f_arr[1]}")
321
+
322
+ # 4. 添加元素
323
+ f_arr.append(6.6) # 追加元素 6.6
324
+ print(f"数组长度:{len(f_arr)}") # 输出:6
325
+
326
+ # 5. 遍历数组
327
+ for elem in f_arr:
328
+ print(f"数组元素:{elem}")
329
+
330
+ #namespace元类(9.11.15版本新增)
331
+ class BaseMathTools(metaclass = namespace):
332
+ pi = 3.141
333
+ def add(a,b):
334
+ return a+b
335
+ protected_names = ("pi","add")
336
+
337
+ class MathTools(BaseMathTools,metaclass = namespace):
338
+ pi = 3.1415926535897932
339
+ def mul(a,b):
340
+ return a*b
341
+ def sub(a,b):
342
+ return a-b
343
+ e = 2.718281828
344
+ protected_names = (*BaseMathTools.protected_names,"e","sub","mul")
345
+
346
+ print(MathTools.mul(10,23))#输出:230