Re: Leading 0's syntax error in datetime.date module (Python 3.6)

2018-05-11 Thread Jon Ribbens
On 2018-05-10, Chris Angelico <ros...@gmail.com> wrote: > On Fri, May 11, 2018 at 5:04 AM, Jon Ribbens <jon+use...@unequivocal.eu> > wrote: >> This whole thread is reminding me PHP 2, which would magically treat >> the second parameter of ChMod() as octal, bec

Re: Leading 0's syntax error in datetime.date module (Python 3.6)

2018-05-11 Thread Jon Ribbens
On 2018-05-11, Grant Edwards wrote: > On 2018-05-11, Gene Heskett wrote: >> Computers haven't read a single 8 bit byte in years, some reading >> 128 or 256 bits in a single read cycle today. > > Nonsense. All modern CPUs that I'm aware of still

Re: urllib3 1.23 breaks API

2018-06-06 Thread Jon Ribbens
On 2018-06-06, Cecil Westerhof wrote: > I had installed urllib3 1.22 for Python3. I upgraded it to 1.23. This > broke the requirements for requests 2.18.4: > requests 2.18.4 has requirement urllib3<1.23,>=1.21.1, but you'll have > urllib3 1.23 which is incompatible > > I downgraded to 1.22,

Re: Stefan's headers [was:Names and identifiers]

2018-06-10 Thread Jon Ribbens
On 2018-06-08, Chris Angelico wrote: > Yes, this is true. It's not copyright that is unenforceable, but the > copyright notice in his message. Nobody is denying that he owns his > own words; but by posting them on a public forum, he - like everyone > else here - is implicitly granting us the

Re: Stefan's headers [was:Names and identifiers]

2018-06-10 Thread Jon Ribbens
On 2018-06-10, Ben Bacarisse wrote: > Jon Ribbens writes: > >> I'd suggest that since the processes he's purporting to disallow are >> entirely standard and automated and he knows full well they exist and >> that there is no mechanism by which they could be affected by h

Re: documentation on read.encode

2018-01-16 Thread Jon Ribbens
On 2018-01-16, Larry Martell wrote: > Yeah I saw it mentioned in a SO post that was java related. Wondering > if there is some way to do the same in python. base64.b64encode(foo) -- https://mail.python.org/mailman/listinfo/python-list

Re: requests / SSL blocks forever?

2018-01-15 Thread Jon Ribbens
On 2018-01-15, Nagy László Zsolt wrote: >> In other words: if the server starts to send the response, but then >> stops sending it (without closing the connection), then this will block >> forever anyway. > Or maybe I misunderstood the docs and the timeout means the max.

Re: Right way to io.open(...) an existing file object in Python 2.7?

2018-01-16 Thread Jon Ribbens
On 2018-01-16, Skip Montanaro wrote: > I'd like to take advantage of the seekable() method of io.IOBase with > existing open file objects, especially the standard in/out/err file > objects. If it's difficult to imagine a circumstance in which you would want to seek on

Re: requests / SSL blocks forever?

2018-01-13 Thread Jon Ribbens
On 2018-01-13, Nagy László Zsolt wrote: > I have a multi threaded Windows service written in Python. It is running > on 3.6.2.  Sometimes I cannot stop the service, because on of the > threads won't exit. I have narrowed down the problem to request and > _lib.SSL_read. (a)

Re: Pylint false positives

2018-08-15 Thread Jon Ribbens
On 2018-08-15, Steven D'Aprano wrote: > On Tue, 14 Aug 2018 15:18:13 +0000, Jon Ribbens wrote: >> On 2018-08-14, Steven D'Aprano >> wrote: >>> # === process abstract methods en masse === >>> for name in "method_a method_b method_c method_d

Re: Pylint false positives

2018-08-17 Thread Jon Ribbens
On 2018-08-17, Steven D'Aprano wrote: > On the other hand, your objection to the following three idioms is as > good an example of the Blurb Paradox as I've ever seen. Do you mean the Blub Paradox? If so, you're misunderstanding or at least misapplying it. >> * code running directly under

Re: Pylint false positives

2018-08-14 Thread Jon Ribbens
On 2018-08-14, Steven D'Aprano wrote: > If there really are a lot of such missing methods, I'd consider writing > something like this: > > class A: > def __init__(self, ...): > ... > > # === process abstract methods en masse === > for name in "method_a method_b method_c

Re: Users banned

2018-07-17 Thread Jon Ribbens
On 2018-07-17, Thomas Jollans wrote: > On 2018-07-16 01:29, Jon Ribbens wrote: >> Do you have any reason to believe the message at the top of the >> thread purporting to ban users was genuinely from the moderators? >> Because there are obvious reasons to believe otherwise.

Re: Reading EmailMessage from file

