comp.lang.python

2019-02-11 Thread Jaya Priya
The comp.lang.python.announce newsgroup (or c.l.py.a for short) has been created in early 1998 as a companion newsgroup for comp.lang.python focused on Python-related announcements. ... other items of general interest to the Python community. https://www.gangboard.com/big-data-training/data-scie

Re: exit 2 levels of if/else and execute common code

2019-02-11 Thread Cameron Simpson
On 11Feb2019 08:17, Irv Kalb wrote: On Feb 11, 2019, at 7:25 AM, Neal Becker wrote: I have code with structure: ``` if cond1: [some code] if cond2: #where cond2 depends on the above [some code] [ more code] else: [ do xxyy ] else: [ do the same xxyy as above ] ``` So what's the best

Re: Replicating YouTube video AI code in python

2019-02-11 Thread jadenfigger
The error I get typing pip install -U tensorflow into the command terminal Could not find a version that satisfies the requirement tensorflow (from versions: ) No matching distribution found for tensorflow. Ive been able to install numpy, scipy, and pygame. Tensorflow is the only package tha

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

2019-02-11 Thread Chris Angelico
On Tue, Feb 12, 2019 at 8:13 AM Avi Gross wrote: > > > Just Chris, Can we keep things on the list please? > I am thinking I missed the point of this discussion thus what I say makes no > sense. Not sure. You were fairly specific with your statements about how things supposedly were in the past.

Re: more pythonic way

2019-02-11 Thread Jimmy Girardet
The first one is used very often. Less verbose Le 11 févr. 2019 à 20:41, à 20:41, Felix Lazaro Carbonell a écrit: > > >Hello to everyone: > >Could you please tell me wich way of writing this method is more >pythonic: > > > >.. > >def find_monthly_expenses(month=None, year=None): > >

Re: Can't run setup.py offline due to setup_requires - setup.py calls home

2019-02-11 Thread Chris Narkiewicz via Python-list
On 11/02/2019 19:30, Chris Narkiewicz via Python-list wrote: > Is there any extra step I have to take? Ok, I'll respond to myself, as this was really silly. Debian ships hopelessly obsolete pip 9.PEP 518 is supported in pip 10+. Cheers, Chris signature.asc Description: OpenPGP digital signatur

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

2019-02-11 Thread Ian Kelly
On Mon, Feb 11, 2019 at 1:56 PM boB Stepp wrote: > > On Mon, Feb 11, 2019 at 2:34 PM Chris Angelico wrote: > > > Calling on the D'Aprano Collection of Ancient Pythons for confirmation > > here, but I strongly suspect that positional arguments with defaults > > go back all the way to 1.x. > > Has

Re: more pythonic way

2019-02-11 Thread Peter Otten
Felix Lazaro Carbonell wrote: > Hello to everyone: > Could you please tell me wich way of writing this method is more pythonic: > def find_monthly_expenses(month=None, year=None): > > month = month or datetime.date.today() > Or it should better be: > if not month: >

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

2019-02-11 Thread boB Stepp
On Mon, Feb 11, 2019 at 2:34 PM Chris Angelico wrote: > Calling on the D'Aprano Collection of Ancient Pythons for confirmation > here, but I strongly suspect that positional arguments with defaults > go back all the way to 1.x. Has Steve's banishment ended yet? The only postings I have recently

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

2019-02-11 Thread Ian Kelly
On Mon, Feb 11, 2019 at 1:35 PM Chris Angelico wrote: > > On Tue, Feb 12, 2019 at 7:26 AM Avi Gross wrote: > > If you want to talk about recent or planned changes, fine. But make that > > clear. I was talking about how in the past positional arguments did not have > > defaults available at the de

Re: more pythonic way

2019-02-11 Thread Peter Otten
Grant Edwards wrote: > On 2019-02-11, Felix Lazaro Carbonell wrote: > >> Could you please tell me wich way of writing this method is more >> pythonic: >> >> def find_monthly_expenses(month=None, year=None): >> month = month or datetime.date.today() >> >> Or it should better be: >> >>

