The if is not working properly

2019-05-19 Thread nobelio
When you print the variable “a” it appears as True, but the program is it is 
not getting in the if a==True:  

Enviado do Email para Windows 10



---
Este e-mail foi verificado quanto a vírus pelo AVG.
http://www.avg.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Tkinter optionMenu Resize

2019-05-19 Thread Cummins, Hayden
Hi! I've been having a lot of trouble resizing the Tkinter optionMenu feature 
due to my inexperience in Python. Is there a way to resize the option menu? If 
so, how? I've tried using the config function and it makes it so the program no 
longer executes. I also can't find any articles about this problem at all 
across the internet, so any help would be greatly appreciated. Source code to 
follow.
-- 
https://mail.python.org/mailman/listinfo/python-list


PyCharm installation

2019-05-19 Thread Syed Rizvi
Hi,

I tried to install PyCharm. First time when I installed it, it worked
well. It developed some problem and when I reinstalled PyCharm, it gives me
error. I have installed it several times but could not install it

I am unable to install PyCharm.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The if is not working properly

2019-05-19 Thread Cameron Simpson

On 18May2019 13:22, nobelio  wrote:
When you print the variable “a” it appears as True, but the program is 
it is not getting in the if a==True:


It may be that "a" is not the Boolean value True but something else. But 
that is just a guess. Please reply and paste in a small example 
programme showing this problem.


Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


Why is augmented assignment of a tuple with iterable unpacking invalid syntax?

2019-05-19 Thread Eugene Alterman

a = 1, 2, 3

b = *a,   # assignment - OK
b += *a,  # augmented assignment - syntax error

Need to enclose in parenthesis:

b += (*a,)

Why isn't it allowed with an augmented assignment, while it is OK with a 
regular assignment?


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


Re: The if is not working properly

2019-05-19 Thread Alister via Python-list
On Sun, 19 May 2019 20:29:35 +1000, Cameron Simpson wrote:

> On 18May2019 13:22, nobelio  wrote:
>>When you print the variable “a” it appears as True, but the program is
>>it is not getting in the if a==True:
> 
> It may be that "a" is not the Boolean value True but something else. But
> that is just a guess. Please reply and paste in a small example
> programme showing this problem.
> 
> Cheers,
> Cameron Simpson 

also if a==True is unnecessarily verbose
if a: would suffice
(unless you explicitly want True & not just a truthy value in which case 
use
if a is True:
 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The if is not working properly

2019-05-19 Thread MRAB

On 2019-05-19 11:29, Cameron Simpson wrote:

On 18May2019 13:22, nobelio  wrote:
When you print the variable “a” it appears as True, but the program is 
it is not getting in the if a==True:


It may be that "a" is not the Boolean value True but something else. But
that is just a guess. Please reply and paste in a small example
programme showing this problem.


My guess is that it's the string 'True'.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Why is augmented assignment of a tuple with iterable unpacking invalid syntax?

2019-05-19 Thread Piet van Oostrum
Eugene Alterman  writes:

> a = 1, 2, 3
>
> b = *a,   # assignment - OK
> b += *a,  # augmented assignment - syntax error
>
> Need to enclose in parenthesis:
>
> b += (*a,)
>
> Why isn't it allowed with an augmented assignment, while it is OK with a
> regular assignment?
>

Syntactically (i.e. according to the grammar):
The right-hand side of an assignment has as one of the alternative a 
starred_expression, which includes starred and unstarred expressions.

The right-hand side of an augmented assignment has an expression_list there. 
(The other option is both cases is a yield_expression.) And if it is a list 
(i.e. there is a comma in it), it is a tuple.

Semantically:
x += y is more or less equivalent to x = x + y, except that x is only evaluated 
once, and y is treated as a unity (think implicit parentheses around it). So 
the y is basically part of an expression. But starred expressions are not 
allowed in expressions, except within explicit parentheses.
-- 
Piet van Oostrum 
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PyCharm installation

2019-05-19 Thread Jorge Gimeno
On Sun, May 19, 2019, 3:27 AM Syed Rizvi  wrote:

> Hi,
>
> I tried to install PyCharm. First time when I installed it, it worked
> well. It developed some problem and when I reinstalled PyCharm, it gives me
> error. I have installed it several times but could not install it
>
> I am unable to install PyCharm.
> --
> https://mail.python.org/mailman/listinfo/python-list


Without the error message there isn't much we can do. Can you please copy
and paste the error message?

-Jorge

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


Re: Checking network input processing by Python for a multi-threaded server

2019-05-19 Thread Markus Elfring
>> I get an other impression from the statements “self._threads.append(t)” 
>> (process_request)
>> and “thread.join()” (server_close).
>
>   Okay -- v3.7 has added more logic that didn't exist in the v3.5 code
> I was examining... (block_on_close is new).

Thanks for such a version comparison.


>   However, I need to point out that this logic is part of server_close(),
> which is not the same as shutdown(). You have been calling shutdown() which
> only ends the loop accepting new connections, but leaves any in-process
> threads to finish handling their requests.
>
>   server_close() needs to be called by your code, I would expect AFTER
> calling shutdown() to stop accepting new requests (and starting new threads
> which may not be in the list that the close is trying to join).

Should this aspect be taken into account by the code specification “with 
server:”?


> And after calling server_close() you will not be able to simply "restart" the 
> server
> -- you must go through the entire server initialization process
> (ie: create a whole new server instance).

This should be finally achieved by the implementation of my method 
“perform_command”.
I hope that corresponding data processing can be cleanly repeated then
as desired for test purposes.

Regards,
Markus
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Import module from a different subdirectory

2019-05-19 Thread Peter J. Holzer
On 2019-05-18 16:15:34 -0700, Rich Shepard wrote:
> My apologies to all who patiently tried to get me to see what I kept
> missing.

I've certainly made similar mistakes in the past (and probably will in
the future).

