Re: Challenge: find the first value where two functions differ

2017-08-04 Thread Ian Kelly
On Fri, Aug 4, 2017 at 11:44 AM, Steve D'Aprano <steve+pyt...@pearwood.info> wrote: > On Sat, 5 Aug 2017 01:47 am, Ian Kelly wrote: > >> Here's a much smaller upper bound: >> >>>>> n = 2 ** 53 >>>>> s = isqrt_newton(n) >>>>> n &

Re: Challenge: find the first value where two functions differ

2017-08-04 Thread Ian Kelly
On Fri, Aug 4, 2017 at 9:47 AM, Chris Angelico wrote: > On Sat, Aug 5, 2017 at 1:44 AM, Chris Angelico wrote: >> That gave me this result almost instantaneously: >> >> 4503599761588224 >> >> which has been rounded up instead of down. I don't know if that

Re: Challenge: find the first value where two functions differ

2017-08-04 Thread Ian Kelly
On Fri, Aug 4, 2017 at 10:00 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Fri, Aug 4, 2017 at 9:47 AM, Chris Angelico <ros...@gmail.com> wrote: >> On Sat, Aug 5, 2017 at 1:44 AM, Chris Angelico <ros...@gmail.com> wrote: >>> That gave m

Re: Challenge: find the first value where two functions differ

2017-08-04 Thread Ian Kelly
On Fri, Aug 4, 2017 at 8:51 AM, Steve D'Aprano wrote: > This is a challenge for which I don't have a complete answer, only a partial > answer. > > Here are two functions for calculating the integer square root of a > non-negative > int argument. The first is known to

Re: @lru_cache on functions with no arguments

2017-08-03 Thread Ian Kelly
On Thu, Aug 3, 2017 at 12:17 PM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Thu, Aug 3, 2017 at 11:18 AM, Serhiy Storchaka <storch...@gmail.com> wrote: >> $ ./python -m timeit -s 'import sys; sys.modules["_functools"] = None; del >> sys.modules["funct

Re: @lru_cache on functions with no arguments

2017-08-03 Thread Ian Kelly
On Thu, Aug 3, 2017 at 11:18 AM, Serhiy Storchaka wrote: > $ ./python -m timeit -s 'import sys; sys.modules["_functools"] = None; del > sys.modules["functools"]; from functools import lru_cache; f = > lru_cache(maxsize=None)(int)' -- 'f()' > 10 loops, best of 5: 3.39 usec

Re: @lru_cache on functions with no arguments

2017-08-03 Thread Ian Kelly
On Thu, Aug 3, 2017 at 10:02 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > Fixed: > > $ python3 -m timeit -s 'from simple_cache import simple_cache; f = > simple_cache(int)' -- 'f()' > 100 loops, best of 3: 0.167 usec per loop > $ python3 -m timeit -s 'import sys;

Re: @lru_cache on functions with no arguments

2017-08-03 Thread Ian Kelly
On Thu, Aug 3, 2017 at 9:55 AM, Serhiy Storchaka <storch...@gmail.com> wrote: > 03.08.17 18:36, Ian Kelly пише: >> >> The single variable is only a dict lookup if it's a global. Locals and >> closures are faster. >> >> def simple_cache(function): >

Re: @lru_cache on functions with no arguments

2017-08-03 Thread Ian Kelly
On Thu, Aug 3, 2017 at 9:44 AM, wrote: > I hope you washed them! Yes, well as noted in my followup I was comparing pure-Python implementations, not the C implementation. -- https://mail.python.org/mailman/listinfo/python-list

Re: @lru_cache on functions with no arguments

2017-08-03 Thread Ian Kelly
On Thu, Aug 3, 2017 at 9:36 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Thu, Aug 3, 2017 at 8:35 AM, Paul Moore <p.f.mo...@gmail.com> wrote: >> On Tuesday, 1 August 2017 15:54:42 UTC+1, t...@tomforb.es wrote: >>> > _sentinel = object() >

Re: @lru_cache on functions with no arguments

2017-08-03 Thread Ian Kelly
On Thu, Aug 3, 2017 at 8:35 AM, Paul Moore wrote: > On Tuesday, 1 August 2017 15:54:42 UTC+1, t...@tomforb.es wrote: >> > _sentinel = object() >> > _val = _sentinel >> > def val(): >> > if _val is _sentinel: >> > # Calculate _val >> > return _val >> > >> >