Re: more pythonic way

2019-02-11 Thread Sivan Grünberg
+1 with David Raymond, it's nice to use condensed style when it leaves things readable and logic. But if in doubt: "Explicit is better than implicit. Simple is better than complex." :) -Sivan On Mon, Feb 11, 2019 at 10:19 PM David Raymond wrote: > My non-expert vote is for > > if month is None

Re: more pythonic way

2019-02-11 Thread Terry Reedy
On 2/11/2019 2:46 PM, Felix Lazaro Carbonell wrote: def find_monthly_expenses(month=None, year=None): month = month or datetime.date.today().month Or it should better be: if not month: month = datetime.date.today().month As a 20+ year veteran, I would be

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

2019-02-11 Thread Chris Angelico
On Tue, Feb 12, 2019 at 7:26 AM Avi Gross wrote: > If you want to talk about recent or planned changes, fine. But make that > clear. I was talking about how in the past positional arguments did not have > defaults available at the def statement level. I was talking about how use > of the symbol "=

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

2019-02-11 Thread Avi Gross
Ian, Again, not having read whatever documentation we may be discussing, I may be very wrong. The topic is the C API. I started using C at Bell Laboratories in 1982 replacing other languages I had used before. I haven't felt a reason to use it in the last few decades as I moved on to yet other la

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

2019-02-11 Thread Avi Gross
Ian, I now assume we are no longer talking about the past or even the present but some planned future. In that future we are talking about how to define a function with added or changed functionality. So nothing I wrote earlier really applies because I was talking of how things did work in the abs

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

2019-02-11 Thread Avi Gross
Ian, I want to make sure we are talking about the same things in the same ways. I will thus limit my comments in this message. If efficiency is your major consideration, then using only positional arguments of known types you can place on the stack and optimize at compile time may be a great way

RE: more pythonic way

2019-02-11 Thread David Raymond
My non-expert vote is for if month is None: month = datetime.date.today().month Because you're checking for your default value, not whether the boolean version of what they did give you is True or False. It's explicit, it's not reliant on any __bool__() function implementations or overrides

RE: more pythonic way

2019-02-11 Thread Felix Lazaro Carbonell
-Mensaje original- De: Python-list [mailto:python-list-bounces+felix=epepm.cupet...@python.org] En nombre de Grant Edwards Enviado el: lunes, 11 de febrero de 2019 02:46 p.m. Para: python-list@python.org Asunto: Re: more pythonic way On 2019-02-11, Felix Lazaro Carbonell wrote: > Coul

RE: more pythonic way

2019-02-11 Thread Felix Lazaro Carbonell
Sorry I meant .. def find_monthly_expenses(month=None, year=None): month = month or datetime.date.today().month .. Or it should better be: ... if not month: month = datetime.date.today().month .. Cheers, Felix. -- https://mail.python.org/mailman

Re: more pythonic way

2019-02-11 Thread Grant Edwards
On 2019-02-11, Felix Lazaro Carbonell wrote: > Could you please tell me wich way of writing this method is more pythonic: > > def find_monthly_expenses(month=None, year=None): > month = month or datetime.date.today() > > Or it should better be: > > if not month: >

more pythonic way

2019-02-11 Thread Felix Lazaro Carbonell
Hello to everyone: Could you please tell me wich way of writing this method is more pythonic: .. def find_monthly_expenses(month=None, year=None): month = month or datetime.date.today() .. Or it should better be: ... if not month: month = datetime.d

Re: Can't run setup.py offline due to setup_requires - setup.py calls home

2019-02-11 Thread Chris Narkiewicz via Python-list
On 11/02/2019 15:57, Ben Finney wrote: > All of the build dependencies, *including* the ones specified in > ‘setup_requires’? Yes. easy_install simply doesn't look there. If I provide ~/.pydistutils.cfg with a path to find_links, it works ok. Config file in $HOME however is no-go for a CI or buil

