[Python-Dev] Making SocketHandler safe for use with non-pickleable objects

2022-06-20 Thread roy
I've been working on a bug in django where if you configure a logging.handlers.SocketHandler in the django logging config, it gets a TypeError because it tries to log a HttpRequest object, which can't be pickled. I'm slowly coming to the conclusion that this isn't a django bug, and the right f

[Python-Dev] New functionality for unittest.mock side_effect

2022-04-26 Thread Roy Smith
I often want a side_effect of "if called with foo, return bar" functionality. This is really useful when the order of calls to your mock is indeterminate, so you can't just use an iterable. What I end up doing is writing a little function: def f(x): data = { 'foo': 'ba

[Python-Dev] bz2.BZ2File doesn't support name?

2021-04-26 Thread roy
I was surprised recently to discover that BZ2File (at least in 3.7) doesn't have a name attribute. Is there some fundamental reason name couldn't be supported, or is it just a bug that it wasn't implemented? ___ Python-Dev mailing list -- python-dev@py

[Python-Dev] Expose environment variable for Py_Py3kWarningFlag (Issue 28288)

2016-11-23 Thread Roy Williams
th py.test). With this patch I'd be able to set the `PYTHON3WARNINGS` environment variable to ensure I get warnings everywhere. Thanks, let me know what you think, Roy ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/m

Re: [Python-Dev] async/await behavior on multiple calls

2015-12-16 Thread Roy Williams
/await which is why I found the existing behavior to be so unintuitive. To Barry and Kevin's point, this problem is exacerbated by a lack of documentation and examples that one can follow to learn about the Pythonic approach to async/await. Thanks, Roy On Tue, Dec 15, 2015 at 7:33 PM, Yury Seli

Re: [Python-Dev] async/await behavior on multiple calls

2015-12-15 Thread Roy Williams
r manner to other languages implementing async/await and would remain compatible with existing code using asyncio. What's your thoughts? Thanks, Roy On Tue, Dec 15, 2015 at 3:35 PM, Kevin Conway wrote: > I think there may be somewhat of a language barrier here. OP appears to be > mixin

Re: [Python-Dev] async/await behavior on multiple calls

2015-12-15 Thread Roy Williams
without having to enforce that the DAG is actually a tree. I can of course write a function to wrap everything in Futures, but this seems to be against the spirit of async/await. Thanks, Roy On Tue, Dec 15, 2015 at 12:08 PM, Guido van Rossum wrote: > I think this goes back all the way to a

[Python-Dev] async/await behavior on multiple calls

2015-12-15 Thread Roy Williams
esult or throws any thrown exceptions. It doesn't appear that the Awaitable class in Python has a `result` or `exception` field but `asyncio.Future` does. Would it make sense to shift from having `await` functions return a ` *Future-like`* return object to returning a Future? Thanks, Roy ___

Re: [Python-Dev] What if replacing items in a dictionary returns the new dictionary?

2011-05-05 Thread Roy Hyunjin Han
>> 2011/4/29 Roy Hyunjin Han : >> It would be convenient if replacing items in a dictionary returns the >> new dictionary, in a manner analogous to str.replace(). What do you >> think? >> >># Current behavior >>x = {'key1': 1}

Re: [Python-Dev] What if replacing items in a dictionary returns the new dictionary?

2011-04-29 Thread Roy Hyunjin Han
>   You can implement this in your own subclass of dict, no? Yes, I just thought it would be convenient to have in the language itself, but the responses to my post seem to indicate that [not returning the updated object] is an intended language feature for mutable types like dict or list. class

Re: [Python-Dev] What if replacing items in a dictionary returns the new dictionary?

2011-04-29 Thread Roy Hyunjin Han
2011/4/29 R. David Murray : > 2011/4/29 Roy Hyunjin Han : >> It would be convenient if replacing items in a dictionary returns the >> new dictionary, in a manner analogous to str.replace() > > This belongs on python-ideas, but the short answer is no.  The > general languag

[Python-Dev] What if replacing items in a dictionary returns the new dictionary?

