小编New*_*bie的帖子

使用sys.getsizeof(Var)方法的python大小的ctypes与`ctypes.sizeof(Var)`

我有一个关于python中可变大小的问题,我使用Ctypes是因为我想要一个1字节的数字,但是当我尝试通过python检查它的大小时(via sys.getsize)它说是80字节,但是当我用ctypes(via ctypes.sizeof)说它只有1个字节,有人可以告诉我有什么区别,为什么会有2个不同的大小?是因为python使用了对象还是包装器?当它发送到c时,它会查看实际尺寸吗?

import sys
import ctypes

print("size in ctypes is : ",ctypes.sizeof(ctypes.c_byte(1)))
print("size in sys is : ",sys.getsizeof(ctypes.c_byte(1)))
Run Code Online (Sandbox Code Playgroud)

结果是

size in ctypes is :  1
size in sys is :  80
Run Code Online (Sandbox Code Playgroud)

python size byte ctypes sys

5
推荐指数
1
解决办法
2137
查看次数

我如何在Angular2中为Router Compoenents使用动画

我希望在活动路由器链接发生变化时为我的组件设置动画.如何编写动画代码的代码,以便当路由器更改时,组件淡出然后另一个淡入?

我一直在尝试的代码如下.

@Component({
  selector: 'app-component',
  templateUrl: './component.component.html',
  animations: [trigger(
    'openClose',
    [
      transition(":enter", [
        style({ opacity: 0 }),
        animate('2000ms', style({ opacity: 1 }))
      ]),
      transition(":leave", [
        animate('2000ms', style({ opacity: 0 }))
      ])
    ])]
})
Run Code Online (Sandbox Code Playgroud)

但我认为我的概念错了,因为我试图在至少2个组件中使用这段代码,但它们都没有淡入或淡出.

这可能与此功能有关,还是我以错误的方式处理问题?

animation transition angular

3
推荐指数
1
解决办法
5041
查看次数

标签 统计

angular ×1

animation ×1

byte ×1

ctypes ×1

python ×1

size ×1

sys ×1

transition ×1