Re: "Data blocks" syntax specification draft

2018-05-22 Thread Ian Kelly
On Tue, May 22, 2018 at 9:22 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Tue, May 22, 2018 at 8:25 AM, Chris Angelico <ros...@gmail.com> wrote: >> On Tue, May 22, 2018 at 8:25 PM, bartc <b...@freeuk.com> wrote: >>> Note that Python tup

Re: "Data blocks" syntax specification draft

2018-05-22 Thread Ian Kelly
On Tue, May 22, 2018 at 8:25 AM, Chris Angelico wrote: > On Tue, May 22, 2018 at 8:25 PM, bartc wrote: >> Note that Python tuples don't always need a start symbol: >> >>a = 10,20,30 >> >> assigns a tuple to a. > > The tuple has nothing to do with the

Re: "Data blocks" syntax specification draft

2018-05-20 Thread Ian Kelly
On Sun, May 20, 2018 at 4:28 PM, Mikhail V wrote: > "Markdown" is too vague - there dozens of markdown styles and > also they include subsets of HTML. It is just plain text with tags The whole point of Markdown is that it's readable as plain text precisely because it

Re: what does := means simply?

2018-05-17 Thread Ian Kelly
On Thu, May 17, 2018, 7:50 PM Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > > If you want to *really* see code that is hard to port, you should try > porting an Inform 7 program to another language. Any other language. > How about Z-code? *ducks* > --

Re: Re: why does list's .remove() does not return an object?

2018-05-17 Thread Ian Kelly
On Thu, May 17, 2018 at 3:27 PM, Karsten Hilbert wrote: >> On 5/17/18 11:57 AM, Abdur-Rahmaan Janhangeer wrote: >> > x = [0,1] >> > x.remove(0) >> > new_list = x >> > >> > instead i want in one go >> > >> > x = [0,1] >> > new_list = x.remove(0) # here a way for it to

Re: what does := means simply?

2018-05-17 Thread Ian Kelly
On Thu, May 17, 2018 at 9:06 AM, Chris Angelico wrote: > On Fri, May 18, 2018 at 12:30 AM, bartc wrote: >> Anyway, try this: >> >> def showarg(x): print(x) >> >> def dummy(*args,**kwargs): pass >> >> dummy(a=showarg(1),*[showarg(2),showarg(3)]) >>

Re: syntax oddities

2018-05-16 Thread Ian Kelly
On Tue, May 15, 2018, 6:00 PM Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Tue, 15 May 2018 12:10:07 -0700, Tobiah wrote: > > > Why is it len(object) instead of object.len? > > Because we're not serfs in the Kingdom of Nouns: > >

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

2018-05-16 Thread Ian Kelly
On Wed, May 16, 2018 at 10:06 AM, bartc <b...@freeuk.com> wrote: > On 16/05/2018 16:09, Ian Kelly wrote: >> >> On Tue, May 15, 2018, 6:36 PM bartc <b...@freeuk.com> wrote: >> >>> On 16/05/2018 01:04, Steven D'Aprano wrote: >>> >>>

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

2018-05-16 Thread Ian Kelly
On Tue, May 15, 2018, 6:36 PM bartc wrote: > On 16/05/2018 01:04, Steven D'Aprano wrote: > > > I'm not a C coder, but I think that specific example would be immune to > > the bug we are discussing, since (I think) you can't chain assignments in > > C. Am I right? > > Assignments

Re: syntax oddities

2018-05-15 Thread Ian Kelly
On Tue, May 15, 2018 at 1:10 PM, Tobiah wrote: > Why is it len(object) instead of object.len? > > Why is it getattr(object, item) rather then object.getattr(item)?

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

2018-05-14 Thread Ian Kelly
On Mon, May 14, 2018 at 9:38 AM, Python wrote: > Absolutely correct. If you're not doing THOROUGH code reviews, and > not thoroughly testing your code, your job is only half done. You > should be your own first reviewer, and then have a second someone > competent review

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

2018-05-14 Thread Ian Kelly
On Mon, May 14, 2018 at 9:20 AM, Python wrote: > On Sun, May 13, 2018 at 02:42:48PM +1000, Chris Angelico wrote: >> On Sun, May 13, 2018 at 2:31 PM, Python wrote: >> >> Yes, and I'd go further: I *am* too stupid to get this right. >> > >> > No, you

Re: Suggestion for a "data" object syntax

2018-05-12 Thread Ian Kelly
On Fri, May 11, 2018 at 5:26 PM, Mikhail V <mikhail...@gmail.com> wrote: > On Fri, May 11, 2018 at 9:12 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: >> On Thu, May 10, 2018 at 6:34 PM, Mikhail V <mikhail...@gmail.com> wrote: >>> Do you understand that basi

