Re: dict.get(key, default) evaluates default even if key exists

2020-12-15 Thread Matt Ruffalo
On 15/12/20 15:26, Grant Edwards wrote: > On 2020-12-15, Mark Polesky via Python-list wrote: > >> I see. Perhaps counterintuitive, > I guess that depends on what programming language you normally think > in. Python's handling of function parameters is exactly what I > expected, because all of the

Re: virtualenv and ubuntu

2018-08-28 Thread Matt Ruffalo
On 2018-08-28 07:26, stone.zh...@gmail.com wrote: > Hi there, > > Sorry if the question is naive, I am on Ubuntu 16.04 with Python 3.5.2, now I > want to use virtualenv, I noticed there are two ways to get virtualenv > installed: > > 1) do "sudo apt-get install virtualenv" > 2) do "pip3 install v

Re: Pandas cat.categories.isin list, is this a bug?

2018-05-15 Thread Matt Ruffalo
On 2018-05-15 06:23, Zoran Ljubišić wrote: > Matt, > > thanks for the info about pydata mailing group. I didn't know it exists. > Because comp.lang.python is not appropriate group for this question, I > will continue our conversation on gmail. > > I have put len(df.CRM_assetID.cat >

Re: Pandas cat.categories.isin list, is this a bug?

2018-05-14 Thread Matt Ruffalo
On 2018-05-14 07:05, zljubi...@gmail.com wrote: > Hi, > > I have dataframe with CRM_assetID column as category dtype: > > df.info() > > > RangeIndex: 1435952 entries, 0 to 1435951 > Data columns (total 75 columns): > startTime1435952 non-null object > CRM_assetID

Re: Unicode

2017-09-17 Thread Matt Ruffalo
On 2017-09-17 17:27, leam hall wrote: > > Ah! So this works in Py2: >def __str__(self): > name= self.name.encode("utf-8") > > > It completely fails in Py3: > PVT b'Lakeisha F\xc3\xa1bi\xc3\xa1n' 7966A4 [F] Age: 22 > > > Note that moving __str__() to display() gets the same result

Re: People choosing Python 3

2017-09-11 Thread Matt Ruffalo
On 2017-09-10 05:42, Chris Warrick wrote: > > RHEL’s release process starts at forking a recent Fedora release. It > wouldn’t make much sense for them to undo the Python 3 progress that > happened over the past few years in Fedora — including dnf, an > improved package manager written in Python 3.

Re: How to update python from 3.5.2 to 3.5.3 on Linux

2017-05-03 Thread Matt Ruffalo
On 2017-05-03 12:43, Thomas Nyberg wrote: > On 05/03/2017 11:47 AM, Wolfgang Maier wrote: >> On 03.05.2017 17:11, Thomas Nyberg wrote: >>> On 05/03/2017 11:04 AM, Daiyue Weng wrote: nope, I was thinking it might be good to update to 3.5.3 for security reasons? >>> (CCing back in pyth

Re: PEP 393 vs UTF-8 Everywhere

2017-01-21 Thread Matt Ruffalo
On 2017-01-21 10:50, Pete Forman wrote: > Thanks for a very thorough reply, most useful. I'm going to pick you up > on the above, though. > > Surrogates only exist in UTF-16. They are expressly forbidden in UTF-8 > and UTF-32. The rules for UTF-8 were tightened up in Unicode 4 and RFC > 3629 (2003)

Re: *args and **kwargs

2016-09-04 Thread Matt Ruffalo
On 2016-09-02 15:44, Ben Finney wrote: > Note that this has nothing to do with how the function is defined; in > the definition of the function, parameters are neither positional nor > keyword. You name each of them, and you define an order for them; and > neither of those makes any of them “positi

Re: PSA: Debian Stretch, apt-listchanges, and Python 3

2016-08-29 Thread Matt Ruffalo
On 2016-08-29 23:56, Chris Angelico wrote: > Up until very recently, the system Python has only been the Python 2. > (For a while, it wasn't even 2.7, but I could easily use altinstall > for that.) I have deliberately wanted to use 3.6 for ALL testing, not > just by messing with venvs or shell alia

Re: Capturing the bad codes that raise UnicodeError exceptions during decoding

2016-08-06 Thread Matt Ruffalo
On 2016-08-04 15:45, Random832 wrote: > On Thu, Aug 4, 2016, at 15:22, Malcolm Greene wrote: >> Hi Chris, >> >> Thanks for your suggestions. I would like to capture the specific bad >> codes *before* they get replaced. So if a line of text has 10 bad codes >> (each one raising UnicodeError), I woul

Re: Moderation and slight change of (de facto) policy

2016-04-17 Thread Matt Ruffalo
Hi- That seems like a reasonable approach, though I think there *really* needs to be an option along the lines of "subscribed to the list for the purposes of moderation, but not receiving list messages via email". I think I did this with the Git mailing list in the past, and it was quite useful. I

Using SSL socket as stdin for subprocess.Popen

2016-03-21 Thread Matt Ruffalo
Hi all- I'm writing a backup client for automating the synchronization of btrfs snapshots between machines -- essentially piping the output of `btrfs send` on my laptop/desktop to `btrfs receive` on a server. I've been doing this manually for quite a while, and something automated would be much mo