Tornado 6.5 DocumentationStoryHandler(RequestHandler): def initialize(self, db): self.db = db def get(self, story_id): self.write("this is story %s" % story_id) app = Application([ url(r"/", MainHandler), url(r"/story/([0-9]+)", StoryHandler web.Application([ url(r"/app", tornado.web.RedirectHandler, dict(url="http://itunes.apple.com/my-app-id")), ]) RedirectHandler also supports regular expression substitutions. The following rule redirects RequestHandler): def get_current_user(self): user_id = self.get_signed_cookie("user") if not user_id: return None return self.backend.get_user_by_id(user_id) def get_user_locale(self): if "locale" not in0 码力 | 272 页 | 1.12 MB | 3 月前3
Tornado 6.5 Documentationdef initialize(self, db): self.db = db def get(self, story_id): self.write("this is story %s" % story_id) app = Application([ url(r"/", MainHandler), url(r"/story/([0-9]+)" Application([ url(r"/app", tornado.web.RedirectHandler, dict(url="http://itunes.apple.com/my-app-id")), ]) RedirectHandler also supports regular expression substitutions. The following rule redirects def get_current_user(self): user_id = self.get_signed_cookie("user") if not user_id: return Nonereturn self.backend.get_user_by_id(user_id) def get_user_locale(self): if0 码力 | 437 页 | 405.14 KB | 3 月前3
julia 1.10.10UniquedById() = new(counter += 1) end end while the intent of this code was to give every instance a unique id, the counter value is recorded at the end of compilation. All subsequent usages of this incrementally Jobs, identified by an id (job_id), are written to the channel. Each task in this simulation reads a job_id, waits for a random amount of time and writes back a tuple of job_id and the simulated time function do_work() for job_id in jobs exec_time = rand() sleep(exec_time) # simulates elapsed time doing actual work # typically performed externally. put!(results, (job_id, exec_time)) end end; julia>0 码力 | 1692 页 | 6.34 MB | 3 月前3
Julia 1.10.9UniquedById() = new(counter += 1) end end while the intent of this code was to give every instance a unique id, the counter value is recorded at the end of compilation. All subsequent usages of this incrementally Jobs, identified by an id (job_id), are written to the channel. Each task in this simulation reads a job_id, waits for a random amount of time and writes back a tuple of job_id and the simulated time function do_work() for job_id in jobs exec_time = rand() sleep(exec_time) # simulates elapsed time doing actual work # typically performed externally. put!(results, (job_id, exec_time)) end end; julia>0 码力 | 1692 页 | 6.34 MB | 3 月前3
Rust 程序设计语言 简体中文版 1.85.0展示了一个例子,这里我们希望测试 Message::Hello 的 id 字段是否位于 3..=7 范围内,同时 也希望能将其值绑定到 id_variable 变量中以便此分支相关联的代码可以使用它。可以将 id_variable 命名为 id,与字段同名,不过出于示例的目的这里选择了不同的名称。 enum Message { Hello { id: i32 }, } let Message::Hello { id: 5 }; match msg { Message::Hello { id: id_variable @ 3..=7, } => println!("Found an id in range: {id_variable}"), Message::Hello { id: 10..=12 } => ("Found an id in another range") } Message::Hello { id } => println!("Found some other id: {id}"), } 示例 19-29: 使用 @ 在模式中绑定值的同时测试它 上例会打印出 Found an id in range: 5。通过在 3..=7 之前指定 id_variable0 码力 | 562 页 | 3.23 MB | 1 月前3
Julia 1.11.4UniquedById() = new(counter += 1) end end while the intent of this code was to give every instance a unique id, the counter value is recorded at the end of compilation. All subsequent usages of this incrementally Jobs, identified by an id (job_id), are written to the channel. Each task in this simulation reads a job_id, waits for a random amount of time and writes back a tuple of job_id and the simulated time function do_work() for job_id in jobs exec_time = rand() sleep(exec_time) # simulates elapsed time doing actual work # typically performed externally. put!(results, (job_id, exec_time)) end end; julia>0 码力 | 2007 页 | 6.73 MB | 3 月前3
Julia 1.11.5 DocumentationUniquedById() = new(counter += 1) end end while the intent of this code was to give every instance a unique id, the counter value is recorded at the end of compilation. All subsequent usages of this incrementally Jobs, identified by an id (job_id), are written to the channel. Each task in this simulation reads a job_id, waits for a random amount of time and writes back a tuple of job_id and the simulated time function do_work() for job_id in jobs exec_time = rand() sleep(exec_time) # simulates elapsed time doing actual work # typically performed externally. put!(results, (job_id, exec_time)) end end; julia>0 码力 | 2007 页 | 6.73 MB | 3 月前3
Julia 1.11.6 Release NotesUniquedById() = new(counter += 1) end end while the intent of this code was to give every instance a unique id, the counter value is recorded at the end of compilation. All subsequent usages of this incrementally Jobs, identified by an id (job_id), are written to the channel. Each task in this simulation reads a job_id, waits for a random amount of time and writes back a tuple of job_id and the simulated time function do_work() for job_id in jobs exec_time = rand() sleep(exec_time) # simulates elapsed time doing actual work # typically performed externally. put!(results, (job_id, exec_time)) end end; julia>0 码力 | 2007 页 | 6.73 MB | 3 月前3
julia 1.13.0 DEVstore here. One can also install exactly the same version by executing winget install --name Julia --id 9NJNWW8PVKMN -e -s msstore in any shell. 3.2 Mac and Linux Julia can be installed on Linux or Mac UniquedById() = new(counter += 1) end end while the intent of this code was to give every instance a unique id, the counter value is recorded at the end of compilation. All subsequent usages of this incrementally Jobs, identified by an id (job_id), are written to the channel. Each task in this simulation reads a job_id, waits for a random amount of time and writes back a tuple of job_id and the simulated time0 码力 | 2058 页 | 7.45 MB | 3 月前3
Julia 1.12.0 RC1UniquedById() = new(counter += 1) end end while the intent of this code was to give every instance a unique id, the counter value is recorded at the end of compilation. All subsequent usages of this incrementally Jobs, identified by an id (job_id), are written to the channel. Each task in this simulation reads a job_id, waits for a random amount of time and writes back a tuple of job_id and the simulated time function do_work() for job_id in jobs exec_time = rand() sleep(exec_time) # simulates elapsed time doing actual work # typically performed externally. put!(results, (job_id, exec_time)) end end; julia>0 码力 | 2057 页 | 7.44 MB | 3 月前3
共 16 条
- 1
- 2