And I didn't see it when I read your mail the first time. But then I
read Piet's reply and thought "But Rich already wrote that ..." and
reread you message. And then I was like "Wait a minute ..."[1]

hp

[1] And now I've got Frank Zappa's "Valley Girl" stuck in my head. 
One shouldn't compose a reply while waiting for the coffee machine
to boot - too much time to form weird associations.

-- 
   _  | Peter J. Holzer| we build much bigger, better disasters now
|_|_) || because we have much more sophisticated
| |   | [email protected] | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson 


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tkinter optionMenu Resize

2019-05-19 Thread Terry Reedy

On 5/18/2019 10:40 AM, Cummins, Hayden wrote:

Hi! I've been having a lot of trouble resizing the Tkinter optionMenu feature 
due to my inexperience in Python. Is there a way to resize the option menu? If 
so, how? I've tried using the config function and it makes it so the program no 
longer executes. I also can't find any articles about this problem at all 
across the internet, so any help would be greatly appreciated. Source code to 
follow.


This is a no-attachment list.  Put *minimal* code inline.

An OptionMenu is a Menubutton subclass initialized with a default 
configuration and with a drop-down menu for which all items have the 
same callback.  The following works for me to give the button a constant 
width regardless of the selection.


from tkinter import *
r = Tk()
s = StringVar()
om = OptionMenu(r, s, 'a', 'boat', 'cantilever')
om.pack()
om['width'] = 10  # len('cantilever')
r.mainloop()  # Omit this while developing in IDLE.

If using IDLE with mainloop() disabled, you can experiment with 
configuration settings at the interactive prompt.


Helpful (but not perfect) tkinter reference:
http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/index.html
http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/menubutton.html
shows the configuration settings for menubutton.
http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/optionmenu.html
shows how to set an initial value so that the button is not initially blank.

--
Terry Jan Reedy

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


Re: Amber Brown: Batteries Included, But They're Leaking

2019-05-19 Thread John Ladasky
On Saturday, May 18, 2019 at 2:21:59 PM UTC-7, Paul Rubin wrote:
> http://pyfound.blogspot.com/2019/05/amber-brown-batteries-included-but.html
> 
> This was a controversial talk at the Python language summit, giving
> various criticisms of Python's standard library,

I will try to find some time to read through Amber Brown's remarks.  For now, I 
just want to remind everyone that we had this exact discussion here, about two 
years ago.  First post in the thread, if you want to see the source:

