[Python-ideas] Re: Explicitly defining a string buffer object (aka StringIO += operator)

2020-04-02 Thread C. Titus Brown via Python-ideas
(Folks, sorry for letting this spam slip through! It was reasonably clever 
compared to most of the stuff we get :)

best,
—titus

> On Apr 2, 2020, at 12:49 AM, gstindianews.i...@gmail.com wrote:
> 
> ya that's what I also get for quickly whipping something up and not
> testing it. Good catch from the end. I found another similar at 
> https://gstindianews.info. But you get the idea - a simple wrapper around
> a list is going to be way better than a wrapper around StringIO.  i
> 
> jayesh
> ___
> Python-ideas mailing list -- python-ideas@python.org
> To unsubscribe send an email to python-ideas-le...@python.org
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at 
> https://mail.python.org/archives/list/python-ideas@python.org/message/3DR32EZ3DQFL67A6JGUQSP7YMIXOJC23/
> Code of Conduct: http://python.org/psf/codeofconduct/

___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/3O4CQDWSHVMLFWI26T3J42BTVEJVRVYE/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] MODERATOR - in re "Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments"

2020-06-28 Thread C. Titus Brown via Python-ideas
Hello everyone,

the above referenced thread is getting heated and unfriendly; I’ve already 
rejected a message as inappropriately ad hominem. Please take some time to 
(re)consider the content of your e-mails before sending them. We may turn on 
default moderation if it continues.

As a reminder:

The code of conduct that governs this list (and all Python spaces) is here, 
https://www.python.org/psf/conduct/.

If you want to discuss the python code of conduct and its applicability to this 
thread (or anything else), python-ideas is not the place to do so. You may do 
so privately with the moderators (python-ideas-ow...@python.org should reach 
us), or with the CoC working group, at conduct...@python.org.

thanks,
—titus

___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/YDE3PDS24UX352RA3MUK47IX3N2R4WNU/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: [Python-Dev] Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-06-29 Thread C. Titus Brown via Python-ideas
Hi all,

as a moderator of python-ideas, I’ve asked postmaster to place python-ideas 
into emergency moderation. (I do not have the tools to do so myself.) I’m 
willing to review messages individually as needed.

best,
—titus

> On Jun 29, 2020, at 9:24 AM, Abdur-Rahmaan Janhangeer  
> wrote:
> 
> Threads like these are meaningless, does not provide any learning
> value and is nowhere near the single vs double quote thread.
> 
> It opens the gap for people who are not concerned about development
> jump in the game shifting the focus away while nurturing a culture of thrash
> I mean you tend to ignore threads from python-dev and python-ideas which 
> is not probably why you subscribed in the first place
> 
> This is not the first time i am saying that you can fly around the world on 
> official
> Python mailing lists. But it's regrettable that it's the first time i am 
> seeing people
> telling that they should educate others and things like that. It can be based 
> on the
> argument and circle around it but personal attacks are off limit
> 
> If this was a Github issue, i don't think you list moderators would have 
> dragged it
> around that much. Worst case scenario, someone would have been pinged and 
> the issue taken care of. A PR or closing and you are done.
> 
> I raised the issue of closing a mail thread before and the impractical nature 
> of 
> it was discussed but maybe warnings and continued posting after the warning
> results in ban can be enforced
> 
> And it's annoying that it got dragged to two mailing lists. I respect Python 
> people
> and i am always eager to follow some C code discussions, deprecating this C 
> API
> etc. It's a new world for me.
> 
> Maybe active list members should sign a convention or a vetting process can 
> be setup
> before we can discuss it on the lists. Not ideal but might be useful.
> 
> Kind Regards,
> 
> Abdur-Rahmaan Janhangeer
> compileralchemy | blog 
> github
> Mauritius
> 
> 
> On Mon, Jun 29, 2020 at 8:11 PM David Mertz  wrote:
> The commit message is simply silly. It introduces numerous contentious and 
> false claims that have nothing whatsoever to do with the small wording 
> change. It misunderstands how language, culture, history, and indeed white 
> supremacism, work.
> 
> I would recommend amending the commit message.
> 
> The underlying change itself is reasonable, and to my mind a small 
> improvement. There was unnecessary specificity in using Strunk and White as 
> reference, and not, say, William Zinsser's _On Writing Well_, which is almost 
> as well known. In the concrete, it would be exceedingly rare for these to 
> provide conflicting advice on a specific code comment.
> 
> On Mon, Jun 29, 2020 at 7:34 AM Richard Damon  
> wrote:
> On 6/29/20 6:22 AM, Nathaniel Smith wrote:
> > and describes the
> > old text as a "relic", which is another way of saying that the
> > problems were only there by historical accident, rather than by anyone
> > intentionally keeping it there. 
> 
> I would say that say that I have seen the term "relic" being used as a
> 'weaponized' word to imply that the old thing WAS there intentionally as
> a repressive measure. I am not saying that this usage was intended to be
> used that way, but just as the old wording was taken as offensive to
> some due to implication, I can see that message as offensive to others
> due to implication, all because some people are easy to offend.
> 
> -- 
> Richard Damon
> ___
> Python-Dev mailing list -- python-...@python.org
> To unsubscribe send an email to python-dev-le...@python.org
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at 
> https://mail.python.org/archives/list/python-...@python.org/message/6EN5RNF5CFDKCF3ZYQV53XH5KTBCSAQ6/
> Code of Conduct: http://python.org/psf/codeofconduct/
> 
> 
> -- 
> The dead increasingly dominate and strangle both the living and the 
> not-yet born.  Vampiric capital and undead corporate persons abuse 
> the lives and control the thoughts of homo faber. Ideas, once born, 
> become abortifacients against new conceptions.
> ___
> Python-Dev mailing list -- python-...@python.org
> To unsubscribe send an email to python-dev-le...@python.org
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at 
> https://mail.python.org/archives/list/python-...@python.org/message/AMH7WMUOOZ4KAFYPVZO2BA5AQLWTCDR6/
> Code of Conduct: http://python.org/psf/codeofconduct/
> ___
> Python-Dev mailing list -- python-...@python.org
> To unsubscribe send an email to python-dev-le...@python.org
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at 
> https://mail.python.org/archives/list/python-...@python.org/message/B426T6LT3TAFJHDNWBBAEWPTZKAFEM2K/
> Code of Conduct: http://python.org/psf/codeofconduct/

