Re: Teaching the "range" function in Python 3

2017-06-29 Thread Peter Otten
Gregory Ewing wrote: > Don't start with range(). Start with lists, and introduce the for > loop as a way to iterate over lists. Leave range() until much later. > You should be able to go a *long* way without it -- it's quite > rare to need to iterate over a range of ints in idiomatic Python > code

Re: Teaching the "range" function in Python 3

2017-06-29 Thread Rustom Mody
On Friday, June 30, 2017 at 8:28:23 AM UTC+5:30, Chris Angelico wrote: > On Fri, Jun 30, 2017 at 12:33 PM, Rick Johnson wrote: > > A better *FIRST* example would be > > something like this: > > > > def add(x, y): > > return x + y > > > > When teaching a student about functions, the firs

Re: import queue in Python 2 and Python 3

2017-06-29 Thread Chris Angelico
On Fri, Jun 30, 2017 at 2:06 PM, Benjamin Chaney wrote: > What is the best way to import the synchronized queue class that is > compatible with both Python2 and Python3. Right now I am using the > following: > >>if sys.version_info < (3, 0): >>import Queue as queue >>else: >>import queue >

import queue in Python 2 and Python 3

2017-06-29 Thread Benjamin Chaney
What is the best way to import the synchronized queue class that is compatible with both Python2 and Python3. Right now I am using the following: >if sys.version_info < (3, 0): >import Queue as queue >else: >import queue This seems somewhat unpythonic. Is there a better way without instal

Re: Converting sentences to vector form

2017-06-29 Thread Rick Johnson
On Tuesday, June 27, 2017 at 6:15:31 AM UTC-5, Bhaskar Dhariyal wrote: > You can't train a model on words. https://youtu.be/dSIKBliboIo?t=52 -- https://mail.python.org/mailman/listinfo/python-list

Re: Teaching the "range" function in Python 3

2017-06-29 Thread Chris Angelico
On Fri, Jun 30, 2017 at 12:33 PM, Rick Johnson wrote: > A better *FIRST* example would be > something like this: > > def add(x, y): > return x + y > > When teaching a student about functions, the first step is > to help them understand *WHY* they need to use functions, > and the second

Re: Teaching the "range" function in Python 3

2017-06-29 Thread Rick Johnson
On Thursday, June 29, 2017 at 4:01:07 PM UTC-5, Irv Kalb wrote: > > [...] > > But Python 3's version of the range function has been > turned into a generator. Again, I understand why this > happened, and I agree that this is a good change. The > problem is, how can I explain this concept to stude

Re: Teaching the "range" function in Python 3

2017-06-29 Thread Gregory Ewing
Irv Kalb wrote: In Python 2, I easily demonstrated the range function using a simple print statement: print range(0, 10) I discussed how range returns a list. I gave many examples of different values being passed into range, and printing the resulting lists. Next, I introduced the concept of

Re: Teaching the "range" function in Python 3

2017-06-29 Thread Cameron Simpson
On 29Jun2017 13:57, Irv Kalb wrote: Now I am looking at the change in the range function. I completely understand the differences between, and the reasons for, how range works differently in Python 2 vs Python 3. The problem that I've run into has to do with how to explain what range does in

Re: Teaching the "range" function in Python 3

2017-06-29 Thread Ian Kelly
On Thu, Jun 29, 2017 at 2:57 PM, Irv Kalb wrote: > Now I am looking at the change in the range function. I completely > understand the differences between, and the reasons for, how range works > differently in Python 2 vs Python 3. The problem that I've run into has to > do with how to explai

Re: Teaching the "range" function in Python 3

2017-06-29 Thread Chris Angelico
On Fri, Jun 30, 2017 at 6:57 AM, Irv Kalb wrote: > I am wondering if other teachers have run into this. Is this a real problem? > If so, is there any other way of explaining the concept without getting into > the underlying details of how a generator works? Do you think it would be > helpful

Teaching the "range" function in Python 3

2017-06-29 Thread Irv Kalb
I teach Python at two colleges in Silicon Valley. I currently teach an introductory course on Python and most of my students have no programming background whatsoever. Up until now, my colleges have been using Python 2. But now, one of the colleges has made the jump to Python 3. So I am upda

Re: sys.exc_info

