Re: Problem/bug with class definition inside function definition

2018-05-07 Thread Gregory Ewing
Python 3.5.1 (default, Jun 1 2016, 13:15:26) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> def f(a): ... class D: ... pass ... D.a = a ... return D ... >>> c = f(42) >>> c .D'> >>> c.a 42 -- Greg -- https://mail.pyth

Re: Tracebacks for exceptions in interactively entered code.

2018-05-07 Thread Serhiy Storchaka
07.05.18 22:59, Terry Reedy пише: I intend to improve the IDLE doc section on IDLE-console differences. Don't haste to document it. The behavior of the standard interactive mode can be changed in 3.8. -- https://mail.python.org/mailman/listinfo/python-list

Suggestion for a "data" object syntax

2018-05-07 Thread Mikhail V
Here is an idea for 'data object' a syntax. For me it is interesting, how would users find such syntax. I personally find that this should be attractive from users perspective. Main aim is more readable presenting of typical data chunks and some typical data types (tuples/lists) directly in code. F

Re: Module, Package

2018-05-07 Thread Ben Finney
Sharan Basappa writes: > One question. So, we can import the entire package or just a module in > a given package. Is this correct? Each time you ‘import foo’, you are getting a module. > For example, > import nltk That results in a module object, and you can use the name ‘nltk’ to reference t

Re: Module, Package

2018-05-07 Thread Sharan Basappa
MRAB, ChirisA, One question. So, we can import the entire package or just a module in a given package. Is this correct? For example, import nltk import nltk.stem -- https://mail.python.org/mailman/listinfo/python-list

Re: Module, Package

2018-05-07 Thread Sharan Basappa
On Monday, 7 May 2018 23:09:41 UTC+5:30, Chris Angelico wrote: > On Tue, May 8, 2018 at 2:53 AM, Sharan Basappa > wrote: > > I am a bit confused between module and package in Python. > > Does a module contain package or vice versa? > > When we import something in Python, do we import a module or

Re: seeking deeper (language theory) reason behind Python design choice

2018-05-07 Thread Steven D'Aprano
On Mon, 07 May 2018 22:27:22 +0200, all-lists wrote: > Hi, > > I was wondering (and have asked on StackOverflow [1] in a more elaborate > way) whether there is a deeper reason to not allow assignments in lambda > expressions. Currently, the real reason is that lambda expressions are limited to a

Re: Tracebacks for exceptions in interactively entered code.

2018-05-07 Thread Steven D'Aprano
On Mon, 07 May 2018 15:59:10 -0400, Terry Reedy wrote: > I intend to improve the IDLE doc section on IDLE-console differences. > > The following is from standard interactive mode (PSF CPython 3.7.0a4) on > Windows (Win 10, Command Prompt) > > >>> def f(): > ... return 1/0 > ... > >>> f() >

Re: seeking deeper (language theory) reason behind Python design choice

2018-05-07 Thread Stefan Klinger
Chris Angelico (2018-May-08, excerpt): > What exactly would be the scope of the assigned name? Yes, that's more like the kind of answer I was seeking. But I'm not entirely satisfied. > def sort_func(item): > date = parse_date(item.creation_date) > return date.day_of_week, date.year, date

Re: Problem/bug with class definition inside function definition

2018-05-07 Thread Alexey Muranov
To be more exact, i do see a few workarounds, for example: def f4(a): b = a class D: a = b # Works return D But this is not what i was hoping for. Alexey. On Tue, 8 May, 2018 at 12:02 AM, Alexey Muranov wrote: I have discovered the following bug or proble

Problem/bug with class definition inside function definition

2018-05-07 Thread Alexey Muranov
I have discovered the following bug or problem: it looks like i am forced to choose different names for class attributes and function arguments, and i see no workaround. Am i missing some special syntax feature ? Alexey. --- x = 42 class C1: y = x # Works class C2: x = x # Works #

Re: seeking deeper (language theory) reason behind Python design choice

2018-05-07 Thread Chris Angelico
On Tue, May 8, 2018 at 6:27 AM, wrote: > Hi, > > I was wondering (and have asked on StackOverflow [1] in a more > elaborate way) whether there is a deeper reason to not allow > assignments in lambda expressions. > > I'm not criticising, I'm asking in order to know ;-) > > The surface-reason is th

seeking deeper (language theory) reason behind Python design choice

2018-05-07 Thread all-lists
Hi, I was wondering (and have asked on StackOverflow [1] in a more elaborate way) whether there is a deeper reason to not allow assignments in lambda expressions. I'm not criticising, I'm asking in order to know ;-) The surface-reason is the distinction between assignments and statements, but wh