Re: Leading 0's syntax error in datetime.date module (Python 3.6)

2018-05-11 Thread Ian Kelly
On Fri, May 11, 2018 at 10:35 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Fri, May 11, 2018 at 12:19 AM, Steven D'Aprano > <steve+comp.lang.pyt...@pearwood.info> wrote: >> On Thu, 10 May 2018 23:23:33 -0600, Ian Kelly wrote: >> >>> On Thu, May 10, 2018

Re: Leading 0's syntax error in datetime.date module (Python 3.6)

2018-05-11 Thread Ian Kelly
On Fri, May 11, 2018 at 12:19 AM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > On Thu, 10 May 2018 23:23:33 -0600, Ian Kelly wrote: > >> On Thu, May 10, 2018 at 9:21 PM, Steven D'Aprano >> <steve+comp.lang.pyt...@pearwood.info> wrote: >>>

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

2018-05-11 Thread Ian Kelly
On Fri, May 11, 2018 at 7:40 AM, Chris Angelico wrote: > So, yes, your function's name is outright lying. But there's nothing > about it that is *pretending* to be a normal function. It IS a normal > function. The detail of whether it's a generator function affects the

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

2018-05-11 Thread Ian Kelly
On Fri, May 11, 2018 at 1:01 AM, Chris Angelico <ros...@gmail.com> wrote: > On Fri, May 11, 2018 at 12:38 PM, Ian Kelly <ian.g.ke...@gmail.com> wrote: >> Would you also contend that generator functions are wrong because they >> pretend to be normal functions? >>

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

2018-05-11 Thread Ian Kelly
On Fri, May 11, 2018 at 1:06 AM, Chris Angelico <ros...@gmail.com> wrote: > On Fri, May 11, 2018 at 4:54 PM, Ian Kelly <ian.g.ke...@gmail.com> wrote: >> On Thu, May 10, 2018 at 11:45 PM, Steven D'Aprano >> <steve+comp.lang.pyt...@pearwood.info> wrote: >>>

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

2018-05-11 Thread Ian Kelly
On Fri, May 11, 2018 at 12:03 AM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > On Thu, 10 May 2018 20:38:39 -0600, Ian Kelly wrote: > >> Would you also contend that generator functions are wrong because they >> pretend to be normal functions? > > Y

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

2018-05-11 Thread Ian Kelly
On Thu, May 10, 2018 at 11:45 PM, Steven D'Aprano wrote: > To be honest, I'm having trouble thinking of a good use-case for "while > True", now that we have infinite iterators. Most cases of > > while True: > x = get_item() > if not x:

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

2018-05-11 Thread Ian Kelly
On Thu, May 10, 2018 at 11:17 PM, Steven D'Aprano wrote: > To answer your question from a later post: > > In what way does "while True" in the general case pretend > to be an infinite loop? > > It doesn't *pretend* to be an infinite loop. It *is* an

Re: Suggestion for a "data" object syntax

2018-05-11 Thread Ian Kelly
On Mon, May 7, 2018 at 9:45 PM, Mikhail V wrote: > 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

Re: Suggestion for a "data" object syntax

2018-05-11 Thread Ian Kelly
On Thu, May 10, 2018 at 6:34 PM, Mikhail V wrote: > On Wed, May 9, 2018 at 6:25 AM, Steven D'Aprano > wrote: >> On Tue, 08 May 2018 23:16:23 +0300, Mikhail V wrote: >> > >>> but I propose Tab-separated elements. >> >> We already have

Re: Leading 0's syntax error in datetime.date module (Python 3.6)

2018-05-10 Thread Ian Kelly
On Thu, May 10, 2018 at 9:21 PM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > On Thu, 10 May 2018 11:03:54 -0600, Ian Kelly wrote about proposed > prefixes for octal: > >> Personally I would have preferred the "t". > > "t" for oc

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

2018-05-10 Thread Ian Kelly
On Thu, May 10, 2018 at 7:10 PM, Chris Angelico wrote: > On Fri, May 11, 2018 at 10:29 AM, Marko Rauhamaa wrote: >> Chris Angelico : >> >>> But for the loop itself, you absolutely CAN write this more logically. >>> I'll take your second

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

2018-05-10 Thread Ian Kelly
On Tue, May 8, 2018 at 11:50 PM, Chris Angelico <ros...@gmail.com> wrote: > On Wed, May 9, 2018 at 3:36 PM, Ian Kelly <ian.g.ke...@gmail.com> wrote: >> >> while True: >> if we_are_done(): >> break >> # do some stuff >>