2018-07-15 Thread Jon Ribbens
On 2018-07-15, Skip Montanaro wrote: > I have an email message in a file (see attached). Attachments don't work here. > something like this should construct an email message from the file: > from email.message import EmailMessage msg = EmailMessage() fp =

Re: Users banned

2018-07-15 Thread Jon Ribbens
On 2018-07-15, Chris Angelico wrote: > On Mon, Jul 16, 2018 at 7:35 AM, Marko Rauhamaa wrote: >> Christian Gollwitzer : >>> Am 15.07.18 um 19:25 schrieb Ethan Furman: The following users are now banned from Python List: ... BartC >>> >>> I don't really think that this is

Re: Reading EmailMessage from file

2018-07-16 Thread Jon Ribbens
On 2018-07-16, Skip Montanaro wrote: >> What are you actually trying to do? You're talking like you're trying >> to read an existing RFC822 email-with-headers from a file, but you're >> showing code that creates a new email with body content set from >> a file, which is a completely different

Re: Cookies not showing up in environ

2018-07-21 Thread Jon Ribbens
On 2018-07-21, abc abc wrote: >> I think one of the main issues is that you don't seem to have decided >> whether you're writing a WSGI application or a Django application. > > Yes, I suppose I thought Django had to use wsgi to process requests, > I didn't know there were 'two' options here.

Re: Cookies not showing up in environ

2018-07-21 Thread Jon Ribbens
On 2018-07-20, abc abc wrote: > Well, I'm so messed up between so many sources and tutorials I don't > know which way is up. I think one of the main issues is that you don't seem to have decided whether you're writing a WSGI application or a Django application. WSGI: def

[issue34124] email.message_from_binary_file documentation is broken

2018-07-16 Thread Jon Ribbens
Change by Jon Ribbens : -- keywords: +patch pull_requests: +7831 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34124> ___ ___ Py

[issue34124] email.message_from_binary_file documentation is broken

2018-07-16 Thread Jon Ribbens
New submission from Jon Ribbens : The documentation for email.message_from_binary_file is missing a line-continuation backslash at the end of the `.. function::` line which means the output formatting is mangled and it has no permalink. -- assignee: docs@python components

Re: Users banned

2018-07-17 Thread Jon Ribbens
On 2018-07-17, Steven D'Aprano wrote: > But neither of these are prohibited by the CoC, neither of these should > be banning offense, and even if they were, he should have had a formal > warning first. > > Preferably TWO formal warnings: the first privately, the second publicly, > and only on

Re: please test the new PyPI (now in beta)

2018-04-18 Thread Jon Ribbens
On 2018-03-27, Chris Angelico wrote: > Any time you see something that requires JavaScript for this, you know > you've found a web site that dates back to... uhh, actually I don't > know. I only have versioning info on MDN back as far as HTML 4.01 ergo > 1999, and the

Re: New PyPI launched, legacy PyPI shutting down April 30

2018-04-18 Thread Jon Ribbens
Going live with the new site while its search function is mostly inoperative seems a bit brave. https://github.com/pypa/warehouse/issues/3746 On 2018-04-18, Noah wrote: > Awesome > > On Mon, Apr 16, 2018 at 8:21 PM, Laura Hampton > wrote: > >>

Re: New PyPI launched, legacy PyPI shutting down April 30

2018-04-19 Thread Jon Ribbens
On 2018-04-18, Tony van der Hoff wrote: > On 18/04/18 13:15, Zbigniew Jędrzejewski-Szmek wrote: >> On Mon, Apr 16, 2018 at 01:21:50PM -0400, Laura Hampton wrote: >>> New PyPI launched, legacy PyPI shutting down April 30[1] >>> >>> Starting today, the canonical Python

Re: So apparently I've been banned from this list

2018-10-01 Thread Jon Ribbens
On 2018-10-01, Roel Schroeven wrote: > I'm not very active here, but I've been lurking for years. In my eyes > Steven has always been active and helpful. Now he has *once* been a > *tiny bit* rude, and he's banned for that? It's not "once", it's a long-standing pattern of behaviour. > As far

Re: [OT] master/slave debate in Python

2018-09-25 Thread Jon Ribbens
On 2018-09-25, Chris Angelico wrote: > On Wed, Sep 26, 2018 at 1:56 AM Jon Ribbens wrote: >> Those things might be on topic on python-dev - although I am sure >> no-one would thank you for continuing this discussion there - but >> this is comp.lang.python/python-list and h

Re: [OT] master/slave debate in Python

2018-09-25 Thread Jon Ribbens
On 2018-09-25, Chris Angelico wrote: > On Tue, Sep 25, 2018 at 11:01 PM Calvin Spealman wrote: >> This entire conversation is inappropriate for this mailing list. Please >> leave this free for people who need to ask and give help with Python, >> regardless of which side of this argument you are

Re: Why do integers compare equal to booleans?