Re: Replicating YouTube video AI code in python

2019-02-11 Thread Abdur-Rahmaan Janhangeer
what python version are you using? what errors are you getting? Abdur-Rahmaan Janhangeer http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ Mauritius -- https://mail.python.org/mailman/listinfo/python-list

Replicating YouTube video AI code in python

2019-02-11 Thread jadenfigger
I'm trying to replicate the YouTube video, https://m.youtube.com/watch?v=NTlXEJjfsQU. The videos git hub address is, https://github.com/carykh/alignedCelebFaces. The video says I have to download python 3 and using pip download tensorflow, numpy, scipy, and pygame. I've tried downloading this

Re: Im trying to replicate the youtube video Creating my own customized celebrities with AI.

2019-02-11 Thread Peter J. Holzer
On 2019-02-10 16:28:24 -0500, Avi Gross wrote: > >> tenserflow, pygame, scipy, and numby [...] > please mention that the tenser flow should be tensorflow. Eight, sir; seven, sir; Six, sir; five, sir; Four, sir; three, sir; Two, sir; one! Tenser, said the Tensor. Tenser, said the Tensor. Tension, a

Re: where is math_sin defined?

2019-02-11 Thread Barry Scott
> On 10 Feb 2019, at 16:43, Chris Angelico wrote: > > On Mon, Feb 11, 2019 at 3:37 AM Barry Scott wrote: >> >> On Sunday, 10 February 2019 15:15:32 GMT Jon Ribbens wrote: >>> As an aside, how is 'math.sin' actually implemented? mathmodule.c >>> refers to the function 'math_sin' but that name

Zato blog post: A successful Python 3 migration story

2019-02-11 Thread Terry Reedy
The migration was from 2.7 to 2.7 and 3.x, rather than 3.x only. I think it worth reading for anyone interested in the subject. https://zato.io/blog/posts/python-3-migration-success-story.html 60,000 lines of Python and Cython, 130 external dependencies (but only 10 not already 3.x ready) took 2

Re: exit 2 levels of if/else and execute common code

2019-02-11 Thread Neal Becker
Chris Angelico wrote: > On Tue, Feb 12, 2019 at 3:21 AM Neal Becker wrote: >> >> Chris Angelico wrote: >> >> > On Tue, Feb 12, 2019 at 2:27 AM Neal Becker >> > wrote: >> >> >> >> I have code with structure: >> >> ``` >> >> if cond1: >> >> [some code] >> >> if cond2: #where cond2 depends on t

Re: exit 2 levels of if/else and execute common code

2019-02-11 Thread Irv Kalb
> On Feb 11, 2019, at 7:25 AM, Neal Becker wrote: > > I have code with structure: > ``` > if cond1: > [some code] > if cond2: #where cond2 depends on the above [some code] >[ more code] > > else: >[ do xxyy ] > else: > [ do the same xxyy as above ] > ``` > > So what's the best sty

Re: exit 2 levels of if/else and execute common code

2019-02-11 Thread Chris Angelico
On Tue, Feb 12, 2019 at 3:21 AM Neal Becker wrote: > > Chris Angelico wrote: > > > On Tue, Feb 12, 2019 at 2:27 AM Neal Becker wrote: > >> > >> I have code with structure: > >> ``` > >> if cond1: > >> [some code] > >> if cond2: #where cond2 depends on the above [some code] > >> [ more cod

Re: exit 2 levels of if/else and execute common code

2019-02-11 Thread Neal Becker
Chris Angelico wrote: > On Tue, Feb 12, 2019 at 2:27 AM Neal Becker wrote: >> >> I have code with structure: >> ``` >> if cond1: >> [some code] >> if cond2: #where cond2 depends on the above [some code] >> [ more code] >> >> else: >> [ do xxyy ] >> else: >> [ do the same xxyy as a

Re: exit 2 levels of if/else and execute common code