https://groups.google.com/forum/#!original/comp.lang.python/B2ODmhMS-x4/KMpF4yuHBAAJ


Here are a few excerpts from the thread:


On Saturday, September 16, 2017 at 11:01:03 PM UTC-7, Terry Reedy wrote: 
> The particular crippler for CLBG [Computer Language Benchmark Game]
> problems is the non-use of numpy in numerical calculations, such as the
> n-body problem.  Numerical python extensions are over two decades old 
> and give Python code access to optimized, compiled BLAS, LinPack, 
> FFTPack, and so on.  The current one, numpy, is the third of the series.
> It is both a historical accident and a continuing administrative
> convenience that numpy is not part of the Python stdlib. 


On Monday, September 18, 2017 at 10:21:55 PM UTC+1, John Ladasky wrote: 
> OK, I found this statement intriguing.  Honestly, I can't function without
> Numpy, but I have always assumed that many Python programmers do so. 
> Meanwhile: most of the time, I have no use for urllib, but that module is
> in the standard library. 
> 
> I noticed the adoption of the @ operation for matrix multiplication.  I 
> have yet to use it myself. 
> 
> So is there a fraction of the Python community that thinks that Numpy 
> should in fact become part of the Python stdlib?  What is the 
> "administrative convenience" to which you refer? 


On 2017-09-18 23:08, [email protected] wrote: 
> My very opinionated personnal opinion is that many third party libraries 
> are much better off outside of the stdlib, numpy particulary so as it's
> one of the most used, if not the most used, such libraries. 
> 
> My rationale is simple, the authors of the libraries are not tied into 
> the (c)Python release cycle, the PEP process or anything else, they can
> just get on with it. 
> 
> Consider my approach many blue moons ago when I was asking when the "new"
> regex module was going to be incorporated into Python, and getting a bit
> miffed in my normal XXXL size hat autistic way when it didn't happen.  I
> am now convinved that back then I was very firmly wrong, and that staying
> out of the stdlib has been the best thing that could have happened to
> regex.


On Tuesday, September 19, 2017 at 12:11:58 AM UTC-7, Steven D'Aprano wrote:
> On Tue, 19 Sep 2017 01:13:23 +0100, MRAB wrote:
> 
> > I even have it on a Raspberry Pi. "pip install regex" is all it took. No
> > need for it to be in the stdlib. :-)
> 
> That's fine for those of us who can run pip and install software from the 
> web without being immediately fired, and for those who have installation 
> rights on the computers they use. And those with easy, cheap and fast 
> access to the internet.
> 
> Not everyone is so lucky.


I'm not offering an opinion, just some historical context FYI.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Amber Brown: Batteries Included, But They're Leaking

2019-05-19 Thread Chris Angelico
On Mon, May 20, 2019 at 5:41 AM John Ladasky  wrote:
>
> On Saturday, May 18, 2019 at 2:21:59 PM UTC-7, Paul Rubin wrote:
> > http://pyfound.blogspot.com/2019/05/amber-brown-batteries-included-but.html
> >
> > This was a controversial talk at the Python language summit, giving
> > various criticisms of Python's standard library,
>
> I will try to find some time to read through Amber Brown's remarks.

I'll make a few comments too.

> Applications Need More Than The Standard Library
>
> For example, asyncio requires external libraries to connect to a database or 
> to speak HTTP.

Nothing in Python's standard library connects to a database (with the
minor exception of sqlite3, which isn't so much "connecting to a
database" as "reading a database file"). This is not a dependency of
asyncio any more than psycopg2 (from PyPI) is a dependency of the
socket module.

HTTP might be a valid point, as many applications could restrict
themselves to the stdlib if working synchronously or with threads, but
to do so with asyncio would require manually crafting HTTP requests
and parsing HTTP responses. Would have to confirm that, though; is it
possible to use asyncio's socket services with other modules in the
stdlib?

> Brown asserted that there were many such dependencies from the standard
> library to PyPI:

No, that is not a dependency. A dependency is where something cannot
run without something else. Nothing in the stdlib depends on anything
from PyPI. Claiming that an application needs a library from PyPI is
not the same as showing a dependency.

