[Python-ideas] Proposal: Complex comprehensions containing statements

2020-02-20 Thread Alex Hall
This is a proposal for a new syntax where a comprehension is written as the appropriate brackets containing a loop which can contain arbitrary statements. Here are some simple examples. Instead of: [ f(x) for y in z for x in y if g(x) ] one may write:

[Python-ideas] Re: Specify number of items to allocate for array.array() constructor

2020-02-20 Thread Christopher Barker
On Thu, Feb 20, 2020 at 12:43 PM Steve Jorgensen wrote: > > > But frankly, it would be a rare case where this would be noticeable. > > -CHB > > Maybe uncommon, but I don't know about rare. Let's say you want to perform > list-wise computations, making new lists with results of operations on >

[Python-ideas] Re: PYTHONLOGGING env variable

2020-02-20 Thread Guido van Rossum
+1 On Thu, Feb 20, 2020 at 11:46 Alex Hall wrote: > Christopher Barker wrote: > > I think it’s a “Bad Idea” to use an environment variable — who knows what > > Python script may be running on a given system? > > But a standard command line argument to the interpreter could be useful. > > Can

[Python-ideas] Re: PYTHONLOGGING env variable

2020-02-20 Thread Kyle Stanley
> Let's plan a cmdline argument then. > Should we go for -L much like -W? Yeah, I think a command-line argument is much more reasonable, less likely to cause issues with other implementations of logging configuration, and more practically useful. I'd be +1 on something like a `-L`. On Thu, Feb

[Python-ideas] Re: Specify number of items to allocate for array.array() constructor

2020-02-20 Thread Stephan Hoyer
On Thu, Feb 20, 2020 at 2:11 PM Chris Angelico wrote: > On Fri, Feb 21, 2020 at 8:52 AM Stephan Hoyer wrote: > > > > On Thu, Feb 20, 2020 at 12:41 PM Steve Jorgensen > wrote: > >> > >> Christopher Barker wrote: > >> ... > >> > > Perhaps the OP wanted the internal array size initialized, but

[Python-ideas] Re: Specify number of items to allocate for array.array() constructor

2020-02-20 Thread Chris Angelico
On Fri, Feb 21, 2020 at 8:52 AM Stephan Hoyer wrote: > > On Thu, Feb 20, 2020 at 12:41 PM Steve Jorgensen wrote: >> >> Christopher Barker wrote: >> ... >> > > Perhaps the OP wanted the internal array size initialized, but not used. >> > Currently the internal array will automatically be

[Python-ideas] Re: Specify number of items to allocate for array.array() constructor

2020-02-20 Thread Stephan Hoyer
On Thu, Feb 20, 2020 at 12:41 PM Steve Jorgensen wrote: > Christopher Barker wrote: > ... > > > Perhaps the OP wanted the internal array size initialized, but not > used. > > Currently the internal array will automatically be reallocated to grow as > > needed. Which could be a performance hit if

[Python-ideas] Re: Specify number of items to allocate for array.array() constructor

2020-02-20 Thread Steve Jorgensen
Christopher Barker wrote: ... > > Perhaps the OP wanted the internal array size initialized, but not used. > Currently the internal array will automatically be reallocated to grow as > needed. Which could be a performance hit if you know it’s going to grow > large. > But frankly, it would be a

[Python-ideas] Re: Add Binary module.

2020-02-20 Thread Steve Jorgensen
Guido van Rossum wrote: > On Thu, Feb 20, 2020 at 01:39 Steve Jorgensen ste...@stevej.name wrote: > > It seems to me that this could simply be a package on > > pypi rather than > > being added to the Python standard library. > > Sure. But the interesting part is how to design the API. I’ve seen a

[Python-ideas] Re: PYTHONLOGGING env variable

2020-02-20 Thread Alex Hall
Christopher Barker wrote: > I think it’s a “Bad Idea” to use an environment variable — who knows what > Python script may be running on a given system? > But a standard command line argument to the interpreter could be useful. Can you clarify what the concern is about other Python scripts