_

[Python-ideas] Context manager for csv module 'reader' and 'DictReader'?

2021-09-05 Thread C. Titus Brown via Python-ideas
Hi all,

the product of Sunday morning idle curiosity...

I’ve been using the csv module a lot, and I’m wondering if there would be value 
in adding a standard mechanism for opening a CSV file (correctly) using a 
context manager?

So, instead of

with open(filename, newline=“”) as fp:
   r = csv.DictReader(fp)
   for row in r:
  …

support something like

with csv.DictReader.open(filename) as r:
   for row in r:
  …

? And something similar for ‘csv.reader’? I’m not wedded to the details here.

The two main reasons I think this might be a positive addition are -

* you wouldn’t have to know or remember the right way to open a CSV file 
(newline=“”).
* it elides very common code.

but perhaps there are things I’m missing here?

As a side note, I think ‘csv.reader’ could usefully be renamed to something 
else (maybe just Reader?), since it’s kind of out of sync with the CamelCase 
used in ‘DictReader’. But maybe that’s just an attempt at foolish consistency 
:).

best,
—titus

___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/EKHYCTYMXZG3VI4JYFA3Y3LD3ZNMI3IX/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: Context manager for csv module 'reader' and 'DictReader'?

2021-09-06 Thread C. Titus Brown via Python-ideas
Thanks for your comments, everyone!

Right, I’m struggling to figure out Greg's example :). Maybe Greg missed that 
DictReader.open didn’t exist and was in fact what I was asking for!

(contextlib.closing is great, thank you for that!)

Anyway, just to re-up the original points and add a few -

* opening a CSV file with the right newline setting and then applying 
csv.reader and csv.DictReader is super common.
* newline=“” has important ramifications for Windows functionality, as we 
 recently discovered when we tried to extend sourmash with windows compat.
* yes it’s very easy to write my own utility function to do this, and in fact I 
have done so …repeatedly. :)
* no one is proposing to remove any functionality.
* I like Chris Barker’s comment,

“””
it ended with the idea that maybe there should be a PEP for a common interface 
for all “file” readers — eg JSON, CSV, etc.. And that interface could be 
supported by third party libs. That interface *maybe* would include a single 
step load from a path-like functionality.
“””

I’m +0 on David Mertz’s suggestion,