2011-04-29 Thread Roy Hyunjin Han
It would be convenient if replacing items in a dictionary returns the new dictionary, in a manner analogous to str.replace(). What do you think? :: # Current behavior x = {'key1': 1} x.update(key1=3) == None x == {'key1': 3} # Original variable has changed # Possible behavior

Re: [Python-Dev] mkdir -p in python

2010-07-21 Thread Clinton Roy
't like writing code that depends on particular > errno values, because I don't trust it to work cross- > platform. I use errno.EEXIST instead of a magic number. later, -- Clinton Roy Software Engineer Global Change Institute University of Queensland humbug.org.au  - Brisba

Re: [Python-Dev] Splitting something into two steps produces different behavior from doing it in one fell swoop in Python 2.6.2

2009-12-14 Thread Roy Hyunjin Han
On Fri, Dec 11, 2009 at 7:59 PM, Nick Coghlan wrote: > It follows the standard left-to-right evaluation order within an expression: > > () > > (i.e. a function call always determines which function is going to be > called before determining any arguments to be passed) > > Splitting it into two lin

Re: [Python-Dev] Splitting something into two steps produces different behavior from doing it in one fell swoop in Python 2.6.2

2009-12-11 Thread Roy Hyunjin Han
On Fri, Dec 11, 2009 at 2:43 PM, MRAB wrote: > John Arbash Meinel wrote: >> >> Roy Hyunjin Han wrote: >>> >>> While debugging a network algorithm in Python 2.6.2, I encountered >>> some strange behavior and was wondering whether it has to do with some

[Python-Dev] Splitting something into two steps produces different behavior from doing it in one fell swoop in Python 2.6.2

2009-12-11 Thread Roy Hyunjin Han
While debugging a network algorithm in Python 2.6.2, I encountered some strange behavior and was wondering whether it has to do with some sort of code optimization that Python does behind the scenes. After initialization: defaultdict(, {1: set([1])}) Popping and updating in two steps

[Python-Dev] About adding a new iterator method called "shuffled"

2009-03-24 Thread Roy Hyunjin Han
I know that Python has iterator methods called "sorted" and "reversed" and these are handy shortcuts. Why not add a new iterator method called "shuffled"? >>> for x in shuffled(range(5)): >>>print x >>> 3 >>> 1 >>> 2 >>> 0 >>> 4 Currently, a person has to do the following because random.sh

Re: [Python-Dev] PyCon 2009: Call for sprint projects

2009-02-25 Thread Roy H. Han
Hi Jacob, Will there be GeoDjango/OpenLayers subsprint in the Django sprint? Thanks, RHH On Mon, Feb 9, 2009 at 8:27 PM, Jacob Kaplan-Moss wrote: > Python-related projects: join the PyCon Development Sprints! > > The development sprints are a key part of PyCon, a chance for the contributors > t

Re: [Python-Dev] beginning developer: fastest way to learn how Python 3.0 works

2008-12-13 Thread Roy Lowrance
productive way to proceed? Roy On Sat, Dec 13, 2008 at 1:18 PM, Aahz wrote: > On Sat, Dec 13, 2008, Roy Lowrance wrote: >> >> What's the best way to learn how Python 3.0 works? > > Post to the correct mailing list. ;-) > > Use comp.lang.python or python-tutor o

[Python-Dev] beginning developer: fastest way to learn how Python 3.0 works

2008-12-13 Thread Roy Lowrance
I'd like to learn how Python 3.0 works. I've downloaded the svn. I am wondering what the best way to learn is: - Just jump in? - Or perhaps learn A before B? - Or maybe there is a tutorial for those new to the internals? What's the best way to learn how Python

Re: [Python-Dev] Python developers are in demand

2007-10-25 Thread Anthony Roy
ow paid sys admin type roles, or are based in London. Cheers, -- Anthony Roy ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

[Python-Dev] fileinput module tests

2006-12-09 Thread Anthony Roy
Hi all, I have a patch for the fileinput.FileInput class, adding a parameter to the __init__ method called write_mode in order to specify the write mode when using the class with the inplace parameter set to True. Before I submit the patch, I've added a test to the test module, and noticed that t