> typing works best with mypy,

The point of the typing module is to be the baseline that makes
annotations legal and executable, without giving them actual meaning.
Good use of mypy (or any other type checker - it's intentionally
generic) can be by publishing something that depends only on the
stdlib, but on your development computer, you install mypy. This is
the entire point of the typing module - to be part of the stdlib and
allow the code to run unmodified (but unchecked).

> the sslmodule requires a monkeypatch to connect to non-ASCII domain names,

Is that true? If confirmed, that should just be raised as an issue and
dealt with.

> datetime needs pytz,

You can easily use datetime without timezone support, either just
using naive datetimes, or using UTC. The stdlib includes support for
fixed UTC offsets too, but not daylight saving time. Considering that
the tzdata files get updated about ten times a year, baking that into
the stdlib would be a bad idea.

> and six is non-optional for writing code for Python 2 and 3.

Absolutely false. I have written 2/3 spanning code without six. It's a
convenience, and most assuredly not "non-optional". Also, writing
Py3-only code is a completely reasonable choice, especially as 2020
approaches.

> Other standard library modules are simply inferior to alternatives on PyPI.

Honestly, not surprised. If the stdlib modules were superior to the
PyPI ones, the latter wouldn't exist. There are plenty of reasons for
superior options to be installable, and that's not a problem. The
stdlib is there for people who want to be strict about deployment,
which makes it easier for people to use a script.

> The http.client documentation advises readers to use Requests,

And that's a prime example; the requests module changes too frequently
to be baked into the stdlib usefully.

> and the datetime module is confusing compared to its competitors such as 
> arrow, dateutil, and moment.

I've never even heard of arrow. Not sure what the issue is with
datetime; more details needed.

> Standard Library Modules Crowd Out Innovation
>
> Brown’s most controversial opinion, in her own estimation, is that adding 
> modules to
> the standard library stifles innovation, by discouraging programmers from 
> using
> or contributing to competing PyPI packages.

This opinion is in direct conflict with the prior complaint that there
are stdlib modules inferior to third-party ones.

> Van Rossum argued instead that if the Twisted team wants the ecosystem to
> evolve, they should stop supporting older Python versions and force users to
> upgrade. Brown acknowledged this point, but said half of Twisted users are
> still on Python 2 and it is difficult to abandon them. The debate at this 
> point
> became personal for Van Rossum, and he left angrily.

And this is what happens when you look at statistics to make your
decisions. So long as you say "half of Twisted users are on Python 2,
we have to support it", those users will say "Twisted still supports
Python 2, we don't have to move". Maybe it's not about abandoning
people but about drawing them onto a more recent Python.

> Brown said her point was to move asyncio to PyPI, along with most new
> feature development. “We should embrace PyPI,” she exhorted.

This is the only "action item" I've found in the entire rant. Quite
aside from the backward incompatibility in the specific example of
removing asyncio from the st

Why Python has no equivalent of JDBC of Java?

2019-05-19 Thread Marco Sulla via Python-list
I programmed in Python 2 and 3 for many years, and I find it a fantastic
language.

Now I'm programming in Java by m ore than 2 years, and even if I found its
code much more boilerplate, I admit that JDBC is fantastic.

One example over all: Oracle. If you want to access an Oracle DB from
Python, you have to:

1. download the Oracle instantclient and install/unzip it
2. on Linux, you have also to install/unzip Development and Runtime package
3. on windows, you have to add the instantclient to PATH
4. on Linux, you have to create a script to source that sets PATH,
ORACLE_HOME and LD_LIBRARY_PATH

Finally, you can use cx_Oracle.

Java? You have only to download ojdbcN.jar and add it to Maven/Gradle.

Why Python has no equivalent to JDBC?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Amber Brown: Batteries Included, But They're Leaking

2019-05-19 Thread Christian Heimes
On 19/05/2019 22.48, Chris Angelico wrote:
>> the sslmodule requires a monkeypatch to connect to non-ASCII domain names,

It's not correct. There were some bugs in IDNA support in the SSL
module. Nathaniel and I worked on the topic and fixed it in 3.7, see
https://bugs.python.org/issue28414