“”"
Most Pandas read methods take either a path-like argument or a file-like 
argument, and figure out which it is by introspection when called. Actually, 
most of them even accept a URL-like argument as well 

I don't think this is a terrible approach. It doesn't make things quite as 
explicit as the standard library generally does. But it's convenient, and 
there's no real ambiguity.
“””

mostly because when we’ve done this in our own packages, I've struggled to 
figure out the best method to figure out if something is file-like. For 
example, it looks like ‘csv.DictReader’ will take any iterable, which means 
passing in a string is problematic; perhaps we could be looking for read or 
readline instead? Codifying that in some standard way could be nice.

best,
—titus

> On Sep 5, 2021, at 5:30 PM, Oscar Benjamin  wrote:
> 
> On Mon, 6 Sept 2021 at 01:13, Greg Ewing  wrote:
>> 
>> On 6/09/21 3:07 am, C. Titus Brown via Python-ideas wrote:
>>> with csv.DictReader.open(filename) as r:
>>>for row in r:
>>>   …
>> 
>> You can do this now:
>> 
>> from contextlib import closing
>> with closing(csv.DictReader.open(filename)) as r:
>>...
> 
> What version of Python are you using?
> 
>>>> import csv
>>>> csv.DictReader.open
> Traceback (most recent call last):
>  File "", line 1, in 
> AttributeError: type object 'DictReader' has no attribute 'open'
> 
>> IMO this is preferable than going around adding context manager
>> methods to everything that has open-like functionality.
> 
> I disagree. It would be better if resource acquisition (e.g. opening a
> file) always took place in an __enter__ method so that it could always
> be under control of a with statement. Having closing as a separate
> function negates that because there has to be a separate function that
> acquires the resource before the closing function is called and hence
> before __enter__ is called.
> 
> --
> Oscar
> ___
> Python-ideas mailing list -- python-ideas@python.org
> To unsubscribe send an email to python-ideas-le...@python.org
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at 
> https://mail.python.org/archives/list/python-ideas@python.org/message/AR6IHZ2HY4TKZXKANUGA7HTPDQMBCLRC/
> Code of Conduct: http://python.org/psf/codeofconduct/

___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/CNMK76RBWQKVP6F3IZIDTCPFDTFI7HV4/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] PEP-671 thread - let's take a break, please.

2021-12-09 Thread C. Titus Brown via Python-ideas
Hi all,

the PEP-671 thread is starting to accumulate an awful lot of heat. I’ve placed 
the list into emergency moderation for the day to give everyone a chance to 
take a step back and (re)consider their next e-mails. Thank you!

best,
—titus

(list moderator)

___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/PPZIULPIVZNI7YYCTRHWT5UKU7VB6LGZ/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] 'frozen set' discussion - please consider taking some time off.

2022-01-21 Thread C. Titus Brown via Python-ideas
Hi all,

python-ideas moderator here. It’d be great if y’all could take a few days to 
cool off the frozen set discussion, which is veering off the rails a little bit 
into emotional language.

I’ll keep an eye on it and put emergency moderation into effect if I must, but 
it’d be nicer if I didn’t feel the need to do that.

thanks,
—titus

___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/W5MS2FTUMSKYIFXDPPYJPIS3CFW43JYP/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: Idea: Tagged strings in python

2022-12-17 Thread C. Titus Brown via Python-ideas


> On Dec 17, 2022, at 10:08 AM, e...@emilstenstrom.se wrote:
> 
> Bruce Leban wrote:
>>> Try googling "python-ideas string prefixes". Doing mimimal diligence is a
>>> reasonable expectation before writing up an idea.
> 
> Thanks for the query "string prefixes". I tried other queries but not that 
> one. I ended my first message with "I hope I didn't break any unspoken rules" 
> and it seems I have. 

My two cents (speaking as long-term observer, not as the moderator, or perhaps 
in addition to the moderator ;) - I think your ask was appropriate, and I think 
the response of “here’s the search you should do!” was great.

Personally I think we could do without the implication that you should have 
done more due diligence. python-ideas is PRECISELY for this kind of question. 
Other forums should have a higher barrier to entry (like python-dev), but not 
python-ideas.

best,
—titus

___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/HOY4DYOSV5723735LI3BOJY7UUKD6NGK/
Code of Conduct: http://python.org/psf/codeofconduct/