[Python-ideas] Re: Add Binary module.

2020-02-20 Thread Guido van Rossum
On Thu, Feb 20, 2020 at 01:39 Steve Jorgensen wrote: > It seems to me that this could simply be a package on pypi rather than > being added to the Python standard library. > Sure. But the interesting part is how to design the API. I’ve seen a number of interesting ideas in this thread. --

[Python-ideas] Re: PYTHONLOGGING env variable

2020-02-20 Thread Christopher Barker
I think it’s a “Bad Idea” to use an environment variable — who knows what Python script may be running on a given system? But a standard command line argument to the interpreter could be useful. -CHB On Thu, Feb 20, 2020 at 8:51 AM Mike Miller wrote: > > On 2020-02-19 17:12, Bar Harel wrote:

[Python-ideas] Re: PYTHONLOGGING env variable

2020-02-20 Thread Mike Miller
On 2020-02-19 17:12, Bar Harel wrote: Another idea I've had that may be of use: PYTHONLOGGING environment variable. Setting PYTHONLOGGING to any log level or level name will initialize logging.basicConfig() with that appropriate level. Another option would be that -x dev or a different -x

[Python-ideas] Re: Specify number of items to allocate for array.array() constructor

2020-02-20 Thread Christopher Barker
On Thu, Feb 20, 2020 at 7:34 AM Serhiy Storchaka wrote: > 20.07.11 23:48, Sven Rahmann пише: > > What's missing is the possiblity to specify the final size of the > > array (number of items), especially for large arrays. > > array.array(typecode, [fillvalue]) * n Perhaps the OP wanted the

[Python-ideas] Re: Pandas rookie

2020-02-20 Thread David Mertz
This last is for discussion of changes to the Python language itself, in particular the CPython reference implementation. Python-list or a Pandas forum are appropriate for this question. That said, it sounds like you want df.value_counts(). But if not, follow-up in a more relevant place. On Thu,

[Python-ideas] Re: Specify number of items to allocate for array.array() constructor

2020-02-20 Thread Serhiy Storchaka
20.07.11 23:48, Sven Rahmann пише: At the moment, the array module of the standard library allows to create arrays of different numeric types and to initialize them from an iterable (eg, another array). What's missing is the possiblity to specify the final size of the array (number of items),

[Python-ideas] Re: Specify number of items to allocate for array.array() constructor

2020-02-20 Thread Steve Jorgensen
I discovered that same trick. It would be nice to have that specifically indicated in the documentation until/unless a length argument is added to the constructor. It would be nice for the supported operators to be documented at all, actually. I didn't realize that array.array had

[Python-ideas] Re: Pandas rookie

2020-02-20 Thread James Lu
On Wed, Feb 19, 2020 at 5:23 PM FilippoM wrote: > > Hi, I've got a Pandas data frame that looks like this > > In [69]: data.head > Out[69]: > 0 AndroidVIDEO_OK > 1 Android 4.2.2 VIDEO_OK > 2 Android 9 VIDEO_OK > 3 iOS 13.3 VIDEO_OK > 4

[Python-ideas] Re: PYTHONLOGGING env variable

2020-02-20 Thread Bar Harel
> > > If you want it only temporarily for debugging purposes, or permanently > for all scripts in your system, it's not really feasible. > > Hmm, I'm not sure that I like the idea of overriding the default logging > level being set system-wide, or that there would be an especially strong > use

[Python-ideas] Re: Add Binary module.

2020-02-20 Thread Steve Jorgensen
It seems to me that this could simply be a package on pypi rather than being added to the Python standard library. ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Ability to specify item sizes for array.array instances in a platform-independent way

2020-02-20 Thread Steve Jorgensen
Currently, if I know that I want an `array.array` object with `itemsize` of 4 there is no way to do that without first determining what the item sizes are for `'i'`/`'I'` and `'l'`/`'L'` on the current platform. Presumably, things could get even more hairy with future platforms. Below are