Python stdlib in general does not support some non-ASCII domain names
(German, Greek, and some Asian languages), because there is no IDNA 2008
encoding in the stdlib. The problem is not in the SSL module, but starts
as low as host name encoding for DNS lookups. The solution here is to
*add* more features to the stdlib, see
https://bugs.python.org/issue17305


By the way, I'm working on removing some dead battieres since last year,
see proto PEP
https://github.com/tiran/peps/blob/oldbatteries/pep-.rst and LWN
article https://lwn.net/Articles/755229/

Christian

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


Re: Why Python has no equivalent of JDBC of Java?

2019-05-19 Thread Chris Angelico
On Mon, May 20, 2019 at 7:34 AM Marco Sulla via Python-list
 wrote:
>
> I programmed in Python 2 and 3 for many years, and I find it a fantastic
> language.
>
> Now I'm programming in Java by m ore than 2 years, and even if I found its
> code much more boilerplate, I admit that JDBC is fantastic.
>
> One example over all: Oracle. If you want to access an Oracle DB from
> Python, you have to:
>
> 1. download the Oracle instantclient and install/unzip it
> 2. on Linux, you have also to install/unzip Development and Runtime package
> 3. on windows, you have to add the instantclient to PATH
> 4. on Linux, you have to create a script to source that sets PATH,
> ORACLE_HOME and LD_LIBRARY_PATH
>
> Finally, you can use cx_Oracle.
>
> Java? You have only to download ojdbcN.jar and add it to Maven/Gradle.
>
> Why Python has no equivalent to JDBC?

I've no idea what the hassles are with Oracle, as it's a database
engine that I don't use. But with PostgreSQL, which I *do* use, I can
assure you that it's much easier:

$ pip install psycopg2
>>> import psycopg2

Job done.

If Oracle is harder to use, it may be a specific issue with installing
the Oracle client. Have you tried using pip to install cx_oracle?

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


Re: Amber Brown: Batteries Included, But They're Leaking

2019-05-19 Thread Chris Angelico
On Mon, May 20, 2019 at 7:38 AM Christian Heimes  wrote:
>
> On 19/05/2019 22.48, Chris Angelico wrote:
> >> the sslmodule requires a monkeypatch to connect to non-ASCII domain names,
>
> It's not correct. There were some bugs in IDNA support in the SSL
> module. Nathaniel and I worked on the topic and fixed it in 3.7, see
> https://bugs.python.org/issue28414
>
> Python stdlib in general does not support some non-ASCII domain names
> (German, Greek, and some Asian languages), because there is no IDNA 2008
> encoding in the stdlib. The problem is not in the SSL module, but starts
> as low as host name encoding for DNS lookups. The solution here is to
> *add* more features to the stdlib, see
> https://bugs.python.org/issue17305
>

Thanks. And I agree; if there are limitations like this in the stdlib,
the stdlib needs to be fixed. That's not a leaking battery.

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


Re: Why Python has no equivalent of JDBC of Java?

2019-05-19 Thread Andrew Z
Marco,
  You clearly know more about python/java universe than i do.
 But im infinitely thankful to cx team for putting out the package.
Feature and performance wise , even with non supported oracle timesten, it
was fantastic.
Id always go after "native" vs jdbc. But i understand that most of apps
have a very general workflow of " select some, insert some/delete" thus
most of the native features are not required..

Sorry, its Sunday,  float off the subject.

On Sun, May 19, 2019, 17:33 Marco Sulla via Python-list <
[email protected]> wrote:

> I programmed in Python 2 and 3 for many years, and I find it a fantastic
> language.
>
> Now I'm programming in Java by m ore than 2 years, and even if I found its
> code much more boilerplate, I admit that JDBC is fantastic.
>
> One example over all: Oracle. If you want to access an Oracle DB from
> Python, you have to:
>
> 1. download the Oracle instantclient and install/unzip it
> 2. on Linux, you have also to install/unzip Development and Runtime package
> 3. on windows, you have to add the instantclient to PATH
> 4. on Linux, you have to create a script to source that sets PATH,
> ORACLE_HOME and LD_LIBRARY_PATH
>
> Finally, you can use cx_Oracle.
>
> Java? You have only to download ojdbcN.jar and add it to Maven/Gradle.
>
> Why Python has no equivalent to JDBC?
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Amber Brown: Batteries Included, But They're Leaking

