面试复习
内置函数zip(),将可迭代对象作为参数,打包成元组返回,若迭代器元素数量不一致,按最短的返回。利用*可将元组打散为列表
在python3中为了减少内存,返回的是一个对象。可以使用list()转换为输出列表
In large applications, we may need to divide the app into smaller chunks, and only load a component from the server when it is actually needed. To make that easier, Vue.js allows you to define your component as a factory function that asynchronously resolves your component definition. Vue.js will only trigger the factory function when the component actually needs to be rendered, and will cache the result for future re-renders. For example:
在大型应用程序中,我们可能需要将应用程序分成更小的块,并且只在实际需要时从服务器加载组件。为了更简单,Vue。js允许您将组件定义为一个工厂函数,异步解析组件定义。Vue。js只会在组件实际需要渲染时触发工厂函数,并缓存结果以备以后重新渲染。例如:
As you can see, the factory function receives a resolve callback, which should be called when you have retrieved your component definition from the server. You can also call reject(reason) to indicate the load has failed. The setTimeout here is for demonstration; how to retrieve the component is up to you. One recommended approach is to use async components together with Webpack’s code-splitting feature:
如您所见,工厂函数接收一个解析回调,当您从服务器检索组件定义时应该调用这个回调。您还可以调用reject(reason)来指示加载失败。这里的setTimeout用于演示;如何检索组件由您决定。推荐的一种方法是将异步组件与Webpack的代码分割特性一起使用:
__name__ = '__main__'
if _name_ == '_main_'的意思是:当.py文件被直接运行时,if _name_ == '_main_'之下的代码块将被运行;当.py文件以模块形式被导入时,if _name_ == '_main_'之下的代码块不被运行。

浙公网安备 33010602011771号