在Java中,有没有关于何时使用每个访问修饰符,即默认明确的规则(包私有)public
,protected
并且private
,同时使class
与interface
和处理继承?
有没有办法在Python中执行以下预处理程序指令?
#if DEBUG
< do some code >
#else
< do some other code >
#endif
Run Code Online (Sandbox Code Playgroud) 现在,我有一个名为validation.yml的文件,它在一个文件中验证了所有bundle的实体.
validation.yml
Blogger\BlogBundle\Entity\Comment
properties:
username:
- NotBlank:
message: You must enter your name
- MaxLength: 50
comment:
- NotBlank:
message: You must enter a comment
- MinLength: 50
Blogger\BlogBundle\Entity\Enquiry:
properties:
name:
- NotBlank: ~
email:
- Email:
message: symblog does not like invalid emails. Give me a real one!
subject:
- NotBlank: ~
- MaxLength: 50
body:
- MinLength: 50
Run Code Online (Sandbox Code Playgroud)
但是我想把它分成两个文件并导入它们.这是我尝试过的,它不起作用:
validation.yml
imports:
- { resource: comment.yml }
- { resource: enquiry.yml }
Run Code Online (Sandbox Code Playgroud)
comment.yml
Blogger\BlogBundle\Entity\Comment
properties:
username:
- NotBlank:
message: …
Run Code Online (Sandbox Code Playgroud)