Subclassing dict to modify values

2017-08-02 Thread Ian Pilcher
m__? (I.e. will any other methods/operators that add values to the dictionary call my __setitem__ method?) -- ======== Ian Pilcher arequip...@gmail.com "I grew up before Mark Zuck

Re: Get list of attributes from list of objects?

2017-08-02 Thread Ian Kelly
On Wed, Aug 2, 2017 at 11:49 AM, Chris Angelico <ros...@gmail.com> wrote: > On Thu, Aug 3, 2017 at 3:21 AM, Ian Pilcher <arequip...@gmail.com> wrote: >> Given a list of objects that all have a particular attribute, is there >> a simple way to get a list of those attri

Re: Get list of attributes from list of objects?

2017-08-02 Thread Ian Pilcher
On 08/02/2017 12:49 PM, Chris Angelico wrote: On Thu, Aug 3, 2017 at 3:21 AM, Ian Pilcher <arequip...@gmail.com> wrote: You can't eliminate the loop, but you can compact it into a single logical operation: namelist = [foo.name for foo in foolist] That's a "list co

Get list of attributes from list of objects?

2017-08-02 Thread Ian Pilcher
in foolist: namelist.append(foo.name) Is there a way to avoid the for loop and create 'namelist' with a single expression? -- Ian Pilcher arequip...@gmail.com "I grew up b

Re: Python 3 removes name binding from outer scope