2019-05-19 Thread Terry Reedy

On 5/19/2019 4:48 PM, Chris Angelico wrote:

On Mon, May 20, 2019 at 5:41 AM John Ladasky  wrote:


On Saturday, May 18, 2019 at 2:21:59 PM UTC-7, Paul Rubin wrote:

http://pyfound.blogspot.com/2019/05/amber-brown-batteries-included-but.html

This was a controversial talk at the Python language summit, giving
various criticisms of Python's standard library,


I will try to find some time to read through Amber Brown's remarks.


I'll make a few comments too.


I read them and the read what I concluded is yet another useless, 
contradictory, rant based partly on ignorance and mis-information.


You corrected some of the latter.


Brown said her point was to move asyncio to PyPI, along with most new
feature development. “We should embrace PyPI,” she exhorted.


This is the only "action item" I've found in the entire rant.


The disinformation is the implication that core developers have not 
embraced pypi.  But anyone reading this list and python-ideas would know 
that it is mostly users pushing for new modules and some particular 
features in the stdlib and core developers saying "Whoo, we are already 
overloaded.  Start something on pypi first and *maybe* we will consider 
it later."


I think her main point is that she, a twisted developer, is mad and 
thinks it unfair that competitor asyncio was privileged by being allowed 
to be developed in the stdlib.  Hence, "Ever since asyncio was announced 
she has had to explain why Twisted is still worthwhile". And hence her 
wish that it, in particular, be relegated to being one competitor among 
others on pypi.



--
Terry Jan Reedy


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


Re: Why Python has no equivalent of JDBC of Java?

2019-05-19 Thread Andrew Z
The pg python lib requires
https://www.postgresql.org/docs/current/libpq.html
pip pulls it as a part of the lib install, whereas in oracle case you
install the driver yourself first.(suize matters)

//for some reason i thought the driver libs come as part of cx . But it was
a year ago and my memory may play tricks on me.


On Sun, May 19, 2019, 17:44 Chris Angelico  wrote:

> On Mon, May 20, 2019 at 7:34 AM Marco Sulla via Python-list
>  wrote:
> >
> > I programmed in Python 2 and 3 for many years, and I find it a fantastic
> > language.
> >
> > Now I'm programming in Java by m ore than 2 years, and even if I found
> its
> > code much more boilerplate, I admit that JDBC is fantastic.
> >
> > One example over all: Oracle. If you want to access an Oracle DB from
> > Python, you have to:
> >
> > 1. download the Oracle instantclient and install/unzip it
> > 2. on Linux, you have also to install/unzip Development and Runtime
> package
> > 3. on windows, you have to add the instantclient to PATH
> > 4. on Linux, you have to create a script to source that sets PATH,
> > ORACLE_HOME and LD_LIBRARY_PATH
> >
> > Finally, you can use cx_Oracle.
> >
> > Java? You have only to download ojdbcN.jar and add it to Maven/Gradle.
> >
> > Why Python has no equivalent to JDBC?
>
> I've no idea what the hassles are with Oracle, as it's a database
> engine that I don't use. But with PostgreSQL, which I *do* use, I can
> assure you that it's much easier:
>
> $ pip install psycopg2
> >>> import psycopg2
>
> Job done.
>
> If Oracle is harder to use, it may be a specific issue with installing
> the Oracle client. Have you tried using pip to install cx_oracle?
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Amber Brown: Batteries Included, But They're Leaking

2019-05-19 Thread Terry Reedy

On 5/19/2019 5:34 PM, Christian Heimes wrote:


By the way, I'm working on removing some dead battieres since last year,
see proto PEP
https://github.com/tiran/peps/blob/oldbatteries/pep-.rst and LWN
article https://lwn.net/Articles/755229/


Hooray!
I believe that there are other modules, other than distutils, that 
others have proposed for deletion after 2.7 expires.


