Re: Issues with "twistd" in Twisted 16.4.0

2016-09-01 Thread Kevin Conway
Hi, you might not get much of an answer for this on the Python mailing list. I suggest sending your question to the Twisted mailing list instead: https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python. On Thu, Sep 1, 2016 at 7:12 AM juraseg wrote: > Also,

Re: Namespaces are one honking great idea

2016-07-03 Thread Kevin Conway
>> Regardless, all use cases you've listed are already satisfied by use of >> the static and class method decorators. Methods decorated with these do >> not require an instance initialization to use. > And are significantly less easy to use, as the functions MUST refer to each > other by their

Re: Namespaces are one honking great idea

2016-07-02 Thread Kevin Conway
") print(CustomNs.stateful_data) CustomNs.mutate() print(CustomNs.stateful_data) For the proponents of namespace, what is deficient in the above example that necessitates a language change? On Sat, Jul 2, 2016, 00:02 Random832 <random...@fastmail.com> wrote: > On Fri, Jul 1, 2016,

Re: Namespaces are one honking great idea

2016-07-01 Thread Kevin Conway
I believe the namespace object you are referring to is exactly a class. IIRC, classes came about as a "module in a module". Regardless, all use cases you've listed are already satisfied by use of the static and class method decorators. Methods decorated with these do not require an instance

Re: What should a decorator do if an attribute already exists?

2016-05-16 Thread Kevin Conway
> I have a decorator that adds an attribute to the decorated function I might try to argue that this is not actually a decorator or, at least, this is not a great decorator pattern for Python. Adding the attribute to the function object implies you need to access it at some later point. If so

Re: asyncio - run coroutine in the background

2016-02-20 Thread Kevin Conway
> getaddrinfo is a notorious pain but I think it's just a library issue; an async version should be possible in principle. How does Twisted handle it? Does it have a version? I think we're a little outside the scope of OP's question at this point, but for the sake of answering this: There are

Re: asyncio - run coroutine in the background

2016-02-16 Thread Kevin Conway
s:87d1rwpwo2....@elektro.pacujo.net. > .. > > > > Kevin Conway <kevinjacobcon...@gmail.com>: > > > > > If you're handling coroutines there is an asyncio facility for > > > "background tasks". The ensure_future [1] will take a coroutine, &g

Re: asyncio - run coroutine in the background

2016-02-16 Thread Kevin Conway
If you're handling coroutines there is an asyncio facility for "background tasks". The ensure_future [1] will take a coroutine, attach it to a Task, and return a future to you that resolves when the coroutine is complete. The coroutine you schedule with that function will not cause your current

Re: Python's import situation has driven me to the brink of imsanity

2016-02-07 Thread Kevin Conway
, but how do > you develop it? Say you are working on a change that modifies both email.py > and reports.py. Do you run setup.py every time you make a change in > email.py? > > On Sunday, February 7, 2016 at 1:35:15 AM UTC-5, Kevin Conway wrote: > > > My question is: is t

Re: Python's import situation has driven me to the brink of imsanity

2016-02-06 Thread Kevin Conway
> My question is: is this crazy? Please tell me there's a better way and I just wasted my time creating this package. There is a better way and you have wasted your time creating this package. I hear your problem statement as asking two questions. The first is: What is the right way to include

Re: How a module is being marked as imported?

2016-02-04 Thread Kevin Conway
As an attempt to answer your original question, Python doesn't explicitly mark a module as done. It does keep imports cached in sys.modules, though. The behaviour you describe where later imports get the same module object is driven by that cache. There are cases, such as cyclical imports, where

Re: Cannot step through asynchronous iterator manually

2016-01-30 Thread Kevin Conway
To address the original question, I don't believe a next() equivalent for async iterables has been added to the standard library yet. Here's an implementation from one of my projects that I use to manually get the next value: https://bpaste.net/show/e4bd209fc067. It exposes the same interface as

Re: Cannot step through asynchronous iterator manually

2016-01-30 Thread Kevin Conway
https://bpaste.net/show/14292d2b4070. Thanks for calling that out. Note to self: Review old code before copy/pasta into the mail list. On Sat, Jan 30, 2016 at 6:57 AM Chris Angelico <ros...@gmail.com> wrote: > On Sat, Jan 30, 2016 at 11:35 PM, Kevin Conway > <kevinjacobcon...@gmail.com&g