Re: use python to log to a remote supercomputer and transfer files

2018-05-07 Thread Irving Duran
You can also explore this package -> https://github.com/paramiko/paramiko in order to be able to download or upload the files. Thank You, Irving Duran On Mon, May 7, 2018 at 3:34 PM MRAB wrote: > On 2018-05-07 13:29, ruiyan wrote: > > Hello everyone, > > > > > > I need to conduct massive simu

Re: use python to log to a remote supercomputer and transfer files

2018-05-07 Thread MRAB
On 2018-05-07 13:29, ruiyan wrote: Hello everyone, I need to conduct massive simulation computations using a software called 'lammps' on a remote supercomputer whose operating system is Linux every day. It's extremely annoying to log to the remote supercomputer, upload files to and download

Tracebacks for exceptions in interactively entered code.

2018-05-07 Thread Terry Reedy
I intend to improve the IDLE doc section on IDLE-console differences. The following is from standard interactive mode (PSF CPython 3.7.0a4) on Windows (Win 10, Command Prompt) >>> def f(): ... return 1/0 ... >>> f() Traceback (most recent call last): File "", line 1, in File "", line

Re: Tk covering the entire screen

2018-05-07 Thread Skip Montanaro
On Sun, May 6, 2018 at 6:47 PM Skip Montanaro wrote: > > Try to upgrade to 2.7.15. It should be shipped with Tk 8.6. > > Thanks. I'm using an internal (to work) Anaconda distro at work. Hopefully > it will update soon. > ​I got everything up-to-date, but still the cover window only covers two of

Re: www.python.org down

2018-05-07 Thread Chris Angelico
On Sun, May 6, 2018 at 9:22 PM, Gilmeh Serda wrote: > On Mon, 30 Apr 2018 10:38:54 -0700, Jorge Gimeno wrote: > >> Not sure who to report to, but the site comes back with a 503. Anyone >> know where I can direct this to? > > Why would you report it? Give it at least a day before you're going > ber

use python to log to a remote supercomputer and transfer files

2018-05-07 Thread ruiyan
Hello everyone, I need to conduct massive simulation computations using a software called 'lammps' on a remote supercomputer whose operating system is Linux every day. It's extremely annoying to log to the remote supercomputer, upload files to and download files from the supercomputer using

Re: Module, Package

2018-05-07 Thread Chris Angelico
On Tue, May 8, 2018 at 2:53 AM, Sharan Basappa wrote: > I am a bit confused between module and package in Python. > Does a module contain package or vice versa? > When we import something in Python, do we import a module or a package? You import a module. A package is one particular form of modu

Re: Module, Package

2018-05-07 Thread MRAB
On 2018-05-07 17:53, Sharan Basappa wrote: I am a bit confused between module and package in Python. Does a module contain package or vice versa? When we import something in Python, do we import a module or a package? A module is a file. A package is a collection of one or more modules. -- http

Module, Package

2018-05-07 Thread Sharan Basappa
I am a bit confused between module and package in Python. Does a module contain package or vice versa? When we import something in Python, do we import a module or a package? Thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: itemgetter with default arguments

2018-05-07 Thread Peter Otten
Antoon Pardon wrote: > On 05-05-18 09:33, Peter Otten wrote: >> I think you have established that there is no straight-forward way to >> write this as a lambda. But is adding a default to itemgetter the right >> conclusion? >> >> If there were an exception-catching decorator you could write >> >>

Re: Weird side effect of default parameter

2018-05-07 Thread Robert Latest via Python-list
Steven D'Aprano wrote: > Python function default values use *early binding*: the default parameter > is evaluated, ONCE, when the function is defined, and that value is used > each time it is needed. Thanks, "early binding" was the clue I was missing. robert -- https://mail.python.org/mailman/

EuroPython 2018: Call for Proposals (CFP) is open

2018-05-07 Thread M.-A. Lemburg
We’re looking for proposals on every aspect of Python: programming from novice to advanced levels, applications and frameworks, or how you have been involved in introducing Python into your organization. EuroPython is a community conference and we are eager to hear about your experience. *

Re: itemgetter with default arguments

2018-05-07 Thread Antoon Pardon
On 05-05-18 09:33, Peter Otten wrote: > I think you have established that there is no straight-forward way to write > this as a lambda. But is adding a default to itemgetter the right > conclusion? > > If there were an exception-catching decorator you could write > > f = catch(IndexError, "spam")