2018-11-16 Thread Jon Ribbens
On 2018-11-16, Steve Keller wrote: > Why do the integers 0 and 1 compare equal to the boolean values False > and True and all other integers to neither of them? Because Python used not to have a boolean type and used the integers 0 and 1 instead, so when the boolean type was introduced True and

Re: chr - what's this?

2019-01-05 Thread Jon Ribbens
On 2019-01-05, Stefan Ram wrote: > r...@zedat.fu-berlin.de (Stefan Ram) writes: >>print( chr( 0x231E )) # Unicode Character 'BOTTOM LEFT CORNER' (U+231E) >> File "~~~\Python\Python37\lib\encodings\cp1252.py", line 19, in encode > > I also have: > > print(chr) > > > . Don't see how the

Re: How to reset TCP connection on Linux?

2018-12-03 Thread Jon Ribbens
On 2018-12-03, Grant Edwards wrote: > How does one reset a TCP connection on Linux? Note that I want to > reset the connection, not close it. Something like the following should work I believe, although I have not tested it: sock.setsockopt( socket.SOL_SOCKET,

Re: Creating type evaluation annotation

2018-12-06 Thread Jon Ribbens
On 2018-12-06, Marek Mosiewicz wrote: > I'm Java developer,but had some experience with Python based > ERP software. It is quite serious application and I feel > unconfortable with not having type checking. I do not say language > should be static, but having checking method signature > is big

Re: Creating type evaluation annotation

2018-12-09 Thread Jon Ribbens
On 2018-12-09, Marek Mosiewicz wrote: > I'm talking about this https://docs.python.org/3/library/typing.html > > I'm not talking about new language. I think it could be nice to have > standard PEP annotations for classes to make type validation or type > hints when writing code. ... > This class

Re: Have I Been Banned?

2018-11-20 Thread Jon Ribbens
On 2018-11-20, Wildman wrote: > In the past I have participated in the group without any > problems. I access the forum through the usenet mirror > and I am still using the same newsreader and account. > Recently I made some followup posts to the group and they > never showed up. Have I been

Re: What Python related git pre-commit hooks are you using?

2018-11-19 Thread Jon Ribbens
On 2018-11-18, Malcolm Greene wrote: > Curious to learn what Python related git pre-commit hooks people are > using? What hooks have you found useful and which hooks have you tried > and abandoned? Appreciate any suggestions for those new to this process. > Background: Window, macOS, and Linux

Re: configparser - which one?

2019-03-26 Thread Jon Ribbens
On 2019-03-26, DL Neil wrote: > On 26/03/19 1:10 PM, Dave wrote: >> I use Python3 3, and expected learning how to use configparser would be >> no big deal.  Well!  Seems there is configparser, stdconfigparser, and >> safeconfigparser, and multiple ways to set the section and entries to >> the

Re: Prepare accented characters for HTML

2019-03-28 Thread Jon Ribbens
On 2019-03-28, Tony van der Hoff wrote: > Thanks, Chris. The problem is not with the browser, but Jinja crashes. > Probably a bug, but I'm too wedded to that engine to change now. I'll > raise it on the Jinja bug site. It'll almost certainly be a mistake in the way you're using Jinja. I can't

Re: Losing words

2019-04-01 Thread Jon Ribbens
On 2019-04-01, John Doe wrote: > I'm learning SOCKETS and working with Irc. > --- > s.send(bytes("PRIVMSG " + channel +" "+ message + "\n", "UTF-8")) > > When more than one word ( for example: This is a message) > in *message* it

Re: The slash "/" as used in the documentation

2019-02-10 Thread Jon Ribbens
On 2019-02-09, Terry Reedy wrote: > '/' is no uglier than, and directly analogous to, and as easy to produce > and comprehend, as '*'. It was selected after considerable discussion > of how to indicate that certain parameters are, at least in CPython, > positional only. The discussion of

Re: The slash "/" as used in the documentation

2019-02-10 Thread Jon Ribbens
On 2019-02-10, Chris Angelico wrote: > On Mon, Feb 11, 2019 at 2:21 AM Jon Ribbens wrote: >> On 2019-02-09, Terry Reedy wrote: >> > '/' is no uglier than, and directly analogous to, and as easy to produce >> > and comprehend, as '*'. It was selected after consider

[issue35863] email.headers wraps headers badly

2019-01-30 Thread Jon Ribbens
New submission from Jon Ribbens : email.headers can wrap headers by putting a FWS as the very first thing in the output: >>> from email.header import Header >>> Header("a" * 67, header_name="Content-ID").encode() '\n aaa

[issue35863] email.headers wraps headers badly

2019-01-31 Thread Jon Ribbens
Jon Ribbens added the comment: It is not correct folding. It might not be explicitly forbidden, but it is clearly unwise, and is breaking 'conservative in what you send'. Outlook will not be the only program that fails to parse Python's output

[issue35863] email.headers wraps headers badly

2019-02-01 Thread Jon Ribbens
Jon Ribbens added the comment: I did read the RFCs. I suspect the [CFWS] in the msg-id is for the benefit of the references production which contains a list of msg-ids. The 78-character suggested line length limit is explicitly noted as being for display purposes, and therefore is of little

Re: Is this a "gotcha" in Python?

2019-04-20 Thread Jon Ribbens
On 2019-04-19, Stefan Ram wrote: > Now consider the same in Python: > > def f(): > # ... > l = 22 # representing a length > # ... > l = 'abc'; # representing the left half of something > # ... > > A Python implementation does not catch the "error". Obviously it is a

Re: PEP 594 cgi & cgitb removal

2019-05-25 Thread Jon Ribbens via Python-list
On 2019-05-25, Michael Torrie wrote: > On 05/24/2019 04:27 AM, Jon Ribbens via Python-list wrote: >> Sorry, in what sense do you mean "Serverless is CGI"? >> >> As far as I can tell, it's just a script to automatically upload >> bits of code into various c

Re: PEP 594 cgi & cgitb removal

2019-05-23 Thread Jon Ribbens via Python-list
On 2019-05-23, Paul Rubin wrote: > dieter writes: >> Should "cgi" disappear from the standard library > > It's also a concern that cgi may be disappearing from web servers. Last > I heard, nginx didn't support it. That's part of why I still use > apache, or (local only) even CGIHTTPServer.py.

Re: PEP 594 cgi & cgitb removal

2019-05-24 Thread Jon Ribbens via Python-list
On 2019-05-23, Gunnar Þór Magnússon wrote: >> nginx is the current hotness. CGI has not been hotness since the >> mid 90s. > > Serverless is the new hotness, and serverless is CGI. Technology is > cyclical. Sorry, in what sense do you mean "Serverless is CGI"? As far as I can tell, it's just a

Re: Automate extract domain

2019-05-12 Thread Jon Ribbens via Python-list
On 2019-05-12, Birdep wrote: > I am trying to extract domain name from a adblock rule , so what > pattern should i used to extract domain name only? > > import re > domains = ['ru', ' fr' ,'eu', 'com'] with open('easylist.txt', 'r') as f: > a=f.read()

Re: Handle foreign character web input

2019-06-29 Thread Jon Ribbens via Python-list
On 2019-06-28, Chris Angelico wrote: > On Sat, Jun 29, 2019 at 6:31 AM Tobiah wrote: >> A guy comes in and enters his last name as RÖnngren. >> >> So what did the browser really give me; is it encoded >> in some way, like latin-1? Does it depend on whether >> the name was cut and pasted from a

Re: Web framework for static pages

2019-08-13 Thread Jon Ribbens via Python-list
On 2019-08-13, Morten W. Petersen wrote: > Ok. Isn't it a bit splitting of hairs to talk about static site generators > and their templates? No, not even slightly. You appear to be thinking that static site generators come with a pre-made set of design templates, and as far as I am aware they

Re: Web framework for static pages

2019-08-12 Thread Jon Ribbens via Python-list
On 2019-08-12, Morten W. Petersen wrote: > What I guess I'm looking for, is something that will help create a > static website, in a simple and efficient manner. Without being bloated. > > I don't have a lot of hair on my head, but I would be pulling it out > because of some of the websites I

Re: Web framework for static pages

2019-08-13 Thread Jon Ribbens via Python-list
On 2019-08-13, Morten W. Petersen wrote: > Ideally I'd want a static site generator that makes it easy and quick to > create a website which is pretty, accessible, works across browsers and > standards compliant and doesn't freeze the browser on a low-end phone. That isn't what they do. All

Re: _unquote

2019-08-04 Thread Jon Ribbens via Python-list
On 2019-08-04, Hongyi Zhao wrote: > See the following code excerpted from https://github.com/shichao-an/ > homura/blob/master/homura.py: > > --- > def unquote(s): > res = s > if not PY3: > if isinstance(res, six.text_type): > res = s.encode('utf-8') > return

Re: if bytes != str:

2019-08-04 Thread Jon Ribbens via Python-list
On 2019-08-04, Hongyi Zhao wrote: > I read and learn the the following code now: > > https://github.com/shadowsocksr-backup/shadowsocksr-libev/blob/master/src/ > ssrlink.py > > In this script, there are the following two customized functions: > > -- > def to_bytes(s): > if bytes !=

Re: How do you insert an item into a dictionary (in python 3.7.2)?

2019-06-28 Thread Jon Ribbens via Python-list
On 2019-06-28, Larry Martell wrote: > On Fri, Jun 28, 2019 at 11:10 AM CrazyVideoGamez > wrote: >> >> How do you insert an item into a dictionary? For example, I make a >> dictionary called "dictionary". >> >> dictionary = {1: 'value1', 2: 'value3'} >> >> What if I wanted to add a value2 in the

Re: SSL/TLS in Python using STARTTLS and ssl/ssltelnet and telnetlib

2019-11-07 Thread Jon Ribbens via Python-list
On 2019-11-07, Veek M wrote: > Could someone suggest some introductory reading material that will allow > me to use 'telnetlib' with 'ssl' or 'ssltelnet'. > (currently using Pan since Knode is dropped on Debian) > > I'm trying to write something that will download the NNTP headers over > TLS.

Re: strptime for different languages

2019-12-17 Thread Jon Ribbens via Python-list
On 2019-12-17, Ulrich Goebel wrote: > I need to interpret a date string to get a datetime object. That should > be done with strptime from the module datetime. > > But I don't know enough about the locale settings from where the date > sting comes. Actually the date_string cames from different

Re: from ./.. import

2019-10-04 Thread Jon Ribbens via Python-list
On 2019-10-04, Hongyi Zhao wrote: > See this file: > https://github.com/hongyi-zhao/dotbot/blob/master/dotbot/messenger/ > messenger.py > > It has the following codes: > > from ..util.singleton import Singleton > from ..util.compat import with_metaclass > from .color import Color > from .level

Re: Technical debt - was Re: datetime seems to be broken WRT timezones (even when you add them)

2020-02-12 Thread Jon Ribbens via Python-list
On 2020-02-12, Chris Angelico wrote: > But you CAN rewrite code such that it reduces technical debt. You can > refactor code to make it more logical. ... but if doing so costs more than the debt, you shouldn't do it. -- https://mail.python.org/mailman/listinfo/python-list

Re: datetime seems to be broken WRT timezones (even when you add them)

2020-02-10 Thread Jon Ribbens via Python-list
On 2020-02-10, Python wrote: > So far, so good. However, when you go to use this object, the time it > represents is in fact wrong. Unsurprisingly for a language feature that's been around for nearly 17 years, no it isn't. > For example: > print dt.strftime("%s") > 1580452245 That's

Re: Mental model of lookahead assertions

2020-02-28 Thread Jon Ribbens via Python-list
On 2020-02-27, Stefan Ram wrote: > One can count overlapping occurences as follows. > >|>>> print(len(findall('(?=aa)','cb'))) >|3 > > Every web page says that lookahead assertions do > not consume nor move the "current position". > > But what mental model can I make of the regex >

Re: ÿ in Unicode

2020-03-06 Thread Jon Ribbens via Python-list
On 2020-03-06, Pieter van Oostrum wrote: > Jon Ribbens writes: >> On 2020-03-06, moi wrote: >>> Le jeudi 5 mars 2020 13:20:38 UTC+1, Ben Bacarisse a écrit : >>>> moi writes: >>>> >>>> 'ÿ'.encode('utf-8') >>>> > b'\xc3\x

Re: ÿ in Unicode

2020-03-06 Thread Jon Ribbens via Python-list
On 2020-03-06, moi wrote: > Le jeudi 5 mars 2020 13:20:38 UTC+1, Ben Bacarisse a écrit : >> moi writes: >> 'ÿ'.encode('utf-8') >> > b'\xc3\xbf' >> 'ÿ'.encode('utf-16-le') >> > b'\xff\x00' >> 'ÿ'.encode('utf-32-le') >> > b'\xff\x00\x00\x00' > >> That all looks as expected. > Yes >

Re: JavaScript's void operator in Python?

2020-02-02 Thread Jon Ribbens via Python-list
On 2020-02-02, Stefan Ram wrote: > JavaScript has a void operator that maps everything to > undefined. E.g., > > JavaScript console > >|< void( console.log( 2 ) ) >| 2 >|> undefined > > I can easily write a corresponding function in Python. > > main.py > > def void( x ): > pass > >

Re: JavaScript's void operator in Python?

2020-02-02 Thread Jon Ribbens via Python-list
On 2020-02-02, Stefan Ram wrote: > Greg Ewing writes: >>If the functions you're calling all return None, you can >>do this: >> >>> print(2); print(3) > > »print(2); print(3)« is not an expression anymore but an stmt_list. > It cannot be used in all places where an expression is allowed. Why

Re: JavaScript's void operator in Python?

2020-02-02 Thread Jon Ribbens via Python-list
On 2020-02-02, Stefan Ram wrote: > Jon Ribbens writes: >>Why does it matter if the return value is None? > > In a lambda, a return value of None sometimes would be > convenient as by convention it indicates that the return > value does not carry any informa

Re: datetime seems to be broken WRT timezones (even when you add them)

2020-02-11 Thread Jon Ribbens via Python-list
On 2020-02-11, Chris Angelico wrote: > On Tue, Feb 11, 2020 at 10:01 PM Jon Ribbens via Python-list > wrote: >> So while it's been about 6 years since anyone should have been >> starting any new projects using Python 2, there are plenty of >> projects that are older

Re: datetime seems to be broken WRT timezones (even when you add them)

2020-02-11 Thread Jon Ribbens via Python-list
On 2020-02-11, Chris Angelico wrote: >> That's the key piece of info. This does appear to work, though still >> not on python2. That, as you say, is my problem. But thankfully Jon >> Ribbens has the save: > > Isn't it time to stop going to great effort to support

Re: Sandboxing eval() (was: Calculator)

2020-01-19 Thread Jon Ribbens via Python-list
On 2020-01-19, mus...@posteo.org wrote: > Is it actually possible to build a "sandbox" around eval, permitting it > only to do some arithmetic and use some math functions, but no > filesystem acces or module imports? > > I have an application that loads calculation recipes (a few lines of >

Re: Clarification on Immutability please

2020-01-21 Thread Jon Ribbens via Python-list
On 2020-01-21, Chris Angelico wrote: > On Wed, Jan 22, 2020 at 8:01 AM Jon Ribbens via Python-list > wrote: >> On 2020-01-21, Chris Angelico wrote: >> > On Wed, Jan 22, 2020 at 4:42 AM Stephen Tucker >> > wrote: >> >> I am left concluding that mytup

Re: Clarification on Immutability please

2020-01-21 Thread Jon Ribbens via Python-list
On 2020-01-21, Chris Angelico wrote: > On Wed, Jan 22, 2020 at 4:42 AM Stephen Tucker wrote: >> I am left concluding that mytup is not actually a tuple (even though type >> (mytup) tells me that it is). > > If type(mytup) is tuple, then mytup really truly is a tuple. There is > no other

Re: ÿ in Unicode

2020-03-06 Thread Jon Ribbens via Python-list
On 2020-03-06, Pieter van Oostrum wrote: > Jon Ribbens writes: >> On 2020-03-06, moi wrote: >>> Le jeudi 5 mars 2020 13:20:38 UTC+1, Ben Bacarisse a ÄCcritâ : >>>> moi writes: >>>> >>>> 'Ä¿'.encode('utf-8') >>>> > b'\xc3\xb

Re: ÿ in Unicode

2020-03-06 Thread Jon Ribbens via Python-list
On 2020-03-06, Pieter van Oostrum wrote: > Jon Ribbens writes: >> On 2020-03-06, moi wrote: >>> Le jeudi 5 mars 2020 13:20:38 UTC+1, Ben Bacarisse a ÄäCcritÄø : >>>> moi writes: >>>> >>>> 'Ääâ¿'.encode('utf-8') >>>> &g

Re: ÿ in Unicode

2020-03-06 Thread Jon Ribbens via Python-list
On 2020-03-06, moi wrote: > Le jeudi 5 mars 2020 13:20:38 UTC+1, Ben Bacarisse a ÄCcritâ : >> moi writes: >> 'Ä¿'.encode('utf-8') >> > b'\xc3\xbf' >> 'Ä¿'.encode('utf-16-le') >> > b'\xff\x00' >> 'Ä¿'.encode('utf-32-le') >> > b'\xff\x00\x00\x00' > >> That all looks as expected. >

Re: ÿ in Unicode

2020-03-06 Thread Jon Ribbens via Python-list
On 2020-03-06, moi wrote: > Le jeudi 5 mars 2020 13:20:38 UTC+1, Ben Bacarisse a ÄäCcritÄø : >> moi writes: >> 'Ääâ¿'.encode('utf-8') >> > b'\xc3\xbf' >> 'Ääâ¿'.encode('utf-16-le') >> > b'\xff\x00' >> 'Ääâ¿'.encode('utf-32-le') >> > b'\xff\x00\x00\x00' > >> That all looks as

Re: ÿ in Unicode

2020-03-06 Thread Jon Ribbens via Python-list
On 2020-03-06, Jon Ribbens wrote: > What's the bug, or source of amusement? Oh, that's fun. There's a Russian Fidonet gateway, that somehow still exists, that's re-injecting usenet posts back into the group. -- https://mail.python.org/mailman/listinfo/python-list

Re: link to venv python sees a different sys.path

2020-03-11 Thread Jon Ribbens via Python-list
On 2020-03-11, Robin Becker wrote: > I'm trying to understand why python 3.8.2 venv behaves differently > when it is executed va a link Because site.py contains a function called venv() which looks up the path of the executed python binary, and searches for the virtual environment relative to

Re: php to python code converter

2020-05-14 Thread Jon Ribbens via Python-list
On 2020-05-14, MRAB wrote: > Look at the date of the original post. It says "8 May 2009". That's over > 11 years ago! > > Since then, Google Code has ceased to exist. Disgraceful, all URLs should continue to work for at least as long as this one has:

Re: "1,+2,", but not "(1,)+2,"

2020-07-31 Thread Jon Ribbens via Python-list
On 2020-07-31, Stefan Ram wrote: > You can write > >|>>> 1,+2, >|(1, 2) > > , but not > >|>>> (1,)+2, >|TypeError: can only concatenate tuple (not "int") to tuple > > . Why? (Python 3.9) For the obvious reason, as indicated by the error message? What are you expecting these expressions to

Re: "1,+2,", but not "(1,)+2,"

2020-07-31 Thread Jon Ribbens via Python-list
On 2020-07-31, Bart wrote: > Not sure about the trailing commas on each. It seems Python ignores > trailing commas on tuple constructors, so that the A,B, would be a > 2-tuple, and A+B, would have been a 1-tuple if A+B had been legal. It's not just tuples, it's lists, sets, dictionaries, etc.

Re: Formal Question to Steering Council (re recent PEP8 changes)

2020-07-02 Thread Jon Ribbens via Python-list
On 2020-07-02, Michael Torrie wrote: > Agreed. She just needs to fix her commit message to remove the sentence > about the relics of white supremacy. The fact she would conflate an > author's name with some kind of race-related thing is a bit > embarrassing, frankly. She didn't - you did. --

Re: Formal Question to Steering Council (re recent PEP8 changes)

2020-07-03 Thread Jon Ribbens via Python-list
On 2020-07-03, Ethan Furman wrote: > On 07/02/2020 07:42 PM, Jon Ribbens via Python-list wrote: >> She didn't - you did. > > Please keep the discourse civil. Petty taunts are not helpful. Sorry, I don't understand what you are getting at. My comment was not a "petty taunt&q

Re: Formal Question to Steering Council (re recent PEP8 changes)

2020-07-03 Thread Jon Ribbens via Python-list
On 2020-07-02, Michael Torrie wrote: > On 7/2/20 1:26 PM, Jon Ribbens via Python-list wrote: >> On 2020-07-02, Michael Torrie wrote: >>> Agreed. She just needs to fix her commit message to remove the sentence >>> about the relics of white supremacy. The fact she wou

Re: Formal Question to Steering Council (re recent PEP8 changes)

2020-07-03 Thread Jon Ribbens via Python-list
On 2020-07-03, Michael Torrie wrote: > On 7/3/20 10:57 AM, Jon Ribbens via Python-list wrote: >> On 2020-07-03, Ethan Furman wrote: >>> On 07/02/2020 07:42 PM, Jon Ribbens via Python-list wrote: >>>> She didn't - you did. >>> >>> Please keep th

Re: Access last element after iteration

2020-07-07 Thread Jon Ribbens via Python-list
On 2020-07-07, Frank Millman wrote: > After iterating over a sequence, the final element is still accessible. > In this case, the variable 'i' still references the integer 4. ... > Is this guaranteed in Python, or should it not be relied on? It is guaranteed, *except* if the sequence is empty

Re: Bulletproof json.dump?

2020-07-06 Thread Jon Ribbens via Python-list
On 2020-07-06, Chris Angelico wrote: > I think that even in non-strict mode, round-tripping should be > achieved after one iteration. That is to say, anything you can > JSON-encode will JSON-decode to something that would create the same > encoded form. Not sure if there's anything that would

Re: Bulletproof json.dump?

2020-07-06 Thread Jon Ribbens via Python-list
On 2020-07-06, J. Pic wrote: > Well I made a suggestion on python-ideas and a PyPi lib came out of it, but > since you can't patch a lot of internal types it's not so useful. > > Feel free to try it out: > > https://yourlabs.io/oss/jsonlight/ While I applaud your experimentation, that is not

Re: Bulletproof json.dump?

2020-07-06 Thread Jon Ribbens via Python-list
On 2020-07-06, Chris Angelico wrote: > On Mon, Jul 6, 2020 at 8:36 PM Adam Funk wrote: >> Is there a "bulletproof" version of json.dump somewhere that will >> convert bytes to str, any other iterables to list, etc., so you can >> just get your data into a file & keep working? > > That's the PHP

Re: Bulletproof json.dump?

2020-07-06 Thread Jon Ribbens via Python-list
On 2020-07-06, Frank Millman wrote: > On 2020-07-06 3:08 PM, Jon Ribbens via Python-list wrote: >> On 2020-07-06, Frank Millman wrote: >>> On 2020-07-06 2:06 PM, Jon Ribbens via Python-list wrote: >>>> While I agree entirely with your point, there is however pe

Re: Bulletproof json.dump?

2020-07-06 Thread Jon Ribbens via Python-list
On 2020-07-06, Chris Angelico wrote: > On Mon, Jul 6, 2020 at 10:11 PM Jon Ribbens via Python-list > wrote: >> While I agree entirely with your point, there is however perhaps room >> for a bit more helpfulness from the json module. There is no sensible >> reason I can

Re: Bulletproof json.dump?

2020-07-06 Thread Jon Ribbens via Python-list
On 2020-07-06, Frank Millman wrote: > On 2020-07-06 2:06 PM, Jon Ribbens via Python-list wrote: >> While I agree entirely with your point, there is however perhaps room >> for a bit more helpfulness from the json module. There is no sensible >> reason I can think of that it

Re: Bulletproof json.dump?

2020-07-06 Thread Jon Ribbens via Python-list
On 2020-07-06, Chris Angelico wrote: > On Mon, Jul 6, 2020 at 11:06 PM Jon Ribbens via Python-list > wrote: >> The 'json' module already fails to provide round-trip functionality: >> >> >>> for data in ({True: 1}, {1: 2}, (1, 2)): >> ...

Re: Bulletproof json.dump?

2020-07-06 Thread Jon Ribbens via Python-list
On 2020-07-06, Chris Angelico wrote: > On Tue, Jul 7, 2020 at 12:01 AM Jon Ribbens via Python-list > wrote: >> I think what you're saying is, if we do: >> >> json1 = json.dumps(foo) >> json2 = json.dumps(json.loads(json1)) >> assert json1 == json2 &

Re: Formal Question to Steering Council (re recent PEP8 changes)

2020-07-03 Thread Jon Ribbens via Python-list
On 2020-07-03, Rhodri James wrote: > On 02/07/2020 23:46, Random832 wrote: >> On Thu, Jul 2, 2020, at 18:29, Michael Torrie wrote: >>> Come again? I can see no other link in the verbage with the >>> "relics of white supremacy" that she referred to. If there are >>> other links, they should be

Re: Letter replacer - suggestions?

2020-12-07 Thread Jon Ribbens via Python-list
On 2020-12-07, Chris Angelico wrote: > On Tue, Dec 8, 2020 at 6:41 AM Grant Edwards > wrote: >> On 2020-12-07, MRAB wrote: >> > Avoid a 'bare' except unless you _really_ mean it, which is >> > virtually never. Catch only those exceptions that you're going to >> > handle. >> >> And sometimes

Re: Why x+=1 doesn't return x value instead of an object

2020-10-30 Thread Jon Ribbens via Python-list
On 2020-10-31, Stefan Ram wrote: > Siddhharth Choudhary writes: >>I want to know why x+=1 does not return the value of the variable. > > Which value? The old or the new one? > > Expressions never return values. Except when they're assignment expressions, when they do. --

Re: Why x+=1 doesn't return x value instead of an object

2020-10-30 Thread Jon Ribbens via Python-list
On 2020-10-31, Chris Angelico wrote: > On Sat, Oct 31, 2020 at 1:51 PM Jon Ribbens via Python-list > wrote: >> >> On 2020-10-31, Stefan Ram wrote: >> > Siddhharth Choudhary writes: >> >>I want to know why x+=1 does not return the value of the var

Re: Replacement for Mailman

2021-06-08 Thread Jon Ribbens via Python-list
On 2021-06-08, D'Arcy Cain wrote: > Given that mailman still runs under 2.7 and that's being deprecated, > does anyone have a suggestion for a replacement? There is always Mailman 3... -- https://mail.python.org/mailman/listinfo/python-list

Re: Replacement for Mailman

2021-06-08 Thread Jon Ribbens via Python-list
On 2021-06-08, Grant Edwards wrote: > On 2021-06-08, Paul Bryan wrote: >> How about Mailman 3.x on Python 3.x? > > According to https://www.gnu.org/software/mailman/requirements.html > mailman 3.x still requires Python 2.7 for the archiver and the web UI. I'm pretty sure that's out of date. --

Re: Replacement for Mailman

2021-06-08 Thread Jon Ribbens via Python-list
On 2021-06-08, Terry Reedy wrote: > On 6/8/2021 4:36 PM, Jon Ribbens via Python-list wrote: >> On 2021-06-08, Grant Edwards wrote: >>> On 2021-06-08, Paul Bryan wrote: >>>> How about Mailman 3.x on Python 3.x? >>> >>> According to https:

Re: Writers [Was: Re: Standarize TOML?]

2021-05-18 Thread Jon Ribbens via Python-list
On 2021-05-18, Michael F. Stemper wrote: > On 17/05/2021 18.48, Terry Reedy wrote: >> I disagree.  Rehashing *opinions* is pretty useless. The issues were >> already discussed on >> https://discuss.python.org/t/adopting-recommending-a-toml-parser/4068 >> >> There are multiple packages.  There

<    1   2   3   4   5   6   7   >