This is a comparison of the different async/await strategies.
Python is the only language that doesn't execute the coroutines/tasks until you await for them.
| # Enter your code here. Read input from STDIN. Print output to STDOUT | |
| n, m = raw_input().split(" ") | |
| n = int(n) | |
| m = int(m) | |
| tickets = map(lambda x: int(x), raw_input().split(" ")) | |
| # n, m = 2, 4 | |
| # tickets = [5, 2] | |
| sorted_tickets = sorted(tickets, reverse=True) |
| from graphql.core import graphql | |
| from graphql.core.type import ( | |
| GraphQLObjectType, | |
| GraphQLField, | |
| GraphQLString, | |
| GraphQLSchema, | |
| GraphQLNonNull, | |
| ) | |
| humanType = GraphQLObjectType( |
| from collections import OrderedDict | |
| from graphql.core.execution.executor import Executor | |
| from graphql.core.execution.middlewares.gevent import GeventExecutionMiddleware, run_in_greenlet | |
| import graphene | |
| class Patron(graphene.ObjectType): | |
| id = graphene.ID() |
| from gdom.cmd import parse | |
| QUERY = '''{ | |
| # Whatever you want to query | |
| }''' | |
| print parse(QUERY, None, None) |
| import graphene | |
| from graphene import relay | |
| from graphene.core.classtypes import UnionType | |
| schema = graphene.Schema(name='Starwars Relay Schema') | |
| class Adjective(relay.Node): |
| import sys | |
| import inspect | |
| from functools import wraps | |
| import six | |
| class Prepareable(type): | |
| if not six.PY3: | |
| def __new__(cls, name, bases, attributes): |
| import graphene | |
| from graphene import relay | |
| from graphene_sqlalchemy import SQLAlchemyObjectType, SQLAlchemyConnectionField | |
| class Employee(SQLAlchemyObjectType): | |
| class Meta: | |
| model = EmployeeModel | |
| interfaces = (relay.Node, ) |
This is a comparison of the different async/await strategies.
Python is the only language that doesn't execute the coroutines/tasks until you await for them.
| extern crate wasmer_clif_backend; | |
| extern crate wasmer_runtime; | |
| use std::{ | |
| fs::File, | |
| io::prelude::*, | |
| str, | |
| }; | |
| use wasmer_clif_backend::CraneliftCompiler; |
| // This is an example on how a cache system could work. | |
| // It enforces a very useful pattern for caching: | |
| // - serializing (cache.save) | |
| // - deserializing (cache.load) | |
| // This abstracts the responsibility on how to load or how to save | |
| // outside, so it can be a FileSystem, a HashMap in memory, ... | |
| // We get the hash from the binary | |
| let hash: WasmHash = get_wasm_hash(&wasm_binary); |