@communia · Post #37542 · 08.11.2023 г., 06:55
#UE. #Plástico https://elpais.com/clima-y-medio-ambiente/2023-11-07/la-ocu-y-otras-asociaciones-de-12-paises-denuncian-en-bruselas-a-los-envasadores-de-botellas-de-agua-por-ecopostureo.html
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #402 · 22 дек.
Отдельно разберём TaskGroup, который пришел на замену gather в Python 3.11. Ключевые отличия ▫️create_task() возвращает объект asyncio.Task, у которого есть соответствюущие методы управления. То есть у нас больше контроля ▫️это контекстный менеджер, который гарантирует что все таски будут остановлены по выходу из контекста ▫️ошибка автоматически отменяет незавершенные задачи, ▫️except* передает нам ExceptionGroup, в котором каждую ошибку можно обработать отдельно import asyncio import random async def do_it() -> str: if random.random() < 0.1: raise ValueError('Oops') delay = random.uniform(0.5, 1.5) await asyncio.sleep(delay) return delay async def main(): try: async with asyncio.TaskGroup() as tg: for _ in range(10): tasks.append(tg.create_task(do_it())) for t in tasks: print(t.result()) except *ValueError as e: for err in e.exceptions: print(err) asyncio.run(main()) Рекомендую изучить страницу Coroutines and Tasks из документации, где представлено больше интересных примеров и механизмов - таймауты - отмена задач - создание задач из другого потока #async
Hashtags
Пребарај: #plástico
@communia · Post #37542 · 08.11.2023 г., 06:55
#UE. #Plástico https://elpais.com/clima-y-medio-ambiente/2023-11-07/la-ocu-y-otras-asociaciones-de-12-paises-denuncian-en-bruselas-a-los-envasadores-de-botellas-de-agua-por-ecopostureo.html
@communia · Post #37311 · 19.10.2023 г., 08:13
#Alemania#Desindustrialización y coste del #plástico «La ejecutiva alega el declive financiero de la compañía al aumento de costes en las materias primas derivadas del petróleo (recordemos la alta dependencia alemana del suministro ruso) y se había duplicado la inversión publicitaria tratando de revertir un balance de ventas en caída libre. El único respiro financiero en los últimos años fue durante la pandemia, cuando el sector juguetero en general experimentó un auge en sus ventas debido al cambio en los hábitos de ocio de los niños en aquellos meses.» https://www.xataka.com/magnet/clicks-playmobil-frente-a-extincion-compania-sufre-peores-crisis-su-historia
@communia · Post #37554 · 09.11.2023 г., 06:58
#PactoVerde. Las soluciones de la industria #química no pueden resolver el problema del #plástico https://cen.acs.org/environment/recycling/Chemical-recycling-wont-fix-plastic/101/web/2023/11
Hashtags
@communia · Post #37504 · 05.11.2023 г., 11:01
#PactoVerde. El #reciclaje del #plástico no es rentable. Resultado, las empresas mienten y todos tan felices https://es.gizmodo.com/un-informe-califica-el-reciclaje-de-productos-quimicos-1850989027
Hashtags
@communia · Post #37071 · 27.09.2023 г., 19:05
#Contaminación#Gas y #Petróleo. Hacia la multiplicación del #plástico y el #biodiesel https://forococheselectricos.com/2023/09/petrolera-exxon-aumentara-produccion-quimicos-reduccion-consumo-coche-electrico.html La #UE echa freno a su ley para reducir #plástico https://www.euractiv.com/section/energy-environment/news/eus-controversial-packaging-waste-law-facing-delays/