2017-07-25 Thread Ian Kelly
On Tue, Jul 25, 2017 at 5:38 AM, Thomas Jollans wrote: > On 2017-07-25 09:28, Chris Angelico wrote: >> It actually does the equivalent of: >> >> finally: >> e = None > > I wonder why it would bother to load None... (as someone not very > familiar with Python at the bytecode

[issue10438] list an example for calling static methods from WITHIN classes

2017-07-12 Thread Ian
Ian added the comment: As indicated earlier, I would prefer to see clear instructions on how to call a class's static method from another static method within the same class. Currently, it's only clear how to call from outside the class. If that's not going to happen, then I agree

[issue10438] list an example for calling static methods from WITHIN classes

2017-07-11 Thread Ian
Ian added the comment: I would hope that the docs would cater to people who aren't sure how the language works (and who want to confirm that they are using proper patterns). If people already know how the language works, they won't need the docs. Whether or not you refer to Java and C++, you

Re: Write this accumuator in a functional style

2017-07-11 Thread Ian Kelly
On Tue, Jul 11, 2017 at 12:47 AM, Wolfgang Maier wrote: > On 07/11/2017 08:11 AM, Steven D'Aprano wrote: >> >> I have a colleague who is allergic to mutating data structures. Yeah, I >> know, he needs to just HTFU but I thought I'd humour him. >> >>

[issue10438] list an example for calling static methods from WITHIN classes

2017-07-09 Thread Ian
Ian added the comment: I agree that the use case is probably rare. I agree that to someone intimately familiar with the "self-consistent rules" of Python, the correctness of the C.f() approach is probably obvious. However, your documentation says: Static methods in Python a

Re: Check Python version from inside script? Run Pythons script in v2 compatibility mode?

2017-07-07 Thread Ian Kelly
On Fri, Jul 7, 2017 at 3:49 PM, wrote: > Is there any particular reason the Windows python does it that way? > Certainly it wouldn't be too difficult to include a "python2.exe" and > "python3.exe", even as symbolic links. Windows associates file types with applications

Re: Python3 : import

2017-07-07 Thread Ian Kelly
On Fri, Jul 7, 2017 at 2:00 PM, Andrew Z wrote: > [az@hp tst1]$ python3 ./uno.py > Traceback (most recent call last): > File "./uno.py", line 1, in > from . import db > SystemError: Parent module '' not loaded, cannot perform relative import That error message is a bit

Re: About the implementation of del in Python 3

2017-07-07 Thread Ian Kelly
On Fri, Jul 7, 2017 at 8:41 AM, Nathan Ernst wrote: > Looks like single expression statements are handled a bit differently than > multiple expression statements: > > Python 3.5.2 (default, Nov 17 2016, 17:05:23) > [GCC 5.4.0 20160609] on linux > Type "help", "copyright",

Re: About the implementation of del in Python 3

2017-07-07 Thread Ian Kelly
On Thu, Jul 6, 2017 at 12:56 PM, Nathan Ernst wrote: > In Python, "==" is not a reference equality operator (and I hate Java for > their misuse of the operator), so I absolutely disagree with using the Java > description to describe Python's "==" operator, primarily

Re: About the implementation of del in Python 3

2017-07-06 Thread Ian Kelly
On Thu, Jul 6, 2017 at 9:41 AM, Marko Rauhamaa wrote: > As a good example of the style I'm looking for, take a look at: > >https://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html> Java reference types have basically the same concept of identity as Python objects, so I

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 >

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

2017-06-27 Thread Ian Kelly
On Tuesday, June 27, 2017, Steve D'Aprano wrote: > On Wed, 28 Jun 2017 02:23 am, Sam Chats wrote: > > > > https://medium.com/technology-invention-and-more/how-to- > build-a-simple-neural-network-in-9-lines-of-python-code-cc8f23647ca1 > > > The derivative of the

Re: cdecimal.Decimal v. decimal.Decimal

2017-06-20 Thread Ian Kelly
On Tue, Jun 20, 2017 at 2:49 PM, Skip Montanaro wrote: > I'd not used the Decimal classes before, but some data I was receiving > from a database via pyodbc came that way. In writing some test cases, > I had a hard time making things work out. I eventually figure out

Re: Developers Who Use Spaces Make More Money!

2017-06-15 Thread Ian Kelly
On Thu, Jun 15, 2017 at 8:51 PM, Larry Martell wrote: > On Thu, Jun 15, 2017 at 6:35 PM, Christopher Reimer > wrote: >> One commentator on a tech website admonished programmers for wasting time by >> pressing the space bar four times

Re: Cannot get any Python commands to work

2017-06-12 Thread Ian Kelly
On Mon, Jun 12, 2017 at 8:47 AM, David Marquand wrote: > I am trying to learn Django and cannot get easy_install to work. Python > working on PyDev fine. > > > PS C:\Windows\system32> python > Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit >

Re: Psycopg2 pool clarification

2017-06-08 Thread Ian Kelly
On Thu, Jun 8, 2017 at 10:47 AM, Israel Brewster wrote: >> On Jun 7, 2017, at 10:31 PM, dieter wrote: >> >> israel writes: >>> On 2017-06-06 22:53, dieter wrote: >>> ... >>> As such, using psycopg2's pool is essentially >>>

Re: Generator and return value

2017-06-07 Thread Ian Kelly
On Wed, Jun 7, 2017 at 10:00 AM, Rob Gaddi wrote: > > On 06/06/2017 11:13 PM, Frank Millman wrote: >> >> Hi all >> >> It would be nice to write a generator in such a way that, in addition to 'yielding' each value, it performs some additional work and then

Re: Circular iteration on tuple starting from a specific index

2017-06-01 Thread Ian Kelly
On Thu, Jun 1, 2017 at 4:14 AM, Gregory Ewing wrote: > guillaume.pau...@giome.fr wrote: >> >> def cycle_once(iterable, start): >> return chain(islice(iterable, start, None), islice(iterable, start)) This assumes that iterable is restartable, which is not the case

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Ian Kelly
On Wed, May 31, 2017 at 4:26 AM, Jon Ribbens <jon+use...@unequivocal.eu> wrote: > On 2017-05-31, Ian Kelly <ian.g.ke...@gmail.com> wrote: >> On Tue, May 30, 2017 at 4:57 PM, Jon Ribbens <jon+use...@unequivocal.eu> >> wrote: >>> A DB-API "cursor&qu

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Ian Kelly
It works just fine with every DB-API client I've used, including those which only fetch results as needed. cx_Oracle, for instance. It's not Python's fault if the underlying MySQL client interface is shitty. On Wed, May 31, 2017 at 6:29 AM, Jon Ribbens wrote: > On

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Ian Kelly
On Wed, May 31, 2017 at 8:18 AM, Chris Angelico wrote: > Technically you CAN commit from the cursor: > > cur.connection.commit() Technically cur.connection is an optional extension. ;-) -- https://mail.python.org/mailman/listinfo/python-list

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-30 Thread Ian Kelly
On Tue, May 30, 2017 at 4:57 PM, Jon Ribbens <jon+use...@unequivocal.eu> wrote: > On 2017-05-30, Ian Kelly <ian.g.ke...@gmail.com> wrote: >> On Tue, May 30, 2017 at 1:27 PM, Jon Ribbens <jon+use...@unequivocal.eu> >> wrote: >> A cursor is just a control str

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-30 Thread Ian Kelly
On Tue, May 30, 2017 at 1:27 PM, Jon Ribbens wrote: > Indeed. As I say, I think perhaps the source of the confusion is that > DB-API cursors make no sense at all, rather than the problem being > transactions per se. > > It's almost as if DB-API was written by someone

