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: 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: 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, Νίκος Βέργος 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. > > okey altered them back to > >

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: 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: 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: 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" 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/pipermail/python-list/2017-January/719015.html

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

Re: Python, asyncio, and systemd

2017-01-17 Thread Ian Kelly
On Tue, Jan 17, 2017 at 9:57 AM, Chris Angelico wrote: > If I write a web server using asyncio (and the aiohttp package), I can > spin up the server with: > > await loop.create_server(app.make_handler(), "0.0.0.0", 8080) > > This works fine for a high port, but if I want to bind

Re: How can I make a sentinel value NOT be initialized in a class/method - OOP?

2017-01-13 Thread Ian Kelly
On Jan 13, 2017 3:33 PM, wrote: The issue I am having is that when i enter the sentinel value of QUIT, it gets initialized as the name and printed out. How can I get around this? I hope this makes sense. Hard to say for certain without seeing your code, but the most

Re: Byte-run: a Python interpreter written in Python

2017-01-13 Thread Ian Kelly
On Fri, Jan 13, 2017 at 11:07 AM, BartC wrote: > Even when it turns out that the actual code on github is 1000 lines rather > than 500! Maybe it grew a bit since the 500 lines was quoted. I assume they're excluding blank lines, comments and docstrings. And I don't know whether

Re: Byte-run: a Python interpreter written in Python