2019-02-11 Thread Dan Sommers
On 2/11/19 9:25 AM, Neal Becker wrote: I have code with structure: ``` if cond1: [some code] if cond2: #where cond2 depends on the above [some code] [ more code] else: [ do xxyy ] else: [ do the same xxyy as above ] ``` So what's the best style to handle this? As coded, i

Re: Can't run setup.py offline due to setup_requires - setup.py calls home

2019-02-11 Thread Ben Finney
Chris Narkiewicz via Python-list writes: > debian/rules calls this pip to install all requirements from local > package collection: > > pip3 install --log=... --no-cache --no-index --find-links=pypi > --no-binary=":all:" -r requirements.txt As you have observed, this fails because Setuptools doe

Re: exit 2 levels of if/else and execute common code

2019-02-11 Thread Chris Angelico
On Tue, Feb 12, 2019 at 2:27 AM Neal Becker wrote: > > I have code with structure: > ``` > if cond1: > [some code] > if cond2: #where cond2 depends on the above [some code] > [ more code] > > else: > [ do xxyy ] > else: > [ do the same xxyy as above ] > ``` > > So what's the best s

Re: exit 2 levels of if/else and execute common code

2019-02-11 Thread Neal Becker
Rhodri James wrote: > On 11/02/2019 15:25, Neal Becker wrote: >> I have code with structure: >> ``` >> if cond1: >>[some code] >>if cond2: #where cond2 depends on the above [some code] >> [ more code] >> >>else: >> [ do xxyy ] >> else: >>[ do the same xxyy as above ] >>

Re: exit 2 levels of if/else and execute common code

2019-02-11 Thread Rhodri James
On 11/02/2019 15:25, Neal Becker wrote: I have code with structure: ``` if cond1: [some code] if cond2: #where cond2 depends on the above [some code] [ more code] else: [ do xxyy ] else: [ do the same xxyy as above ] ``` So what's the best style to handle this? As coded,

exit 2 levels of if/else and execute common code

2019-02-11 Thread Neal Becker
I have code with structure: ``` if cond1: [some code] if cond2: #where cond2 depends on the above [some code] [ more code] else: [ do xxyy ] else: [ do the same xxyy as above ] ``` So what's the best style to handle this? As coded, it violates DRY. Try/except could be used with

Re: My appreciation for python's great work to my country.

2019-02-11 Thread Alex Kaye
Kiyimba, In my community in Arizona ( pop 7000) I am the only one using Linux and the only one who is studying Python, no one is coding. So spread your knowledge among the youth of your commun ity. It is good for their future. Alex Kaye On Sat, Feb 9, 2019 at 1:34 PM Terry Reedy wrote: > On 2

Can't run setup.py offline due to setup_requires - setup.py calls home

2019-02-11 Thread Chris Narkiewicz via Python-list
Hi, I'm trying to build a debian package in offline environment (build server). To build this package, I need to ship all python dependencies as source packages and build them there. This is no problem for all, except one package that has build-time dependencies: Automat-0.70. debian/rules calls

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

2019-02-11 Thread Terry Reedy
On 2/11/2019 2:47 AM, Ian Kelly wrote: For math.sin, sure, but what about, say, list.index? Special-case conversion is a different issue from blanket conversion. Some C functions have been converted to accept some or all args by keyword. I don't know the status of list method conversion: dis

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

2019-02-11 Thread Chris Angelico
On Mon, Feb 11, 2019 at 6:51 PM Terry Reedy wrote: > > and not normally accessible to pure Python functions without > > some arm twisting. > > In my first response on this thread I explained and demonstrated how to > access signature strings from Python, as done by both help() and IDLE. > Please r

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

2019-02-11 Thread Chris Angelico
On Mon, Feb 11, 2019 at 6:49 PM Ian Kelly wrote: > > On Mon, Feb 11, 2019 at 12:19 AM Terry Reedy wrote: > > The pass-by-position limitation is not in CPython, it is the behavior of > > C functions, which is the behavior of function calls in probably every > > assembly and machine language. Allo