Re: Leading 0's syntax error in datetime.date module (Python 3.6)

2018-05-10 Thread Ian Kelly
On Thu, May 10, 2018 at 10:36 AM, bartc wrote: > What, 0O100 instead of 0100? Yeah that's a big improvement... > > Fortunately octal doesn't get used much. The PEP discusses this: """ Proposed syntaxes included things like arbitrary radix prefixes, such as 16r100 (256 in

Re: Leading 0's syntax error in datetime.date module (Python 3.6)

2018-05-10 Thread Ian Kelly
On Thu, May 10, 2018 at 5:49 AM, D'Arcy Cain wrote: > On 2018-05-10 07:28 AM, Skip Montanaro wrote: >> https://www.python.org/dev/peps/pep-3127/#removal-of-old-octal-syntax > > Funny stuff: > > Python could either: > > 1. silently do the wrong thing... > 2.

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

2018-05-08 Thread Ian Kelly
On Tue, May 8, 2018 at 9:48 PM, Python wrote: > On Tue, May 08, 2018 at 12:45:29AM +, Steven D'Aprano wrote: >> since = in a statement on its own is not dangerous. People *almost never* >> intend to write == for the side-effects only: > > Seriously? I do this--not

Re: itemgetter with default arguments

2018-05-05 Thread Ian Kelly
On Fri, May 4, 2018 at 5:34 PM, Thomas Jollans <t...@tjol.eu> wrote: > On 04/05/18 22:38, Ian Kelly wrote: >> The real thing is written in C. >> > > Is it though? > > https://github.com/python/cpython/blob/a1fc949b5ab8911a803eee691e6eea55cec43eeb/Lib/opera

Re: itemgetter with default arguments

2018-05-04 Thread Ian Kelly
On Fri, May 4, 2018 at 11:04 AM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > On Fri, 04 May 2018 09:17:14 -0600, Ian Kelly wrote: > >> On Fri, May 4, 2018 at 7:01 AM, Steven D'Aprano >> <steve+comp.lang.pyt...@pearwood.info> wrote: >>> Her

Re: itemgetter with default arguments

2018-05-04 Thread Ian Kelly
On Fri, May 4, 2018 at 7:01 AM, Steven D'Aprano wrote: > Here are the specifications: > > * you must use lambda, not def; Why? This seems like an arbitrary constraint. > * the lambda must take a single function, the sequence you want to > extract an item

Re: The basics of the logging module mystify me

2018-04-20 Thread Ian Pilcher
that it exists). As far as I can remember, none of the logging tutorials that I read ever mentioned it. -- Ian Pilcher arequip...@gmail.com "I grew up before Mark Zucke

Re: RE newbie question

2018-04-18 Thread Ian Kelly
On Wed, Apr 18, 2018 at 1:57 PM, Rob Gaddi wrote: > On 04/18/2018 12:37 PM, TUA wrote: >> >> import re >> >> compval = 'A123456_8' >> regex = '[a-zA-Z]\w{0,7}' >> >> if re.match(regex, compval): >> print('Yes') >> else: >> print('No') >> >> >> My

[issue33281] ctypes.util.find_library not working on macOS

2018-04-14 Thread Ian Burgwin
New submission from Ian Burgwin <ihavea...@icloud.com>: On Python 3.7.0a4 and later (including 3.7.0b4), find_library currently always returns None on macOS. It works on 3.7.0a3 and earlier. Tested on macOS 10.11 and 10.13. Expected result: Tested on 3.6.5, 3.7.0a1 and 3.7.0a3: &g

Re: try-except syntax

2018-04-05 Thread Ian Kelly
On Thu, Apr 5, 2018 at 3:04 PM, ElChino wrote: > I'm trying to simplify a try-except construct. E.g. how come > this: > try: > _x, pathname, _y = imp.find_module (mod, mod_path) > return ("%s" % pathname) > except ImportError: > pass > except RuntimeError: >

Re: In asyncio, does the event_loop still running after run_until_complete returned?

2018-04-04 Thread Ian Kelly
On Tue, Apr 3, 2018 at 9:20 PM, wrote: > What's the purpose of resetting self._stopping back to False in finally > clause? Presumably so that the loop won't immediately stop again if you restart it. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python aliases under Windows?

2018-04-03 Thread Ian Kelly
On Tue, Apr 3, 2018 at 9:00 AM, Kirill Balunov wrote: > In fact, I do not really understand why the _py launcher_ way is easier or > better than `python3` or `python3.6` way even on Windows. There are already > `pip.exe`, `pip3.exe`, `pip3.6.exe` which solve the same

Re: Python aliases under Windows?

2018-04-03 Thread Ian Kelly
On Tue, Apr 3, 2018 at 3:24 AM, Kirill Balunov wrote: > Perhaps this is a silly question but still...There is PEP 394 "The "python" > Command on Unix-Like Systems" which I find very reasonable, no matter how > it is respected. Why was not _somewhat_ the same done for

Re: In asyncio, does the event_loop still running after run_until_complete returned?

2018-04-02 Thread Ian Kelly
On Mon, Apr 2, 2018 at 9:01 PM, wrote: > I also do a quick check, with call_later delay keeps at 1.5, to see what the > event loop status is after run_until_complete returns. Strangely, both > is_closed and is_running return a False. > > try: >

Re: In asyncio, does the event_loop still running after run_until_complete returned?

2018-04-02 Thread Ian Kelly
On Mon, Apr 2, 2018 at 5:32 AM, wrote: > I am new to the asyncio subject, just trying to figure out how to use it. > Below is the script I use for testing: > - > # asyncio_cancel_task2.py > > import asyncio > > @asyncio.coroutine > def

Re: Unified async/sync interface

2018-04-02 Thread Ian Kelly
On Sat, Mar 31, 2018 at 7:44 PM, Demian Brecht wrote: > I might be entirely off my face, but figured I'd ask anyways given I > haven't figured out a clean solution to this problem myself yet: > > I'm trying to write a REST API client that supports both async and >

Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-31 Thread Ian Kelly
On Sat, Mar 31, 2018 at 6:29 AM, Rick Johnson wrote: > On Friday, March 30, 2018 at 8:59:16 PM UTC-5, Chris Angelico wrote: >> Wanna provide some competing information showing that other >> languages are more used? > > Chris, here is how debate works: > > PersonA

Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-30 Thread Ian Kelly
On Fri, Mar 30, 2018 at 8:43 PM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > You really think that 90% of the active users are trolls? And yet the > subreddit remains usable despite that allegedly terrible > signal-to-noise ratio. I'm now laughing at the image of a large comm

Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-30 Thread Ian Kelly
On Fri, Mar 30, 2018 at 7:10 PM, Rick Johnson wrote: > On Friday, March 30, 2018 at 7:44:40 PM UTC-5, Steven D'Aprano wrote: > [...] >> Reddit's /ruby subreddit: 40,571 subscribers. >> >> Reddit's /python subreddit: 230,858 subscribers. > > Those numbers mean nothing

Re: ***URGENT CONTRACT OPPORTUNITY***

2018-03-28 Thread Ian Kelly
On Wed, Mar 28, 2018 at 9:02 AM, Tobiah wrote: > > When should I apply? The ad said ASAP, so I guess that now it's already too late. -- https://mail.python.org/mailman/listinfo/python-list

Re: please test the new PyPI (now in beta)

2018-03-27 Thread Ian Kelly
On Mon, Mar 26, 2018 at 4:16 PM, Sumana Harihareswara wrote: > The new Python Package Index at https://pypi.org is now in beta. > > This means the site is robust, but we anticipate needing more user > testing and changes before it is "production-ready" and can fully > replace

Re: To super or not to super (Re: Accessing parent objects)

2018-03-27 Thread Ian Kelly
On Tue, Mar 27, 2018 at 8:47 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Tue, Mar 27, 2018 at 12:21 AM, Gregory Ewing > <greg.ew...@canterbury.ac.nz> wrote: >> The trouble is, those conditions don't always hold. >> Often when overriding a method, you want to do

Re: To super or not to super (Re: Accessing parent objects)

2018-03-27 Thread Ian Kelly
On Tue, Mar 27, 2018 at 12:21 AM, Gregory Ewing wrote: > The idea that super() is *always* the right way to call > inherited methods in a multiple inheritance environment > seems to have been raised by some people to the level > of religous dogma. > > I don't buy it.

Re: A question related to the PYTHONPATH

2018-03-26 Thread Ian Kelly
On Mon, Mar 26, 2018 at 1:24 PM, Dan Stromberg wrote: > On Sun, Mar 25, 2018 at 11:10 PM, dieter wrote: >> adrien oyono writes: >>> I have recently read the documentation about how imports work on python, >>> and I was wondering

Re: Accessing parent objects

2018-03-25 Thread Ian Kelly
On Sun, Mar 25, 2018 at 9:01 AM, Jugurtha Hadjar wrote: > > On 03/25/2018 03:25 PM, Terry Reedy wrote: >> None.foo will raise AttributeError. >> > > Right.. As I said, I tried to assume as little as possible about OP's code > and namespace. Didn't want to include C1 in

Re: Accessing parent objects

2018-03-25 Thread Ian Kelly
On Sun, Mar 25, 2018 at 9:01 AM, Jugurtha Hadjar wrote: > > On 03/25/2018 03:25 PM, Terry Reedy wrote: >> >> On 3/25/2018 7:42 AM, Jugurtha Hadjar wrote: >> >>> class C2(object): >>> def __init__(self, parent=None): >>> self.parent = parent >> >> >> Since

Re: Accessing parent objects

2018-03-25 Thread Ian Kelly
On Sun, Mar 25, 2018 at 5:46 AM, Steven D'Aprano wrote: > On Sun, 25 Mar 2018 06:11:53 -0500, D'Arcy Cain wrote: >> It accesses the parent class. I want to access the parent object. > > Ah. Well, no wonder it doesn't work: you're confusing the OO inheritance

Re: Make synchronous generator from an asynchronous generator

2018-03-16 Thread Ian Kelly
On Thu, Mar 15, 2018 at 1:35 PM, Julien Salort wrote: > Because I wanted to keep the synchronous function for scripts which used it, > without unnecessarily duplicating the code, I built also a synchronous > function from this new asynchronous one, like that: > > def

Re: Spot the invalid syntax

2018-03-08 Thread Ian Pilcher
-headed to use properly, apparently. -- Ian Pilcher arequip...@gmail.com "I grew up before Mark Zuckerberg invented frien

Re: Spot the invalid syntax

2018-03-08 Thread Ian Pilcher
On 03/08/2018 05:26 PM, Chris Angelico wrote: On Fri, Mar 9, 2018 at 10:23 AM, Ian Pilcher <arequip...@gmail.com> wrote: (Because I certainly can't.) ips.update(_san_dnsname_ips(cname, True) return ips I've checked for tabs and mismatched parentheses.

Spot the invalid syntax

2018-03-08 Thread Ian Pilcher
invalid syntax I've checked for tabs and mismatched parentheses. Aargh! -- ==== Ian Pilcher arequip...@gmail.com "I grew up before Mark Zuckerberg invented friendship" -- https://mail.python.org/mailman/listinfo/python-list

Re: cute interview problem

2018-03-03 Thread Ian Kelly
On Sat, Mar 3, 2018 at 3:26 PM, Richard Damon <rich...@damon-family.org> wrote: > On 2/28/18 3:51 PM, Ian Kelly wrote: >> >> On Wed, Feb 28, 2018 at 12:55 PM, <jrlc...@gmail.com> wrote: >>> >>> On Tuesday, 27 February 2018 00:42:02 UTC+1, Paul Rubin

Re: RFC: Proposal: Deterministic Object Destruction (Posting On Python-List Prohibited)

2018-03-03 Thread Ian Kelly
On Sat, Mar 3, 2018 at 9:19 AM, Richard Damon wrote: > One idea does come to mind though, would it be reasonable, and somewhat > Pythonic, for a class to define member functions like __ref__ and __unref__ > (or perhaps some other name) that if defined, would be called

Re: RFC: Proposal: Deterministic Object Destruction (Posting On Python-List Prohibited)

2018-03-03 Thread Ian Kelly
On Fri, Mar 2, 2018 at 9:57 PM, Gregory Ewing wrote: > Paul Rubin wrote: >> >> So you want the programmer to put more head scratching into figuring out >> which reference should be strong and which should be weak? > > > Also, sometimes weak references don't really

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Ian Kelly
On Thu, Mar 1, 2018 at 10:35 PM, Chris Angelico <ros...@gmail.com> wrote: > On Fri, Mar 2, 2018 at 4:16 PM, Ian Kelly <ian.g.ke...@gmail.com> wrote: >> On Wed, Feb 28, 2018 at 8:00 PM, Chris Angelico <ros...@gmail.com> wrote: >>> Not off hand, but I can pro

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Ian Kelly
On Wed, Feb 28, 2018 at 9:00 PM, ROGER GRAYDON CHRISTMAN wrote: > > On Wed, Feb 28, 2018, Rick Johnson wrote: > > On Wednesday, February 28, 2018 at 5:02:17 PM UTC-6, Chris Angelico wrote: >> >>> Here's one example: reference cycles. When do they get detected? >>> Taking a really

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Ian Kelly
On Wed, Feb 28, 2018 at 8:00 PM, Chris Angelico wrote: > On Thu, Mar 1, 2018 at 1:46 PM, Rick Johnson > wrote: >> On Wednesday, February 28, 2018 at 5:02:17 PM UTC-6, Chris Angelico wrote: >> >>> Here's one example: reference cycles. When do they

Re: cute interview problem

2018-02-28 Thread Ian Kelly
On Wed, Feb 28, 2018 at 12:55 PM, wrote: > On Tuesday, 27 February 2018 00:42:02 UTC+1, Paul Rubin wrote: >> Ron Aaron posted the below url on comp.lang.forth. It points to what I >> thought was a cute problem, along with his solution in his Forth dialect >> 8th: >> >>

Re: help me ?

2018-02-27 Thread Ian Kelly
On Tue, Feb 27, 2018 at 2:50 PM, Andre Müller wrote: > Hello, > > it's a duplicate: > https://python-forum.io/Thread-Working-with-lists-homework-2 > > I have seen this more than one time. We don't like it. You keep people busy > with one question at different places. You

Re: help me ?

2018-02-27 Thread Ian Kelly
On Tue, Feb 27, 2018 at 10:16 AM, Igor Korot wrote: > Congratulations! > You have an "A" for solving the problem and "F" for helping the guy cheat. > You should be expelled from the course. In my experience, this is what happens pretty much every time. Somebody posts a

Re: matrix multiplication

2018-02-27 Thread Ian Kelly
On Tue, Feb 27, 2018 at 9:02 AM, Seb wrote: > That's right. I just tried this manipulation by replacing the last > block of code in my example, from the line above `for` loop with: > > ------ > # Alternative

Re: matrix multiplication

2018-02-27 Thread Ian Kelly
On Tue, Feb 27, 2018 at 4:08 AM, Peter Otten <__pete...@web.de> wrote: > Seb wrote: > >> On Tue, 27 Feb 2018 12:25:30 +1300, >> Gregory Ewing wrote: >> >>> Seb wrote: I was wondering is whether there's a faster way of multiplying each row (1x3) of a matrix

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-26 Thread Ian Kelly
On Mon, Feb 26, 2018 at 8:55 PM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Mon, Feb 26, 2018 at 8:09 PM, Steven D'Aprano > <steve+comp.lang.pyt...@pearwood.info> wrote: >> Yes you did: "the last second of every year" is always 23:59:59 of 31st >>

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-26 Thread Ian Kelly
On Mon, Feb 26, 2018 at 8:09 PM, Steven D'Aprano wrote: > Yes you did: "the last second of every year" is always 23:59:59 of 31st > December, and it is always the same time and date "every year". Except when it's 23:59:60 or 23:59:61 (which hasn't yet

Re: matrix multiplication

2018-02-26 Thread Ian Kelly
On Mon, Feb 26, 2018 at 3:12 PM, Dan Stromberg <drsali...@gmail.com> wrote: > On Mon, Feb 26, 2018 at 2:07 PM, Ian Kelly <ian.g.ke...@gmail.com> wrote: >> Taking LMGTFY to a whole new level of rudeness by obviously not even >> bothering to read the entire paragraph befor

Re: matrix multiplication

2018-02-26 Thread Ian Kelly
On Mon, Feb 26, 2018 at 2:40 PM, Dan Stromberg wrote: > On Mon, Feb 26, 2018 at 8:53 AM, Seb wrote: >> On Sun, 25 Feb 2018 18:52:14 -0500, >> Terry Reedy wrote: >> >> [...] >> >>> numpy has a matrix multiply function and now the '@'

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Ian Kelly
On Mon, Feb 26, 2018 at 2:37 PM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Mon, Feb 26, 2018 at 1:09 PM, <marco.naw...@colosso.nl> wrote: >> def foo(self, *args, **kwargs): >> assert len(args) == 0 > > Better: > > def foo(self, **kwargs): &g

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Ian Kelly
On Mon, Feb 26, 2018 at 1:09 PM, wrote: > def foo(self, *args, **kwargs): > assert len(args) == 0 Better: def foo(self, **kwargs): > So, use the inspect module to detect the valid arguments > from the class initializer. Then use **kwargs in every > class

Re: Is there are good DRY fix for this painful design pattern?

2018-02-26 Thread Ian Kelly
On Mon, Feb 26, 2018 at 8:06 AM, Chris Angelico wrote: > On Tue, Feb 27, 2018 at 1:41 AM, Steven D'Aprano > wrote: >> I have a class with a large number of parameters (about ten) assigned in >> `__init__`. The class then has a number of

Re: matrix multiplication

2018-02-26 Thread Ian Kelly
On Mon, Feb 26, 2018 at 9:53 AM, Seb wrote: > On Sun, 25 Feb 2018 18:52:14 -0500, > Terry Reedy wrote: > > [...] > >> numpy has a matrix multiply function and now the '@' matrix multiply >> operator. > > Yes, but what I was wondering is whether there's a

Re: For Loop Dilema [python-list]

2018-02-26 Thread Ian Kelly
On Sun, Feb 25, 2018 at 8:05 PM, INADA Naoki wrote: > https://docs.python.org/3.6/library/itertools.html#itertools.product I don't see how you would use itertools.product to do what the OP asked for. You could use itertools.chain.from_iterable, though: py> names =

Re: For Loop Dilema [python-list]

2018-02-25 Thread Ian Kelly
On Sun, Feb 25, 2018 at 11:19 AM, wrote: > Why we don’t use: > > for _ in _ in _ > > Instead of > > for _ in _: > for _ in _: > > Ex: > > Names = ["Arya","Pupun"] > > for name in Names: >for c in name: >print(c) > > instead use: > > for c in name in

Re: How to make Python run as fast (or faster) than Julia

2018-02-22 Thread Ian Kelly
On Thu, Feb 22, 2018 at 12:55 PM, Jack Fearnley wrote: > I realize that this thread is about benchmarking and not really about > generating fibonacci numbers, but I hope nobody is using this code to > generate them on a 'production' basis, > > Fibonacci numbers, any

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-21 Thread Ian Kelly
On Tue, Feb 20, 2018 at 10:09 PM, Chris Angelico wrote: > On Wed, Feb 21, 2018 at 6:39 AM, Geldenhuys, J, Prof > wrote: >> I think your case illustrates the Python/Mathematica issue well: you found >> a job for which Mathematica was not the

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Ian Kelly
On Tue, Feb 20, 2018 at 8:38 AM, Steven D'Aprano wrote: > On Tue, 20 Feb 2018 15:23:44 +0100, Antoon Pardon wrote: > >>> Okay. Now create a constraint on a name in C++ such that it can only >>> accept integers representing A.D. years which, on the Gregorian

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-17 Thread Ian Kelly
On Fri, Feb 16, 2018 at 9:32 PM, Chris Angelico wrote: > You'd be surprised how rarely that kind of performance even matters. > The author of that article cites C# as a superior language, but in the > rewrite from C# to Python (the same one I mentioned in the other > post), I

Re: How to run script from interpreter?

2018-02-16 Thread Ian Kelly
On Fri, Feb 16, 2018 at 3:18 PM, windhorn wrote: > Yes, it's been covered, but not quite to my satisfaction. > > Here's an example simple script: > > # Very simple script > bar = 123 > > I save this as "foo.py" somewhere Python can find it > import foo bar >

Re: What F strings should have been

2018-02-15 Thread Ian Kelly
On Wed, Feb 14, 2018 at 2:24 PM, D'Arcy Cain wrote: > A recent post by Terry Jan Reedy got me thinking about formatting. I > like the new(ish) format method for strings and I see some value in F > strings but it only works well with locals. Anything more starts > getting

Re: Does anyone know ni?

2018-02-06 Thread Ian Kelly
It was used for package support and is no longer needed from Python 1.5. http://legacy.python.org/doc/essays/packages.html On Tue, Feb 6, 2018 at 1:27 PM, Roel Schroeven wrote: > I'm having a look at py-iso8211 from > https://sourceforge.net/projects/py-iso8211/ to see if

Re: Python "Bad syntax"

2018-02-05 Thread Ian Kelly
On Mon, Feb 5, 2018 at 10:13 AM, wrote: > > Hi, I have a problem in continuing the function. > > I'm a beginner, I'm learning from a textbook. I'm going to put the following > examples from a textbook that displays "wrong syntax" It would be very helpful if you

Re: Why no '|' operator for dict?

2018-02-05 Thread Ian Kelly
On Mon, Feb 5, 2018 at 12:35 AM, Frank Millman wrote: > So I have 2 questions - > > 1. Is there any particular reason why '|' is not supported? '|' is the set union operation, roughly equivalent to the set.union method. Dicts don't have a union operation. If they did, and the

Re: Problem with coroutines old-style / new-style usage and features

2018-02-01 Thread Ian Kelly
On Thu, Feb 1, 2018 at 5:38 AM, Yahya Abou 'Imran via Python-list wrote: > Hi guys. > > I am discovering coroutines and asynchronous programming, and I have a little > problem with a little example I'm coding myself as an excercice. > > Let say you take two guys in the

Re: Create an alias to an attribute on superclass

2018-02-01 Thread Ian Kelly
On Thu, Feb 1, 2018 at 11:44 AM, Sean DiZazzo wrote: > On Thursday, February 1, 2018 at 10:37:32 AM UTC-8, Chris Angelico wrote: >> On Fri, Feb 2, 2018 at 5:22 AM, Sean DiZazzo wrote: >> > Hi! >> > >> > I basically just want to create an alias to

Re: [OT] Dutch Reach [was Re: Where has the practice of sending screen shots as source code come from?]

2018-01-30 Thread Ian Kelly
On Tue, Jan 30, 2018 at 9:24 AM, Grant Edwards wrote: > On 2018-01-30, Steven D'Aprano wrote: >> On Tue, 30 Jan 2018 15:48:29 +, Matt Wheeler wrote: >> >>> Checking the side mirrors isn't particularly helpful advice if you're

[issue32541] cgi.FieldStorage constructor assumes all lines terminate with \n

2018-01-12 Thread Ian Craggs
New submission from Ian Craggs <icra...@gmail.com>: Using cgi.FieldStorage in an HTTP server in a subclass of BaseHTTPRequestHandler, parsing the request with: form = cgi.FieldStorage(fp=self.rfile, headers=self.headers, environ={"REQ

Re: Spectre/Meltdown bug affecting Python ?

2018-01-06 Thread Ian Kelly
On Sat, Jan 6, 2018, 4:45 PM Grant Edwards wrote: > On 2018-01-06, Etienne Robillard wrote: > > > > > > Le 2018-01-06 à 15:49, J.O. Aho a écrit : > >> On 01/06/18 13:43, Etienne Robillard wrote: > >>> My understanding of this vulnerability is that

Re: is comp.lang.python still the pinnacle of the py community ?

2018-01-05 Thread Ian Kelly
On Fri, Jan 5, 2018 at 2:06 PM, Kim of K. wrote: > > post frequency is down to a precarious level It's true that compared to ten years ago, the quantity of posts here has diminished by a significant fraction, maybe even by an order of magnitude. This is still a great place for

Re: has sourceforge exposed the dirty little secret ?

2018-01-05 Thread Ian Kelly
On Fri, Jan 5, 2018 at 9:27 AM, Kim of K. wrote: > > "Background > > We feel that the world still produces way too much software that is > frankly substandard. The reasons for this are pretty simple: software > producers do not pay enough attention [...]" > > > quote from

Re: Anaconda Navigator : Add App

2018-01-01 Thread Ian
Anaconda is v3.6 very 2017'ish by now... ;-) -- https://mail.python.org/mailman/listinfo/python-list

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread Ian Kelly
On Sat, Dec 30, 2017 at 8:41 AM, bartc wrote: > (I had introduced a special language feature just for this kind of thing, > but it was unsatisfactory. Goto was simpler and understood by everyone. And > portable to any other language - that hasn't done away with goto. But it >

Re: What is the meaning of @@?

2017-12-24 Thread Ian Kelly
On Sun, Dec 24, 2017 at 7:33 PM, Peng Yu wrote: > See for example this file. > > https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/ops/rnn_cell.py > > On Sat, Dec 23, 2017 at 12:03 AM, Steve D'Aprano > wrote: >> On Sat, 23 Dec

Re: What is the meaning of @@?

2017-12-22 Thread Ian Kelly
@@ is a syntax error. Where did you encounter this? On Fri, Dec 22, 2017 at 10:38 PM, Peng Yu wrote: > Hi, I only can find the doc for @. What does @@ mean in python? > > -- > Regards, > Peng > -- > https://mail.python.org/mailman/listinfo/python-list --

Re: property decorator?

2017-12-20 Thread Ian Kelly
On Wed, Dec 20, 2017 at 5:56 PM, Irv Kalb wrote: > My questions about this are really historical. From my reading, it looks > like using an @property decorator is a reference to an older approach using a > built in "property" function. But here goes: > > 1) Why were these

Re: asyncio awaitable object

2017-12-08 Thread Ian Kelly
On Fri, Dec 8, 2017 at 2:08 AM, ast wrote: > Hello, > > According to: https://www.python.org/dev/peps/pep-0492/#await-expression > an awaitable object is: > > - A native coroutine object returned from a native coroutine function > - A generator-based coroutine object returned

<    1   2   3   4   5   6   7   8   9   10   >