2017-01-13 Thread Ian Kelly
On Fri, Jan 13, 2017 at 3:46 AM, Steve D'Aprano wrote: > > http://aosabook.org/en/500L/a-python-interpreter-written-in-python.html Neat. But not really surprising IMO that it can fit into 500 lines, since it doesn't handle compiling Python into bytecode (which is the

Re: Is there an peekable similar to peekable but in additional allowing one to put some data to it?

2017-01-11 Thread Ian Kelly
On Wed, Jan 11, 2017 at 10:07 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Wed, Jan 11, 2017 at 8:51 AM, Peng Yu <pengyu...@gmail.com> wrote: >> Hi, peekable from more-itertools only allow peeking an iterator. But >> sometimes, one may want to take a loo

Re: Is there an peekable similar to peekable but in additional allowing one to put some data to it?

2017-01-11 Thread Ian Kelly
On Wed, Jan 11, 2017 at 8:51 AM, Peng Yu wrote: > Hi, peekable from more-itertools only allow peeking an iterator. But > sometimes, one may want to take a look at an element, manipulate it, > then put it back to the iterator. Is there a class in python that can > help do

Re: learning and experimenting python.

2017-01-02 Thread Ian Kelly
On Jan 2, 2017 10:57 AM, "Wildman via Python-list" wrote: On Sun, 01 Jan 2017 23:02:34 -0800, einstein1410 wrote: > I really don't care the person like you. > Leave my posts, if don't like it. > Why wasting your as well as my time. > Just get lost man, or shut up.

Re: learning and experimenting python.

2017-01-01 Thread Ian Kelly
On Mon, Jan 2, 2017 at 12:15 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > Since they're unlikely to do that however, Then again, I see that einstein1410 made a couple of rather aggressive posts 11 hours ago that haven't made it to my email, so maybe he did manage to get himse

Re: learning and experimenting python.

2017-01-01 Thread Ian Kelly
On Sun, Jan 1, 2017 at 11:30 AM, Grant Edwards <grant.b.edwa...@gmail.com> wrote: > On 2016-12-31, Ian Kelly <ian.g.ke...@gmail.com> wrote: >> On Dec 31, 2016 3:12 AM, <einstein1...@gmail.com> wrote: >> >> That's true. >> >> Please include quoted

Re: New re feature in 3.6: local flags and example use

2017-01-01 Thread Ian Kelly
On Sun, Jan 1, 2017 at 8:25 PM, Terry Reedy wrote: \> 3.6 added syntax for 'local flags'. > ''' > (?imsx-imsx:...) > > (Zero or more letters from the set 'i', 'm', 's', 'x', optionally > followed by '-' followed by one or more letters from the same set.) The > letters set or

Re: learning and experimenting python.

2016-12-31 Thread Ian Kelly
On Dec 31, 2016 3:12 AM, wrote: That's true. Please include quoted context in your replies. I have no idea who or what you're responding to. -- https://mail.python.org/mailman/listinfo/python-list

Re: learning and experimenting python.

2016-12-31 Thread Ian Kelly
On Dec 31, 2016 1:48 AM, "mm0fmf" wrote: On 30/12/2016 17:50, einstein1...@gmail.com wrote: > Hello everyone, > I am the new comer and learner of python. > I have a doubt that when I type python and press enter it shows a prompt > like > >> But why it is >>> ? > Is there

Re: Problem with running python 3.6.0 on a 32 bit windows 7 ultimate operating system.

2016-12-30 Thread Ian Kelly
On Fri, Dec 30, 2016 at 10:53 PM, Sagar Utlas wrote: > I am new to python, I've been using C++ as as a student till last 3 years. > To expand my knowledge, I installed Python 3.6.0 and when tried to open it, > a pop up window appeared saying- "The program can't start

Re: learning and experimenting python.

2016-12-30 Thread Ian Kelly
On Fri, Dec 30, 2016 at 6:05 PM, wrote: > But in his website, he recommended that post your questions here, he will > answer it. > But still as you told me I will send him an personal e-mail. This is a good place for asking questions about Python, but you should know

Re: learning and experimenting python.

2016-12-30 Thread Ian Kelly
On Dec 30, 2016 4:42 PM, wrote: Yes, I am not confusing you all, rather I thought that this is the best place to solve any doubts, soy only question for you is Why python uses >>> instead of >, or any other special characters? Do you know about this, if yes then please

Re: learning and experimenting python.

2016-12-30 Thread Ian Kelly
On Fri, Dec 30, 2016 at 11:50 AM, wrote: > Hello everyone, > I am the new comer and learner of python. > I have a doubt that when I type python and press enter it shows a prompt like > But why it is >>> ? > Is there any special reason? > Why it is not setted as @,&

Re: sorting strings numerically while dealing with missing values

2016-12-28 Thread Ian Kelly
On Wed, Dec 28, 2016 at 2:43 PM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Wed, Dec 28, 2016 at 2:14 PM, Larry Martell <larry.mart...@gmail.com> > wrote: >> >> I have a list containing a list of strings that I want to sort >> numerically by one of the f

Re: sorting strings numerically while dealing with missing values

2016-12-28 Thread Ian Kelly
On Wed, Dec 28, 2016 at 2:14 PM, Larry Martell wrote: > > I have a list containing a list of strings that I want to sort > numerically by one of the fields. I am doing this: > > sorted(rows, key=float(itemgetter(sortby))) I'm guessing that you left out a lambda here

Re: Metaclasses - magic functions

2016-12-23 Thread Ian Kelly
On Fri, Dec 23, 2016 at 5:14 AM, Mr. Wrobel wrote: > Hi,thanx for answers, let's imagine that we want to add one class attribute > for newly created classess with using __init__ in metaclass, here's an > example: > > #!/usr/bin/env python > > class MetaClass(type): > #

Re: US/Eastern offset

2016-12-22 Thread Ian Kelly
On Thu, Dec 22, 2016 at 4:19 PM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Thu, Dec 22, 2016 at 2:49 PM, Skip Montanaro > <skip.montan...@gmail.com> wrote: >> In a small application I realized I needed all my timestamps to have >> timezone info. Some timest

Re: US/Eastern offset

2016-12-22 Thread Ian Kelly
On Thu, Dec 22, 2016 at 2:49 PM, Skip Montanaro wrote: > In a small application I realized I needed all my timestamps to have > timezone info. Some timestamp strings come in with no TZ markings, but > I know they are US/Eastern. so, I built one: > import pytz

Re: Metaclasses - magic functions

2016-12-20 Thread Ian Kelly
On Tue, Dec 20, 2016 at 2:04 PM, Mr. Wrobel wrote: > Hi, > > Quick question, can anybody tell me when to use __init__ instead of __new__ > in meta programming? > > I see that __new__ can be used mostly when I want to manipulate with class > variables that are stored into

Re: Python constructors have particular semantics, and ‘Foo.__init__’ doesn't qualify

2016-12-15 Thread Ian Kelly
On Thu, Dec 15, 2016 at 11:05 AM, Terry Reedy wrote: > On 12/14/2016 11:14 PM, Thomas 'PointedEars' Lahn wrote: > >> According to >> , >> “Foo.__init__” is _not_ an instance method. Were it an instance >> method,

Re: Recipe request: asyncio "spin off coroutine"

2016-12-14 Thread Ian Kelly
On Wed, Dec 14, 2016 at 12:53 PM, Chris Angelico wrote: > On Thu, Dec 15, 2016 at 6:27 AM, Marko Rauhamaa wrote: >> Chris Angelico : >> >>> asyncio.spin_off(parallel()) # ??? >>> >>> [...] >>> >>> What code should go on the "???" line to

Re: asyncio question

2016-12-13 Thread Ian Kelly
On Tue, Dec 13, 2016 at 6:15 AM, Frank Millman wrote: > The client uses AJAX to send messages to the server. It sends the message > and continues processing, while a background task waits for the response and > handles it appropriately. As a result, the client can send a

Re: % string formatting - what special method is used for %d?

2016-12-10 Thread Ian Kelly
On Sat, Dec 10, 2016 at 11:40 PM, Veek M wrote: > Well take a look at this: > ### > #!/usr/bin/python > > class Foo(int): > def __init__(self, value): > self.value = value > > def __str__(self): > print '__str__'

Re: When will they fix Python _dbm?

2016-12-06 Thread Ian Kelly
On Dec 6, 2016 4:04 PM, wrote: On Tuesday, December 6, 2016 at 9:35:19 PM UTC, Ian wrote: > On Mon, Dec 5, 2016 at 7:45 AM, clvanwall wrote: > > I have been a Perl programmer for 15+ years and decided to give Python a try. My platform is windows and I installed the latest

Re: When will they fix Python _dbm?

2016-12-06 Thread Ian Kelly
On Mon, Dec 5, 2016 at 7:45 AM, clvanwall wrote: > I have been a Perl programmer for 15+ years and decided to give Python a try. > My platform is windows and I installed the latest 3.5.2. Next I decided to > convert a perl program that uses a ndbm database since according

Re: Asyncio -- delayed calculation

2016-12-01 Thread Ian Kelly
On Thu, Dec 1, 2016 at 12:53 AM, Christian Gollwitzer wrote: > well that works - but I think it it is possible to explain it, without > actually understanding what it does behind the scences: > > x = foo() > # schedule foo for execution, i.e. put it on a TODO list This implies

Re: async enumeration - possible?

2016-11-30 Thread Ian Kelly
On Wed, Nov 30, 2016 at 8:34 PM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > To be pedantic, it should be more like: > > return type(aiter).__dict__['__anext__']() And of course, if you don't find it there then to be proper you also have to walk the MRO and check all of th

Re: async enumeration - possible?

2016-11-30 Thread Ian Kelly
On Wed, Nov 30, 2016 at 5:05 PM, Steve D'Aprano <steve+pyt...@pearwood.info> wrote: > On Wed, 30 Nov 2016 07:51 pm, Ian Kelly wrote: > >> On Wed, Nov 30, 2016 at 1:29 AM, Frank Millman <fr...@chagford.com> wrote: > >>> But I found it easy to write my

Re: Timer runs only once.

2016-11-30 Thread Ian Kelly
On Wed, Nov 30, 2016 at 8:06 AM, siva gnanam wrote: > On Wednesday, November 30, 2016 at 8:11:49 PM UTC+5:30, vnthma...@gmail.com > wrote: >> from threading import Timer >> >> class TestTimer: >> def foo(self): >> print("hello world") >>

Re: async enumeration - possible?

2016-11-30 Thread Ian Kelly
On Wed, Nov 30, 2016 at 2:28 AM, Marko Rauhamaa wrote: > "Frank Millman" : > >> "Marko Rauhamaa" wrote in message news:87d1hd4d5k@elektro.pacujo.net... >>> I don't think bulk iteration in asynchronous programming is ever that >>> great of an idea.

Re: async enumeration - possible?

2016-11-30 Thread Ian Kelly
On Wed, Nov 30, 2016 at 1:29 AM, Frank Millman wrote: > "Marko Rauhamaa" wrote in message news:87d1hd4d5k@elektro.pacujo.net... >> >> >> One of the more useful ones might be: >> >> o = await anext(ait) >> > > Definitely! > > But I found it easy to write my own - > >

Re: async enumeration - possible?

2016-11-30 Thread Ian Kelly
On Wed, Nov 30, 2016 at 1:20 AM, Chris Angelico wrote: > Hmm. The thing is, comprehensions and generators are implemented with > their own nested functions. So I would expect that their use of async > is independent of the function they're in. But maybe we have a bug > here? >

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