Re: Request to advise error for python.

2021-10-23 Thread tommy yama
It seems you use windows to install.


Then, you need conda. Pip works for Linux.

Check this out.
https://numpy.org/install/


On Thu, Oct 21, 2021, 11:35 PM Grant Edwards 
wrote:

> On 2021-10-21, Mats Wichmann  wrote:
>
> > There are some nuances.  If you are on a Linux system, Python is a
> > system program and you don't want to try to install into system
> > locations (you'll run into permission problems anyway), so trying a user
> > install is useful.  So:
> >
> > pip install --user numpy
> >
> > In fact, if you're on a Linux system you *may* prefer to install the
> > packaged versions - use the appropriate package manager commands.
>
> Not all systems have a 'pip' executable. If a 'pip' exectuable does
> exist, it might not be the same version as your defualt python
> executable. It's usually a better idea to do it this way:
>
>  $ python -m pip install --user numpy
>
> That said, if you're on Linux system, you're almostg always better off
> using your distro's package manger to install numpy.
>
> --
> Grant
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Request to advise error for python.

2021-10-23 Thread MRAB

On 2021-10-23 14:53, tommy yama wrote:

It seems you use windows to install.


Then, you need conda. Pip works for Linux.

On Windows, 'conda' is for the Anaconda version of Python. If you're 
using the standard version of Python from python.org you use pip or, 
preferably, py -m pip.



Check this out.
https://numpy.org/install/


On Thu, Oct 21, 2021, 11:35 PM Grant Edwards 
wrote:


On 2021-10-21, Mats Wichmann  wrote:

> There are some nuances.  If you are on a Linux system, Python is a
> system program and you don't want to try to install into system
> locations (you'll run into permission problems anyway), so trying a user
> install is useful.  So:
>
> pip install --user numpy
>
> In fact, if you're on a Linux system you *may* prefer to install the
> packaged versions - use the appropriate package manager commands.

Not all systems have a 'pip' executable. If a 'pip' exectuable does
exist, it might not be the same version as your defualt python
executable. It's usually a better idea to do it this way:

 $ python -m pip install --user numpy

That said, if you're on Linux system, you're almostg always better off
using your distro's package manger to install numpy.


--
https://mail.python.org/mailman/listinfo/python-list


front end gfx for a redpitaya VNA

2021-10-23 Thread Gene Heskett
Greetings all;

I have acquired the linux version of the front end for a redpitaya Vector 
Network Analyzer.

Putting it on an rpi4b running raspbian buster, it gets to line 32 and 
bails out with this error:

pi@rpi4:/media/pi/workspace/vna-linux-tool $ python3 ./vna.py
Traceback (most recent call last):
  File "./vna.py", line 32, in 
from mpldatacursor import datacursor
ModuleNotFoundError: No module named 'mpldatacursor'

I have installed all the stuff that a search for "python-mpl" finds in 
synaptic, no change in the error above.

Does anyone know where this resource might be found?

Thanks all.

Cheers, Gene Heskett.
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page 
-- 
https://mail.python.org/mailman/listinfo/python-list


front end gfx for a redpitaya VNA

2021-10-23 Thread Gene Heskett
Greetings all;

I have acquired the linux version of the front end for a redpitaya Vector 
Network Analyzer.

Putting it on an rpi4b running raspbian buster, it gets to line 32 and 
bails out with this error:

pi@rpi4:/media/pi/workspace/vna-linux-tool $ python3 ./vna.py
Traceback (most recent call last):
  File "./vna.py", line 32, in 
from mpldatacursor import datacursor
ModuleNotFoundError: No module named 'mpldatacursor'

I have installed all the stuff that a search for "python-mpl" finds in 
synaptic, no change in the error above.

Does anyone know where this resource might be found?

Never mind, I finally remembered pip3, which found it, and the linux 
front end now runs. All I need to do now is get the device out of my 
truck and plug it into my network.

Progress, for some definition of the word. :o)

Thank you all who might have posted the obvious.

Cheers, Gene Heskett.
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New assignmens ...

2021-10-23 Thread Jon Ribbens via Python-list
On 2021-10-23, Chris Angelico  wrote:
> I've never used ctr:=ctr-1 either, though, so I don't know the actual
> use cases. Why is this being used in an assignment expression? Is it
> an ersatz loop?
>
> Common use-cases include:
>
> if m := re.match(...):
>
> while data := thing.read():
>
> etc. All of them are doing exactly two things: testing if something is
> empty, and if it isn't, using it in a block of code.
>
> In what situations do you need to mutate an attribute and also test
> it, and how much hassle is it to simply break it out into two lines?

It's not hard to imagine something like:

def get_expensive(self):
return self.expensive or self.expensive := self.calculate_expensive()

> The onus is on you to show that it needs to be more flexible.

Is it though? It seems to me that the onus is on you to show that
this special case is special enough to be given its own unique
existence. It's a bit surprising that the PEP doesn't discuss this
decision at all.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New assignmens ...

2021-10-23 Thread Chris Angelico
On Sun, Oct 24, 2021 at 4:39 AM Jon Ribbens via Python-list
 wrote:
>
> On 2021-10-23, Chris Angelico  wrote:
> > I've never used ctr:=ctr-1 either, though, so I don't know the actual
> > use cases. Why is this being used in an assignment expression? Is it
> > an ersatz loop?
> >
> > Common use-cases include:
> >
> > if m := re.match(...):
> >
> > while data := thing.read():
> >
> > etc. All of them are doing exactly two things: testing if something is
> > empty, and if it isn't, using it in a block of code.
> >
> > In what situations do you need to mutate an attribute and also test
> > it, and how much hassle is it to simply break it out into two lines?
>
> It's not hard to imagine something like:
>
> def get_expensive(self):
> return self.expensive or self.expensive := self.calculate_expensive()

I usually write this sort of thing the other way:

def get_expensive(self, key):
if key not in self.cache:
self.cache[key] = ...
return self.cache[key]

and then if you don't like the duplication, the cleanest way is to put
the expensive calculation into the __missing__ method of a dict
subclass.

> > The onus is on you to show that it needs to be more flexible.
>
> Is it though? It seems to me that the onus is on you to show that
> this special case is special enough to be given its own unique
> existence. It's a bit surprising that the PEP doesn't discuss this
> decision at all.

The PEP was accepted. Thus it is now up to someone proposing a change
to show that the change is worthwhile.

Python has frequently started with a more restricted rule set, with
the option to make it less restricted in the future. Case in point:
Decorator syntax used to be limited to a small set of options, aimed
at the known use-cases at the time. Then very recently, that was
opened up to basically any expression.

https://www.python.org/dev/peps/pep-0614/

Read over that document for an excellent example of how to take a
tight proposal and recommend that it be made more flexible. Assignment
expressions are currently in the restricted form, allowing only simple
names, and it's up to you to propose and demonstrate the value of the
increased flexibility.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New assignmens ...

2021-10-23 Thread Jon Ribbens via Python-list
On 2021-10-23, Chris Angelico  wrote:
> On Sun, Oct 24, 2021 at 4:39 AM Jon Ribbens via Python-list
> wrote:
>> On 2021-10-23, Chris Angelico  wrote:
>> > In what situations do you need to mutate an attribute and also test
>> > it, and how much hassle is it to simply break it out into two lines?
>>
>> It's not hard to imagine something like:
>>
>> def get_expensive(self):
>> return self.expensive or self.expensive := self.calculate_expensive()
>
> I usually write this sort of thing the other way:
>
> def get_expensive(self, key):
> if key not in self.cache:
> self.cache[key] = ...
> return self.cache[key]
>
> and then if you don't like the duplication, the cleanest way is to put
> the expensive calculation into the __missing__ method of a dict
> subclass.

Sure, but if "there's already another way of doing it" was a winning
argument then assignment expressions wouldn't have been accepted into
the language at all.

>> > The onus is on you to show that it needs to be more flexible.
>>
>> Is it though? It seems to me that the onus is on you to show that
>> this special case is special enough to be given its own unique
>> existence. It's a bit surprising that the PEP doesn't discuss this
>> decision at all.
>
> The PEP was accepted. Thus it is now up to someone proposing a change
> to show that the change is worthwhile.
>
> Python has frequently started with a more restricted rule set, with
> the option to make it less restricted in the future. Case in point:
> Decorator syntax used to be limited to a small set of options, aimed
> at the known use-cases at the time. Then very recently, that was
> opened up to basically any expression.
>
> https://www.python.org/dev/peps/pep-0614/
>
> Read over that document for an excellent example of how to take a
> tight proposal and recommend that it be made more flexible. Assignment
> expressions are currently in the restricted form, allowing only simple
> names, and it's up to you to propose and demonstrate the value of the
> increased flexibility.

I think we're allowed to discuss things in this group without them
having to turn into formal proposals. Personally I've never written
a Python assignment expression, and I think it'll be a few years
before Python 3.8 is old enough for them to be conveniently usable.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New assignmens ...

2021-10-23 Thread Ethan Furman

On 10/23/21 6:42 AM, Jon Ribbens via Python-list wrote:
> On 2021-10-23, Chris Angelico wrote:

>> The onus is on you to show that it needs to be more flexible.
>
> Is it though?

Yes.

> It seems to me that the onus is on you to show that
> this special case is special enough to be given its own unique
> existence.

It already has existence, so no further proof is needed.

> It's a bit surprising that the PEP doesn't discuss this
> decision at all.

In conversations as long as that one was, I'm not surprised this and maybe a couple other options didn't make it back to 
the PEP.  Nevertheless, I recall the decision to start simple, and expand later if needed.


--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list


Re: New assignmens ...

2021-10-23 Thread Chris Angelico
On Sun, Oct 24, 2021 at 7:48 AM Jon Ribbens via Python-list
 wrote:
>
> On 2021-10-23, Chris Angelico  wrote:
> > On Sun, Oct 24, 2021 at 4:39 AM Jon Ribbens via Python-list
> > wrote:
> >> On 2021-10-23, Chris Angelico  wrote:
> >> > In what situations do you need to mutate an attribute and also test
> >> > it, and how much hassle is it to simply break it out into two lines?
> >>
> >> It's not hard to imagine something like:
> >>
> >> def get_expensive(self):
> >> return self.expensive or self.expensive := 
> >> self.calculate_expensive()
> >
> > I usually write this sort of thing the other way:
> >
> > def get_expensive(self, key):
> > if key not in self.cache:
> > self.cache[key] = ...
> > return self.cache[key]
> >
> > and then if you don't like the duplication, the cleanest way is to put
> > the expensive calculation into the __missing__ method of a dict
> > subclass.
>
> Sure, but if "there's already another way of doing it" was a winning
> argument then assignment expressions wouldn't have been accepted into
> the language at all.

There is always another way of doing it. The question is not so much
"is this something that's currently absolutely impossible?" but more
"how ugly is the current way of doing things?". Ugly is, of course,
somewhat subjective, but if the current way of doing things involves a
lot of extra hassle, or is error-prone, etc, etc, then there's room to
show improvement.

The original PEP showed this improvement in ways that involved simple
names. Expanding on this is a separate proposal.


> > Read over that document for an excellent example of how to take a
> > tight proposal and recommend that it be made more flexible. Assignment
> > expressions are currently in the restricted form, allowing only simple
> > names, and it's up to you to propose and demonstrate the value of the
> > increased flexibility.
>
> I think we're allowed to discuss things in this group without them
> having to turn into formal proposals. Personally I've never written
> a Python assignment expression, and I think it'll be a few years
> before Python 3.8 is old enough for them to be conveniently usable.

Well, if you don't use them, then you don't really have a horse in
this race, so it doesn't matter. Someone who *does* want to make use
of them can read over that document etc etc, and demonstrate the value
of the proposal.

BTW, it doesn't have to be a "formal proposal" in any sense; it just
needs to be a logical and reasonable argument showing the value of the
improvement (or the problems with the status quo).

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Request to advise error for python.

2021-10-23 Thread tommy yama
Thank you MRAB.

As somebody mentioned before, the easiest solution is you can do pip
install before typing python.
That would work.

On Sun, Oct 24, 2021 at 12:00 AM MRAB  wrote:

> On 2021-10-23 14:53, tommy yama wrote:
> > It seems you use windows to install.
> >
> >
> > Then, you need conda. Pip works for Linux.
> >
> On Windows, 'conda' is for the Anaconda version of Python. If you're
> using the standard version of Python from python.org you use pip or,
> preferably, py -m pip.
>
> > Check this out.
> > https://numpy.org/install/
> >
> >
> > On Thu, Oct 21, 2021, 11:35 PM Grant Edwards 
> > wrote:
> >
> >> On 2021-10-21, Mats Wichmann  wrote:
> >>
> >> > There are some nuances.  If you are on a Linux system, Python is a
> >> > system program and you don't want to try to install into system
> >> > locations (you'll run into permission problems anyway), so trying a
> user
> >> > install is useful.  So:
> >> >
> >> > pip install --user numpy
> >> >
> >> > In fact, if you're on a Linux system you *may* prefer to install the
> >> > packaged versions - use the appropriate package manager commands.
> >>
> >> Not all systems have a 'pip' executable. If a 'pip' exectuable does
> >> exist, it might not be the same version as your defualt python
> >> executable. It's usually a better idea to do it this way:
> >>
> >>  $ python -m pip install --user numpy
> >>
> >> That said, if you're on Linux system, you're almostg always better off
> >> using your distro's package manger to install numpy.
> >>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list