Re: Circular iteration on tuple starting from a specific index

2017-05-30 Thread Ian Kelly
On Tue, May 30, 2017 at 10:25 AM, Beppe wrote: > hi all > > I've a tuple, something like > > x = ("A","B","C","D","E","F","G","H",) > > I would want to iterate on all tuple's elements > starting from a specific index > > > something like > > Python 2.7.9 (default, Jun

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-30 Thread Ian Kelly
On Tue, May 30, 2017 at 8:19 AM, Joseph L. Casale <jcas...@activenetwerx.com> wrote: > -Original Message- > From: Python-list [mailto:python-list- > bounces+jcasale=activenetwerx@python.org] On Behalf Of Ian Kelly > Sent: Tuesday, May 30, 2017 8:12 AM > To

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-30 Thread Ian Kelly
On Tue, May 30, 2017 at 8:21 AM, Chris Angelico <ros...@gmail.com> wrote: > On Wed, May 31, 2017 at 12:12 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: >> There's no difference I'm aware of in the implementations I've used, >> but having a consistent API d

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-30 Thread Ian Kelly
On Tue, May 30, 2017 at 7:29 AM, Skip Montanaro wrote: > Assuming the underlying database supports transactions, is there any > difference between calling the commit() method on the connection and > calling the execute method on the cursor with the "commit transaction" >

Re: Dictionary order (Is it consistent up to py3.3 unless using -R or PYTHONHASHSEED is set)

2017-05-28 Thread Ian Kelly
On May 28, 2017 8:23 AM, "Jon Ribbens" wrote: > On 2017-05-28, Steve D'Aprano wrote: >> What exactly did you think I got wrong? > > 3.6 does preserve the dict order. It isn't a guarantee so may change > in future versions, but it is what 3.6

Re: Verifiably better, validated Enum for Python

2017-05-24 Thread Ian Kelly
On Wed, May 24, 2017 at 8:49 PM, wrote: > On Tuesday, May 23, 2017 at 11:47:21 PM UTC-4, bream...@gmail.com wrote: >> Well that's what is says here https://github.com/ofek/venum so it must be >> true. Please move over Ethan, your time is up :-) >> >> Kindest regards. >>

Re: Verifiably better, validated Enum for Python

2017-05-24 Thread Ian Kelly
On Wed, May 24, 2017 at 4:11 PM, bartc wrote: > On 24/05/2017 15:31, Steve D'Aprano wrote: >> If you don't want to assign to a name, then >> just don't assign to it. No need to build support for constants into the >> language when you can trust the developer to Don't Do That. > >

Re: Verifiably better, validated Enum for Python

2017-05-24 Thread Ian Kelly
On Wed, May 24, 2017 at 3:10 AM, Steve D'Aprano wrote: > The page says: > > venum provides an Enum that is actually just a namedtuple, No kidding. This is the entirety of the code for it: from collections import namedtuple def Enum(*args, **kwargs):

Re: Hi everyone

2017-05-24 Thread Ian Kelly
On Wed, May 24, 2017 at 11:20 AM, Spaarwiel wrote: > > Hi there, i was always interested in coding but never took the time to learn it. > > So at age 34 i'm going to try and see if i can win this. > > Saw on a website this is good group page to come for help so i will

Re: How to install Python package from source on Windows

2017-05-18 Thread Ian Kelly
On Thu, May 18, 2017 at 1:29 PM, bartc wrote: > > On 18/05/2017 19:50, Chris Angelico wrote: > >> Now this, however, is more serious. Those warnings scare me, too. (I >> just tried it.) Instead of being "gcc is noisy", these are "your code >> is sloppy". These are exactly why I

Re: How to install Python package from source on Windows

2017-05-18 Thread Ian Kelly
On Thu, May 18, 2017 at 8:02 AM, bartc wrote: > > On 18/05/2017 12:37, Rhodri James wrote: >> >> but (a) you have no leg to stand on >> criticising configure scripts with that file, > > You think so? > > After the first 50 lines, there are no #includes, no #defines, no #ifs or

Re: How to install Python package from source on Windows

2017-05-17 Thread Ian Kelly
On Wed, May 17, 2017 at 2:52 PM, bartc wrote: > > On 17/05/2017 21:17, Michael Torrie wrote: >> >> On 05/17/2017 01:32 PM, bartc wrote: >>> >>> Sometimes, if there's a problem. But usually the code is doing something >>> sensible. The stuff in configure is complete gobbledygook

Re: Practice Python

2017-05-10 Thread Ian Kelly
On Mon, May 8, 2017 at 3:50 AM, Lutz Horn wrote: > A strange way to publish code. Not if your goal is to drive traffic toward your YouTube channel. -- https://mail.python.org/mailman/listinfo/python-list

Re: Ten awesome things you are missing out on if you're still using Python 2

2017-05-08 Thread Ian Kelly
Overall a nice preso. I disagree with the slides on a few points. Slide 8: I don't see why I would want to refactor def f(a, b, *args): stuff into def f(*args): a, b, *args = args stuff The first one has a cleaner signature and is also shorter. Slide 55: What makes the "Better"

Re: Why does Python want to read /proc/meminfo

2017-05-06 Thread Ian Pilcher
Delightful. -- ======== Ian Pilcher arequip...@gmail.com "I grew up before Mark Zuckerberg invented friendship" -- https://mail.python.org/mai

Why does Python want to read /proc/meminfo

2017-05-05 Thread Ian Pilcher
nd exit cleanly, so it doesn't seem to strictly require the access. Does anyone know why Python is trying to access this file, or what functionality I might be missing if I don't allow the access? -- ======

Re: Write a function group(L).

2017-04-21 Thread Ian Kelly
On Fri, Apr 21, 2017 at 2:01 PM, Mohammed Ahmed wrote: > Write a function group(L) that takes a list of integers. The function returns > a list of > two lists one containing the even values and another containing the odd > values. > > it is a python question This group

Re: Goto Considered Harmful [was Re: Python and the need for speed]

2017-04-13 Thread Ian Kelly
On Thu, Apr 13, 2017 at 12:51 PM, Nathan Ernst wrote: > Thank you for that Alan Kay quote. Brightened up my day. Since you also > mentioned COBOL, and this is a thread about "goto", reminded me of the > single most abhorrent thing I ever saw in COBOL (I had to convert a

Re: "Goto" statement in Python

2017-04-13 Thread Ian Kelly
On Thu, Apr 13, 2017 at 4:59 PM, bartc <b...@freeuk.com> wrote: > On 13/04/2017 22:58, Ian Kelly wrote: >> >> On Thu, Apr 13, 2017 at 3:27 PM, Dennis Lee Bieber >> <wlfr...@ix.netcom.com> wrote: >>> >>> On Thu, 13 Apr 2017 15:52:24 +0100,

Re: "Goto" statement in Python

2017-04-13 Thread Ian Kelly
On Thu, Apr 13, 2017 at 3:27 PM, Dennis Lee Bieber wrote: > On Thu, 13 Apr 2017 15:52:24 +0100, bartc declaimed the > following: > >>'goto' would be one easy-to-execute byte-code; no variables, objects or >>types to worry about. If implemented properly

Re: "Goto" statement in Python

2017-04-13 Thread Ian Kelly
On Thu, Apr 13, 2017 at 11:39 AM, Rustom Mody wrote: > My broader point (vive la Trump) was that if we learn to actively tolerate > people with views wildly far from ours, the world would be a better place. I fail to see how my comment "Functions and exceptions are

Re: "Goto" statement in Python

2017-04-13 Thread Ian Kelly
On Thu, Apr 13, 2017 at 11:25 AM, Mikhail V <mikhail...@gmail.com> wrote: > On 13 April 2017 at 18:48, Ian Kelly <ian.g.ke...@gmail.com> wrote: >> On Thu, Apr 13, 2017 at 10:23 AM, Mikhail V <mikhail...@gmail.com> wrote: >>> Now I wonder, have we alread

Re: "Goto" statement in Python

2017-04-13 Thread Ian Kelly
On Thu, Apr 13, 2017 at 11:13 AM, Rustom Mody wrote: > What to do?? > Ask Trump? > [I guess we now need a Godwin 2.0 with :s/Hitler/Trump ] Not even close. Whatever one's opinion may be of Trump, he hasn't murdered millions of people. --

Re: "Goto" statement in Python

2017-04-13 Thread Ian Kelly
On Thu, Apr 13, 2017 at 10:23 AM, Mikhail V wrote: > Now I wonder, have we already collected *all* bells and whistles of Python > in these two examples, or is there something else for expressing trivial > thing. Functions and exceptions are considered "bells and whistles"?

Re: "Goto" statement in Python

2017-04-13 Thread Ian Kelly
On Thu, Apr 13, 2017 at 8:52 AM, bartc wrote: > On 13/04/2017 15:35, Chris Angelico wrote: >> Personally, I can't remember the last time I yearned for "goto" in >> Python, and the only times I've ever wished for it or used it in other >> languages have been multi-loop breaks or

Re: Python Command Line Arguments

2017-04-12 Thread ian . stegner
On Thursday, April 13, 2017 at 12:38:48 PM UTC+10, MRAB wrote: > On 2017-04-13 02:59, ian.steg...@gmail.com wrote: > > I have this code which I got from > > https://www.tutorialspoint.com/python/python_command_line_arguments.htm The > > example works fine but when I modify it to what I need, it

Python Command Line Arguments

2017-04-12 Thread ian . stegner
I have this code which I got from https://www.tutorialspoint.com/python/python_command_line_arguments.htm The example works fine but when I modify it to what I need, it only half works. The problem is the try/except. If you don't specify an input/output, they are blank at the end but it

Re: Merging multiple sorted sequences.

2017-04-12 Thread Ian Kelly
On Wed, Apr 12, 2017 at 4:44 PM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Wed, Apr 12, 2017 at 4:15 PM, Erik <pyt...@lucidity.plus.com> wrote: >> while len(items) > 1: >> items.sort(key=lambda item: item[0]) > > This might be okay since Tims

Re: Merging multiple sorted sequences.

2017-04-12 Thread Ian Kelly
On Wed, Apr 12, 2017 at 4:15 PM, Erik wrote: > Hi. > > I need to be able to lazily merge a variable number of already-sorted(*) > variable-length sequences into a single sorted sequence. The merge should > continue until the longest sequence has been exhausted. > > (*)

Re: Python and the need for speed

2017-04-12 Thread Ian Kelly
On Tue, Apr 11, 2017 at 8:08 PM, Steve D'Aprano wrote: > Comprehensions may have been around for a decade or two in Haskell, but most > older languages don't have them. I'm pretty sure Java doesn't. Java does not have comprehensions per se, but the Streams API

Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Ian Kelly
On Sun, Mar 26, 2017 at 8:24 AM, Νίκος Βέργος <me.on@gmail.com> wrote: > Τη Κυριακή, 26 Μαρτίου 2017 - 5:19:27 μ.μ. UTC+3, ο χρήστης Ian έγραψε: > >> You need to change the placeholders back. The poster who told you to >> replace them was misinformed. &g

Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Ian Kelly
On Sun, Mar 26, 2017 at 8:07 AM, Νίκος Βέργος wrote: > Τη Κυριακή, 26 Μαρτίου 2017 - 5:04:27 μ.μ. UTC+3, ο χρήστης INADA Naoki This > error came from MySQL. If there are no logs in error_log, it's >> your configuration issue. >> >> See

Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Ian Kelly
On Sun, Mar 26, 2017 at 7:39 AM, MeV wrote: > On Sunday, March 26, 2017 at 6:34:30 AM UTC-7, Νίκος Βέργος wrote: >> with import cgitb; cgitb.enable() >> >> ProgrammingError(1064, "You have an error in your SQL syntax; check the >> manual that corresponds to your MariaDB

Re: Who are the "spacists"?

2017-03-25 Thread Ian Kelly
On Tue, Mar 21, 2017 at 7:28 PM, Ben Finney wrote: > Grant Edwards writes: > >> Question: is it still successfull trolling if we all knew that was the >> intent and are just playing along for the entertainment value? > > Yes, it creates more

Re: Subprocess .wait() is not waiting

2017-03-24 Thread Ian Kelly
51:02 PM UTC-7, Chris Angelico wrote: >>> > On Sat, Mar 25, 2017 at 6:40 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: >>> > > If that's what's happening it would be a bug. Are you sure that the >>> > > other program isn't simply crashing or otherwise

Re: Surprised by the lack of constant folding

2017-03-24 Thread Ian Kelly
On Fri, Mar 24, 2017 at 1:35 PM, Tim Chase wrote: > Playing around, I came across the following > > $ python3 > Python 3.4.2 (default, Oct 8 2014, 10:45:20) > [GCC 4.9.1] on linux > Type "help", "copyright", "credits" or "license" for more information. from

Re: Subprocess .wait() is not waiting

2017-03-24 Thread Ian Kelly
On Fri, Mar 24, 2017 at 12:42 PM, adam.c.bernier wrote: > Hi, > > I am on Windows 7. Python 2.7 > > I'm trying to have a program run another program using `subprocess.Popen` > > import subprocess as sp > > args = shlex.split(args) > proc =

Re: cryptography default_backend is "hazmat"?

2017-03-20 Thread Ian Pilcher
ne of them? -- ======== Ian Pilcher arequip...@gmail.com "I grew up before Mark Zuckerberg invented friendship" ==

Re: cryptography default_backend is "hazmat"?

2017-03-18 Thread Ian Pilcher
a certificate) without a backend, and all of the backends are "hazmat". So what's the point of marking something as hazmat, if a large portion of the rest of the module can't be used without it? -- ======== I

cryptography default_backend is "hazmat"?

2017-03-18 Thread Ian Pilcher
? -- Ian Pilcher arequip...@gmail.com "I grew up before Mark Zuckerberg invented friendship" -- https://mail.python.org/mailman/listinfo/python-list

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-16 Thread Ian Kelly
On Thu, Mar 16, 2017 at 7:56 PM, Dennis Lee Bieber wrote: > On Fri, 17 Mar 2017 10:03:04 +1300, Gregory Ewing > declaimed the following: > >>Chris Angelico wrote: >>> I just asked my father, and he believes that a satellite DOES fly, on >>> the

Re: Python3.6 a little conundrum

2017-03-14 Thread Ian Kelly
On Tue, Mar 14, 2017 at 2:25 PM, Gilmeh Serda wrote: > Thanks. I guess I could get a new(-er) copy when that day comes and redo > all this. I trust 3.6.0 won't be the last one. :) As it says in the Book of Armaments, Chapter 2, verses 9–21: """ Three shall be

Re: https://pygame.org/

2017-03-10 Thread Ian Kelly
On Fri, Mar 10, 2017 at 4:01 AM, René Dudfield wrote: > https://pygame.org/ Did you have a question, or something that you wish to discuss with regard to pygame? -- https://mail.python.org/mailman/listinfo/python-list

Re: python-daemon and PID files

2017-03-05 Thread Ian Pilcher
grandpappy, and it ought to be good enough you young whippersnappers today. In other words ... facepalm. Thanks! -- Ian Pilcher arequip...@gmail.com "I grew up before Mark Zucke

python-daemon and PID files

2017-03-04 Thread Ian Pilcher
ing my PID file manually in the child process, but systemd complains, because it wants the PID file to exist before the parent exits. -- ======== Ian Pilcher arequip...@gmail.com "I

Re: concurrent futures, async futures and await

2017-02-23 Thread Ian Kelly
On Thu, Feb 23, 2017 at 9:44 AM, Nagy László Zsolt wrote: > >> My guess: because asyncio wouldn't know what to do with a >> concurrent.futures.Future. > I see that as a problem. >> >> The tornado docs say that "You can also use >> tornado.gen.convert_yielded to convert

Re: concurrent futures, async futures and await

2017-02-22 Thread Ian Kelly
On Wed, Feb 22, 2017 at 12:50 PM, Nagy László Zsolt wrote: > > I'm in a situation where I would like to refactor some code to use > native coroutine functions (aync def) instead of "normal" coroutines > that use yield. Most of the code is asnyc, but some of the operations >

Re: python decorator

2017-02-22 Thread Ian Kelly
On Wed, Feb 22, 2017 at 8:16 AM, Pavol Lisy wrote: > Maybe this technique could be reusable (and maybe part of functools?) > > With this decorator: > > def wrap_args(decorator): > def decor_out(*args, **kwargs): > def decor_in(func): >

Re: Noob confused by ConfigParser defaults

2017-02-20 Thread Ian Pilcher
e") Perfect. Thank you! -- ======== Ian Pilcher arequip...@gmail.com "I grew up before Mark Zuckerberg invented friendship" -- https:/

Re: Noob confused by ConfigParser defaults

2017-02-20 Thread Ian Pilcher
nk you! -- ======== Ian Pilcher arequip...@gmail.com "I grew up before Mark Zuckerberg invented friendship" -- https://mail.python.org/mailman/listinfo/python-list

Noob confused by ConfigParser defaults

2017-02-19 Thread Ian Pilcher
How do a set a default for option-1 *only* in section-1? -- Ian Pilcher arequip...@gmail.com "I grew up before Mark Zuckerberg invented frien

Re: Python3 using requests to grab HTTP Auth Data

2017-02-02 Thread Ian Kelly
On Wed, Feb 1, 2017 at 5:22 PM, Νίκος Βέργος wrote: > > # Give user the file requested > > print(''' content="5;url=http://superhost.gr/data/files/%s;>''' % realfile) > > authuser = os.environ.get( 'REMOTE_USER', 'Άγνωστος' ) > print( authuser

Re: Python3 using requests to grab HTTP Auth Data

2017-02-01 Thread Ian Kelly
On Wed, Feb 1, 2017 at 2:51 PM, Νίκος Βέργος wrote: > Τη Τετάρτη, 1 Φεβρουαρίου 2017 - 11:41:28 μ.μ. UTC+2, ο χρήστης Michael > Torrie έγραψε: >> On 02/01/2017 01:51 PM, Νίκος Βέργος wrote: >> > as well as input() for both user & pass combo but iam not getting in >> >

Re: Python doesn't catch exceptions ?

2017-02-01 Thread Ian Kelly
On Wed, Feb 1, 2017 at 8:11 AM, Ivo Bellin Salarin wrote: > This code generates instead the messages: > ``` > ERROR 47.135[bigquery.py.create_table:362] caught exception: HttpError, > defined in server/libs/googleapiclient/errors.pyc. we are in >

Re: What are your opinions on .NET Core vs Python?

2017-01-31 Thread Ian Kelly
On Jan 30, 2017 8:00 PM, "Michael Torrie" wrote: > In any case, partial classes seems like a misfeature of C# to me but > apparently they are used when making Windows Forms GUI-based apps. > Apparently VS autogenerates the class that backs the form, and then the > developer

Re: What are your opinions on .NET Core vs Python?

2017-01-31 Thread Ian Kelly
On Jan 30, 2017 11:32 PM, "Gregory Ewing" wrote: > That's the thing I find most frustrating about both C# and Java, > the lack of anything like Python's "from ... import ...". You get > a choice of either effectively doing "import *" on the contents > of a whole class

Re: Overriding True and False ?

2017-01-30 Thread Ian Kelly
On Jan 30, 2017 6:07 PM, "Steve D'Aprano" <steve+pyt...@pearwood.info> wrote: > Hey Ian, > > Your news reader or mail client has stopped quoting the text you are > quoting, so it appears as if you have written it. > > See: > > https://mail.python.org/piperm

Re: Overriding True and False ?

2017-01-30 Thread Ian Kelly
On Jan 30, 2017 1:32 AM, "Irv Kalb" wrote: I teach intro to programming using Python. In my first assignment, students are asked to assign variables of different types and print out the values. One student (who really did not understand Booleans) turned in the following

Re: Overriding True and False ?

2017-01-30 Thread Ian Kelly
On Jan 30, 2017 2:00 AM, "Chris Angelico" wrote: (Interestingly, Ellipsis is not included in that.) Perhaps because it's rather unusual for a program to depend upon the value of Ellipsis. -- https://mail.python.org/mailman/listinfo/python-list

Re: Need reviews for my book on introductory python

2017-01-27 Thread Ian Kelly
On Jan 27, 2017 2:13 PM, "bob gailer" wrote: On 1/26/2017 8:05 PM, Sandeep Nagar wrote: > Hi > > As I mentioned, a scaled down version is available for free at > bookmuft.Com which can be used to judge in this case. > Maybe I am blind, but I don't see any mention of

Re: With class as contextmanager

2017-01-24 Thread Ian Kelly
On Tue, Jan 24, 2017 at 2:31 PM, This Wiederkehr wrote: > Hellou > > having a class definition: > > class Test(): > > @classmethod > def __enter__(cls): > pass > > @classmethod > def __exit__(cls, exception_type, execption_value, callback): > pass > > now using

[issue9216] FIPS support for hashlib

2017-01-17 Thread Ian Cordasco
Ian Cordasco added the comment: So I see the argument on both sides of this discussion. Having those optional arguments for all the functions seems like an obvious blocker. If a submodule is a blocker, what if we provide a context-manager to signal this? -- nosy: +icordasc

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