2017-06-29 Thread Thomas Jollans
On 29/06/17 19:00, eryk sun wrote: > On Thu, Jun 29, 2017 at 6:50 AM, Steven D'Aprano wrote: >> try: >> something >> except: >> exc_type, exc, tb = sys.exc_info() >> print(traceback.extract_tb(tb)) >> raise >> >> Why does it return the exception type separately from the exception,

Re: sys.exc_info

2017-06-29 Thread MRAB
On 2017-06-29 19:19, Thomas Jollans wrote: [snip] Ah, Python history. Back in the old days, it was possible to raise strings instead of the classes that took over later. Python 2.4.6 (#1, Jun 29 2017, 19:23:06) [GCC 5.4.0 20160609] on linux4 Type "help", "copyright", "credits" or "license" for

Re: sys.exc_info

2017-06-29 Thread Thomas Jollans
On 29/06/17 08:50, Steven D'Aprano wrote: > sys.exc_info() returns three items: > > (exception type, exception value, traceback) > > https://docs.python.org/2/library/sys.html#sys.exc_info > > https://docs.python.org/3/library/sys.html#sys.exc_info > > > > and may be used something like this

Re: sys.exc_info

2017-06-29 Thread eryk sun
On Thu, Jun 29, 2017 at 6:50 AM, Steven D'Aprano wrote: > try: > something > except: > exc_type, exc, tb = sys.exc_info() > print(traceback.extract_tb(tb)) > raise > > Why does it return the exception type separately from the exception, when > the type can be derived by calling `ty

Re: Development testing without reinstalling egg constantly?

2017-06-29 Thread Grant Edwards
On 2017-06-29, Rob Gaddi wrote: > On 06/29/2017 08:32 AM, Grant Edwards wrote: >> >> This is somebody else's project I'm hacking on, and my understanding >> of setup tools is pretty much at the "cargo cult" level. > > I have a sneaking suspicion that's everyone. Setuptools (and distutils > befo

Re: Development testing without reinstalling egg constantly?

2017-06-29 Thread Rob Gaddi
On 06/29/2017 08:32 AM, Grant Edwards wrote: This is somebody else's project I'm hacking on, and my understanding of setup tools is pretty much at the "cargo cult" level. I have a sneaking suspicion that's everyone. Setuptools (and distutils before it) has no underlying rhyme or reason; jus

Re: Development testing without reinstalling egg constantly?

2017-06-29 Thread Tim Daneliuk
On 06/29/2017 09:03 AM, Grant Edwards wrote: > I've forked a copy of https://github.com/Roguelazer/muttdown and have > been adding a few features and fixing a few bugs. It's meant to be When doing this sort of thing, I find 'pew' virtual environments immensely helpful. They allow you to control

Re: Development testing without reinstalling egg constantly?

2017-06-29 Thread Tim Daneliuk
On 06/29/2017 09:03 AM, Grant Edwards wrote: > I've forked a copy of https://github.com/Roguelazer/muttdown and have > been adding a few features and fixing a few bugs. It's meant to be When doing this sort of thing, I find 'pew' virtual environments immensely helpful. They allow you to control

Re: Development testing without reinstalling egg constantly?

2017-06-29 Thread Grant Edwards
On 2017-06-29, Peter Otten <__pete...@web.de> wrote: > Grant Edwards wrote: > >> The projects 'main.py' can't be run directly from the command line, >> since it contains code like this: >> >>from . import config >>from . import __version__ >>__name__ = 'muttdown' >> >>[ stuff t

Re: Development testing without reinstalling egg constantly?

2017-06-29 Thread Peter Otten
Grant Edwards wrote: > The projects 'main.py' can't be run directly from the command line, > since it contains code like this: > >from . import config >from . import __version__ >__name__ = 'muttdown' > >[ stuff that does real work ] Stupid question: isn't the following >

Re: Development testing without reinstalling egg constantly?

2017-06-29 Thread Ned Batchelder
On Thursday, June 29, 2017 at 10:04:30 AM UTC-4, Grant Edwards wrote: > I've forked a copy of https://github.com/Roguelazer/muttdown and have > been adding a few features and fixing a few bugs. It's meant to be > installed using setup tools, and then invoked via /usr/bin/muttdown > which looks lik

Development testing without reinstalling egg constantly?

2017-06-29 Thread Grant Edwards
I've forked a copy of https://github.com/Roguelazer/muttdown and have been adding a few features and fixing a few bugs. It's meant to be installed using setup tools, and then invoked via /usr/bin/muttdown which looks like this: #!/usr/lib/python-exec/python2.7/python2 # EASY-INSTALL-ENTRY-S

Re: Error

2017-06-29 Thread Rhodri James
On 28/06/17 21:08, Ken R. Lewis wrote: Traceback (most recent call last): File "I:/CernerProcesses/ServiceNow/new0628.py", line 31, in data = response.json() File "C:\Program Files\Python36\lib\site-packages\requests-2.18.1-py3.6.egg\requests\models.py", line 894, in json retur

Solution Manual Test Bank for Financial Statement Analysis and Valuation 5th Edition by Easton

2017-06-29 Thread Test Banks
Greetings Students, We do have Solution Manuals and Test Bank for FINANCIAL STATEMENT ANALYSIS AND VALUATION BY EASTON at reasonable price. You can get above mentioned resources by sending email to pro.fast(@)hotmail(dot)com Send your order queries at PRO.FAST(@)HOTMAIL(DOT)COM Below are de

Solution Manual Test Bank for Financial and Managerial Accounting for MBAs 5th Edition by Easton

2017-06-29 Thread Test Banks
Greetings Students, We do have Solution Manuals and Test Bank for FINANCIAL AND MANAGERIAL ACCOUNTING FOR MBAs 5TH EDITION BY EASTON at reasonable price. You can get above mentioned resources by sending email to pro.fast(@)hotmail(dot)com Send your order queries at PRO.FAST(@)HOTMAIL(DOT)COM

Solution Manual Test Bank for Financial Accounting for MBAs 7th Edition by Easton

2017-06-29 Thread Test Banks
Greetings Students, We do have Solution Manuals and Test Bank for FINANCIAL ACCOUNTING FOR MBAs 7th EDITION BY EASTON at reasonable price. You can get above mentioned resources by sending email to pro.fast(@)hotmail(dot)com Send your order queries at PRO.FAST(@)HOTMAIL(DOT)COM Below are det

Operations Management 13th E by Stevenson Solution Manuals

2017-06-29 Thread Test Banks
Greetings Students, We do have Solution Manuals and Test Bank for OPERATIONS MANAGEMENT 13TH E BY STEVENSON at reasonable price. You can get above mentioned resources by sending email to pro.fast(@)hotmail(dot)com. Send your order queries at PRO.FAST(@)HOTMAIL(DOT)COM Below are details give

Test Bank for Corrections in the 21st Century 8th Edition by Frank Schmalleger

2017-06-29 Thread Test Banks
Greetings Students, We do have Test Bank for CORRECTIONS IN THE 21ST CENTURY 8TH EDITION BY SCHMALLEGER at reasonable price. You can get above mentioned resources by sending email to pro.fast(@)hotmail(dot)com Send your order queries at PRO.FAST(@)HOTMAIL(DOT)COM Below are details given for

Re: How to build a simple neural network in 9 lines of Python code

2017-06-29 Thread John Ladasky
On Tuesday, June 27, 2017 at 7:28:58 PM UTC-7, Steve D'Aprano wrote: > On Wed, 28 Jun 2017 06:22 am, Marko Rauhamaa wrote: > > > You saw the APL example, right? APL's standard runtime/library contains > > most of Numpy functionality because that's what APL has been designed > > for. > > > > Is th

Re: How to build a simple neural network in 9 lines of Python code

2017-06-29 Thread John Ladasky
On Tuesday, June 27, 2017 at 12:34:46 PM UTC-7, Marko Rauhamaa wrote: > John Ladasky : > > OK, that's cheating a bit, using Numpy. It's a nice little program, > > but it leverages a huge, powerful library. > > What would *not* be cheating? A language without a library would be > dead. Python's st

Re: Mouse position values

2017-06-29 Thread Steven D'Aprano
On Wed, 28 Jun 2017 11:32:46 -0300, jorge.conrado wrote: > Hi, > > I have 3D data array and would like to plot arbitrary cross section by > cliking in my image. I was an IDL user and in IDL we have a cursor.pro > that I used to get the X and Y positions on my image. I would like know > how can I