On 5 September 2016 at 04:13, Ivan Levkivskyi <levkivskyi at gmail.com> wrote: > On 4 September 2016 at 19:59, Nick Coghlan <ncoghlan at gmail.com> wrote: >> I suspect you'll have an easier time of it on that front if you >> include some examples of dynamically typed code that a well-behaved >> type-checker *must* report as correct Python code, such as: >> >> x: Optional[List[Any]] >> # This is the type of "x" *after* the if statement, not *during* it >> if arg is not None: >> x = list(arg) >> if other_arg is not None: >> # A well-behaved typechecker should allow this due to >> # the more specific initialisation in this particular branch >> x.extend(other_arg) >> else: >> x = None > > There are very similar examples in PEP 484 (section on singletons in > unions), > we could just copy those or use this example, > but I am sure Guido will not agree to word "must" (although "should" maybe > possible :-) "Should" would be fine by me :) Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4