While deleting in 3.9 would be nice, I agree on waiting for 3.10.  Track 
issues to fix/enhance could be deleted before that.  For 3.8, I think 
deprecation in the docs and possibly PendingDeprecationWarning could be 
added anytime up to the .rc.


colorsys, color conversion functions between RGB, YIQ, HLS, and HSV 
coordinate systems, seems like it should still be useful.  Looking for 
substututes on pypi, I found


pyrgb: color conversion functions - RGB, HSV, HSL, CMYK
This needs YIQ to be a superset of colorsys.  Py version unspecified.

colorutils: among other things, conversions between RGB tuples, 
6-character HEX strings, 3-character HEX strings, WEB, YIQ, and HSV. 
WEB is a 'well-known' color name, when available, such as 'SeaGreen'. 
(Tk names would be helpful for tkinter programming.  HEX is used in Tk.) 
This needs HSL to be a superset.  2.7, last release 5/25/2015


Conclusion: colorsys could be pretty well replaced by an improved 
version of either package.


In the Linux World comments, k8to says "For a silly data point, I still 
have code that I still run that process amiga data files that I use in 
an archival project. I'm a little sad about some of the modules I use 
being removed from python.  I'm sure I can work around the problem 
though, as I only run the code locally."


My thought: who better to maintain an atari date file library than 
someone who still processes such libraries?  So publicize the PEP and 
encourage experts in old protocols to maintain the corresponding code.


--
Terry Jan Reedy

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


The state of asyncio in 2019

2019-05-19 Thread Becaree
So i started to use asyncio some times ago. I see a lots of threads/forums 
which date back from 2015 or older. My question is what the state of asyncio in 
2019? I guess, the major constrain of having async/await is quiet a drawback. I 
do love asyncio but reinventing the wheel using it is somehow complicated for a 
community. I mean i found disappointed that major scheduler don't use it as 
airflow/luigi/dask. Also pulsar is kind of unmaintained. So now i wonder, 
should i stick with asyncio or some async/await-freed coroutines as use tornado 
or gevent is the way to go?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The state of asyncio in 2019

2019-05-19 Thread Chris Angelico
On Mon, May 20, 2019 at 11:56 AM Becaree
 wrote:
>
> So i started to use asyncio some times ago. I see a lots of threads/forums 
> which date back from 2015 or older. My question is what the state of asyncio 
> in 2019? I guess, the major constrain of having async/await is quiet a 
> drawback. I do love asyncio but reinventing the wheel using it is somehow 
> complicated for a community. I mean i found disappointed that major scheduler 
> don't use it as airflow/luigi/dask. Also pulsar is kind of unmaintained. So 
> now i wonder, should i stick with asyncio or some async/await-freed 
> coroutines as use tornado or gevent is the way to go?
>

It depends a bit on what you're trying to do, but if you want a system
that doesn't use async/await, you may want to first look at the
built-in "threading" module. It doesn't scale to infinity the way
asyncio can, but for workloads of up to a few thousand threads, it
should be fine. In the context of an internet server, for instance,
that would mean you can handle a few thousand concurrent requests by
simply having that many threads, each one handling one request at a
time.

Otherwise, there's really not a lot that's fundamentally *bad* about
using the await keyword everywhere that you need to block. Just keep
an eye on your libraries' documentation, and if it says something's a
coroutine, slap an await in front of it. I've used asyncio in several
projects, and it doesn't feel all that onerous. For instance, this
function:

https://github.com/Rosuav/csgo_automute/blob/master/server.py#L47

responds to an HTTP request by saying "okay, wait till you have the
whole body, and JSON-decode it", then does some synchronous work, and
then says "ooh that was interesting, let's broadcast that to all
clients". Pretty simple. The websocket handler above it is similar;
although at the moment, it's very stubby, so it's probably not a great
example. (All it does is listen for messages and then print them on
the console. Mucho excitement.) That's using aiohttp. For vanilla
socket services, you can do everything using the standard library
directly - either start a server (to bind and listen), or connect a
socket, and then await your reads and your writes.

The past four years have definitely seen notable improvements to
asyncio in Python.

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