Re: Set type for datetime intervals

2016-04-01 Thread Michael Selik
On Fri, Apr 1, 2016 at 1:32 AM Nagy László Zsolt wrote: > Does anyone know a library that already implements these functions? > What do you not like about the ones on PyPI? https://pypi.python.org/pypi?%3Aaction=search&term=interval&submit=search Depending on the resolution you want, you might

Re: Set type for datetime intervals

2016-04-01 Thread Michael Selik
Whoops, I mixed up tasks. Here's what I meant: def interval(start, stop, precision=60): a, b = start.timestamp(), stop.timestamp() return set(range(a, b, precision)) On Fri, Apr 1, 2016 at 4:31 PM Michael Selik wrote: > On Fri, Apr 1, 2016 at 1:32 AM Nagy Lász

Re: Drowning in a teacup?

2016-04-01 Thread Michael Selik
Give this a shot def snap(keyword, words): matches = [i for i, s in enumerate(words) if s.startswith(keyword)] for i in matches: lst.insert(0, lst.pop(i)) Your current implementation is reassigning the local variable ``mylist`` to a new list inside the function. O

[beginner] What's wrong?

2016-04-01 Thread Michael Okuntsov
Hello, I have a Pascal code for some hash function. I've tried to rewrite it on Python but it doesn't give the right value (which is 32202). Please tell me where is the error. Thanks. ** Pascal program ** Program K_S; Var ST: String;

Re: [beginner] What's wrong?

2016-04-01 Thread Michael Okuntsov
Nevermind. for j in range(1,8) should be for j in range(8). -- https://mail.python.org/mailman/listinfo/python-list

Re: [beginner] What's wrong?

2016-04-01 Thread Michael Selik
-list < python-list@python.org> wrote: > On 01/04/2016 23:44, sohcahto...@gmail.com wrote: > > On Friday, April 1, 2016 at 3:10:51 PM UTC-7, Michael Okuntsov wrote: > >> Nevermind. for j in range(1,8) should be for j in range(8). > > > > I can't tell you how m

Re: [beginner] What's wrong?

2016-04-01 Thread Michael Selik
On Sat, Apr 2, 2016, 12:28 AM Random832 wrote: > On Fri, Apr 1, 2016, at 19:29, Michael Selik wrote: > > Humans have always had trouble with this, in many contexts. I remember > > being annoyed at folks saying the year 2000 was the first year of the new > > millennium, rat

Re: Drowning in a teacup?

2016-04-01 Thread Michael Selik
On Sat, Apr 2, 2016, 1:46 AM Vito De Tullio wrote: > Fillmore wrote: > > > I need to scan a list of strings. If one of the elements matches the > > beginning of a search keyword, that element needs to snap to the front > > of the list. > > I know this post regards the function passing, but, on yo

Re: Drowning in a teacup?

2016-04-02 Thread Michael Selik
On Sat, Apr 2, 2016 at 6:32 AM Peter Otten <__pete...@web.de> wrote: > Vito De Tullio wrote: > > > Michael Selik wrote: > > > >>> > I need to scan a list of strings. If one of the elements matches the > >>> > beginning of a search keyword, th

Re: [beginner] What's wrong?

2016-04-02 Thread Michael Selik
On Sat, Apr 2, 2016 at 4:16 AM Chris Angelico wrote: > On Sat, Apr 2, 2016 at 3:27 PM, Random832 wrote: > > On Fri, Apr 1, 2016, at 19:29, Michael Selik wrote: > >> Humans have always had trouble with this, in many contexts. I remember > >> being annoyed at folks s

Re: [beginner] What's wrong?

2016-04-02 Thread Michael Selik
On Sat, Apr 2, 2016, 3:40 PM Marko Rauhamaa wrote: > Terry Reedy : > > > On 4/2/2016 12:44 PM, Marko Rauhamaa wrote: > > > >> Nowadays software companies and communities are international. > > > > Grade school classrooms, especially pre-high school, are not. > > Parenthetically, English teachers

Re: [Beginner] - Hanging in the code, can't figure out what's wrong

2016-04-02 Thread Michael Selik
I might be overlooking something, but raw_input (Python 2) and input (Python 3) won't return the input from sys.stdin until you type ENTER. Or did I misunderstand the question? On Sat, Apr 2, 2016 at 6:30 PM BartC wrote: > On 02/04/2016 23:16, Ned Batchelder wrote: > > On Saturday, April 2, 2016

Re: [beginner] What's wrong?

2016-04-02 Thread Michael Torrie
Mark, your messages are showing up to the list as being from "python," at least on my email. Any reason for this? -- https://mail.python.org/mailman/listinfo/python-list

Re: [beginner] What's wrong?

2016-04-03 Thread Michael Okuntsov
03.04.2016 20:52, Rustom Mody пишет: To really localize python one would have to 1. Localize the keywords 2. Localize all module names 3. Localize all the help strings 4. Localize the entire stuff up at https://docs.python.org/3/ 5. ... That is probably one or two orders of magnitude more work

Re: PyQt4

2016-04-03 Thread Michael Torrie
On 04/03/2016 12:57 PM, Muhammad Ali wrote: > > Hi, > > How can we confirm that either PyQt4 is already installed on LInux machine > or not? > > Please suggest commands to confirm the already existence of PyQt4 in the > machine. Ideally you make a distribution-specific package of the binary

Re: [Beginner] - Hanging in the code, can't figure out what's wrong

2016-04-03 Thread Michael Selik
How do you know when you're done typing the name of the file? It's hard to get tone right on the internet, so I'll clarify: this is not a rhetorical question and I mean you, LoopIO, not a generic person. On Sun, Apr 3, 2016, 8:40 PM Loop.IO wrote: > On Sunday, April 3, 2016 at 8:32:06 PM UTC+1,

Re: Plot/Graph

2016-04-03 Thread Michael Selik
Indeed there is. Every example in the gallery shows the code to produce it. http://matplotlib.org/gallery.html On Sun, Apr 3, 2016, 8:05 PM Muhammad Ali wrote: > > Hi, > > Could anybody tell me that how can I plot graphs by matplotlib and get > expertise in a short time? I have to plot 2D plots

Re: Best Practices for Internal Package Structure

2016-04-04 Thread Michael Selik
On Mon, Apr 4, 2016 at 6:04 PM Sven R. Kunze wrote: > Hi Josh, > > good question. > > On 04.04.2016 18:47, Josh B. wrote: > > My package, available at https://github.com/jab/bidict, is currently > laid out like this: > > > > bidict/ > > ├── __init__.py > > ├── _bidict.py > > ├── _common.py > > ├─

From email addresses sometimes strange on this list - was Re: [beginner] What's wrong?

2016-04-04 Thread Michael Torrie
On 04/04/2016 08:04 AM, Mark Lawrence via Python-list wrote: > On 02/04/2016 23:49, Michael Torrie wrote: >> Mark, your messages are showing up to the list as being from "python," >> at least on my email. Any reason for this? >> > > Assuming that you're

Re: From email addresses sometimes strange on this list - was Re: [beginner] What's wrong?

2016-04-04 Thread Michael Torrie
On 04/04/2016 04:58 PM, Chris Angelico wrote: > O That probably explains it. It's because of Yahoo and mailing > lists. Yahoo did stuff that breaks stuff, so Mailman breaks stuff > differently to make sure that only Yahoo people get messed up a bit. > It means their names and addresses get

Re: Best Practices for Internal Package Structure

2016-04-05 Thread Michael Selik
> On Apr 5, 2016, at 7:49 PM, Sven R. Kunze wrote: > >> On 05.04.2016 19:59, Chris Angelico wrote: >> On Wed, Apr 6, 2016 at 3:38 AM, Sven R. Kunze wrote: Your package is currently under 500 lines. As it stands now, you could easily flatten it to a single module: bidict.py

Re: ANN: intervalset Was: Set type for datetime intervals

2016-04-05 Thread Michael Selik
It seems coding a generic interval and intervalset will bring a variety of difficult design choices. If I were you, I'd forget making it generic and build one specifically for the application you have in mind. That way you can ignore most of these feature discussions. > On Apr 5, 2016, at 2:59

Re: Import graphics error

2016-04-05 Thread Michael Selik
> On Apr 5, 2016, at 5:17 PM, Nicolae Morkov wrote: > > I copied the code from Python from everyone page 67. > Following the instructions The graphic modules by John Zelle I copied into > the python lacation ,to be easier to find the path . Please be more specific. What is the python

Re: python script for .dat file

2016-04-05 Thread Michael Selik
What code have you written so far? > On Apr 5, 2016, at 5:27 PM, Muhammad Ali wrote: > >> On Tuesday, April 5, 2016 at 9:07:54 AM UTC-7, Oscar Benjamin wrote: >>> On 5 April 2016 at 16:44, Muhammad Ali wrote: On Tuesday, April 5, 2016 at 8:30:27 AM UTC-7, Joel Goldstick wrote: On Tue,

Re: Best Practices for Internal Package Structure

2016-04-06 Thread Michael Selik
On Wed, Apr 6, 2016, 2:51 AM Steven D'Aprano wrote: > On Wed, 6 Apr 2016 05:56 am, Michael Selik wrote: > > [Sven R. Kunze] > >> If you work like in the 80's, maybe. Instead of scrolling, (un)setting > >> jumppoints, or use splitview of the same file, i

Re: ANN: intervalset Was: Set type for datetime intervals

2016-04-06 Thread Michael Selik
uestion of "putting or not putting them in". > Are zero sized intervals valid or not? In my particular application, > they are not. I think Michael was right: this cannot be generalized. It > is application dependent. > To emphasize that in your project, I'd keep the in

Re: Promoting Python

2016-04-06 Thread Michael Selik
On Wed, Apr 6, 2016, 12:51 PM Marko Rauhamaa wrote: > BartC : > Really, there's only one high-level construct you can't live without: > the "while" statement. Virtually every Python program has at least one > "while" statement, and in general, it is unavoidable. > > Basic programs, on the other h

Re: Checking function's parameters (type, value) or not ?

2016-04-06 Thread Michael Selik
> On Apr 6, 2016, at 2:07 PM, ast wrote: > > I would like to know if it is advised or not to test > a function's parameters before running it, e.g > for functions stored on a public library ? > > def to_base(nber, base=16, use_af=True, sep=''): > assert isinstance(nber, int) and nber >= 0 >

Re: functools puzzle

2016-04-06 Thread Michael Selik
> On Apr 6, 2016, at 6:57 PM, George Trojan - NOAA Federal > wrote: > > The module functools has partial() defined as above, then overrides the > definition by importing partial from _functools. That would explain the > above behaviour. My question is why? A couple speculations why an author m

Re: functools puzzle

2016-04-06 Thread Michael Selik
On Wed, Apr 6, 2016 at 8:16 PM George Trojan - NOAA Federal < george.tro...@noaa.gov> wrote: > My basic question is how to document functions created by > functools.partial, such that the documentation can be viewed not only by > reading the code. Of course, as the last resort, I could create my o

Re: recursive methods require implementing a stack?

2016-04-07 Thread Michael Selik
On Thu, Apr 7, 2016, 7:51 AM Charles T. Smith wrote: > On Wed, 06 Apr 2016 20:28:47 +, Rob Gaddi wrote: > > > Charles T. Smith wrote: > > > >> I just tried to write a recursive method in python - am I right that > local > >> variables are only lexically local scoped, so sub-instances have the

Re: Enum questions.

2016-04-13 Thread Michael Selik
On Wed, Apr 13, 2016, 12:14 PM Antoon Pardon wrote: > I have been looking at the enum documentation and it > seems enums are missing two features I rather find > important. > > 1) Given an Enum value, someway to get the next/previous >one > > 2) Given two Enum values, iterate over the values

Re: Looking for feedback on weighted voting algorithm

2016-04-14 Thread Michael Selik
On Thu, Apr 14, 2016, 7:37 PM justin walters wrote: > On Apr 14, 2016 9:41 AM, "Martin A. Brown" wrote: > > > > > > Greetings Justin, > > > > >score = sum_of_votes/num_of_votes > > > > >votes = [(72, 4), (96, 3), (48, 2), (53, 1), (26, 4), (31, 3), (68, 2), > (91, 1)] > > > > >Specifically,

Re: How to parameterize unittests

2016-04-15 Thread Michael Selik
On Fri, Apr 15, 2016, 11:16 AM Steven D'Aprano wrote: > On Fri, 15 Apr 2016 06:20 pm, Antoon Pardon wrote: > > >>> I see, that's going to be a lot of cut & pastes. > > (3) In your editor, run a global Find and Replace "avltree -> self.tree". > You will need to inspect each one rather than do it a

Re: Python garbage collection: not releasing memory to OS!

2016-04-15 Thread Michael Torrie
On 04/15/2016 04:25 AM, cshin...@gmail.com wrote: > The input was a 4MB file. Even after returning from the 'fileopen' > function the 4MB memory was not released. I checked htop output while > the loop was running, the resident memory stays at 14MB. So unless > the process is stopped the memory sta

Re: Looking for feedback on weighted voting algorithm

2016-04-15 Thread Michael Selik
On Fri, Apr 15, 2016, 7:56 PM wrote: > On Thursday, April 14, 2016 at 1:48:40 PM UTC-7, Michael Selik wrote: > > I suggest not worrying about sanitizing inputs. If someone provides bad > > data, Python will do the right thing: stop the program and print an > > explanati

Re: Dynamic inputs

2016-04-16 Thread Michael Selik
On Sat, Apr 16, 2016, 9:41 AM durgadevi1 < srirajarajeswaridevikr...@gmail.com> wrote: > what does dynamic inputs mean and how is it implemented in python > programming? > In what context did you hear or read the phrase "dynamic inputs"? > -- https://mail.python.org/mailman/listinfo/python-list

Re: Guido sees the light: PEP 8 updated

2016-04-16 Thread Michael Selik
On Sat, Apr 16, 2016, 10:56 AM Marko Rauhamaa wrote: > Chris Angelico : > > > On Sat, Apr 16, 2016 at 6:06 PM, Marko Rauhamaa > wrote: > >> It doesn't really matter one way or another. The true WTF is that it's > >> been changed. > > > > Why? Was PEP 8 inscribed on stone tablets carried down fro

Re: Fraud

2016-04-16 Thread Michael Torrie
On 04/16/2016 04:21 PM, Erik wrote: > On 16/04/16 23:02, Joel Goldstick wrote: >>> On Sun, Apr 17, 2016 at 3:12 AM, Mel Drosis via Python-list >>> wrote: My phone my accounts my home network have all been affected because of someone using coding from Python and Linux and GitHub and

Re: Guido sees the light: PEP 8 updated

2016-04-17 Thread Michael Torrie
On 04/17/2016 10:13 AM, Dennis Lee Bieber wrote: > On Sat, 16 Apr 2016 21:59:01 -0400, Random832 > declaimed the following: > >> >> I heard Windows 10 is going to finally fix this, anyway. > > Probably by removing the old CLI window completely and making everyone > learn PowerShell ISE Or

Re: Dynamic inputs

2016-04-17 Thread Michael Selik
On Sun, Apr 17, 2016, 7:01 AM durgadevi1 < srirajarajeswaridevikr...@gmail.com> wrote: > On Saturday, April 16, 2016 at 5:31:39 PM UTC+8, Michael Selik wrote: > > On Sat, Apr 16, 2016, 9:41 AM durgadevi1 < > > srirajarajeswaridevikr...@gmail.com> wrote: > > > &

Re: How much sanity checking is required for function inputs?

2016-04-17 Thread Michael Selik
On Sun, Apr 17, 2016, 4:35 PM Christopher Reimer < christopher_rei...@icloud.com> wrote: > Greetings, > > I'm currently building a chess engine to learn the finer details of > Python. When I learned all flavors of Java in community college a decade > ago, we had to sanity check the hell out of the

Re: QWERTY was not designed to intentionally slow typists down

2016-04-17 Thread Michael Torrie
On 04/17/2016 07:39 PM, Steven D'Aprano wrote: > Even though QWERTY wasn't designed with touch-typing in mind, it's > interesting to look at some of the weaknesses of the system. It is almost > as if it had been designed to make touch-typing as inefficient as > possible :-) Just consider the home k

Re: How much sanity checking is required for function inputs?

2016-04-19 Thread Michael Selik
On Mon, Apr 18, 2016 at 1:05 AM Christopher Reimer < christopher_rei...@icloud.com> wrote: > On 4/17/2016 3:18 PM, Michael Selik wrote: > > > I'd rather turn the question around: how much sanity checking is > > necessary or useful? You'll find the answer is &qu

Re: Python packages for hydrology and DEM

2016-04-19 Thread Michael Selik
On Tue, Apr 19, 2016 at 2:21 AM Xristos Xristoou wrote: > I want to ask for hydrology python packages with complete function to > calculate hydrology tasks like fill,flow direction,flow accumulator and > more?or how can i find genetic algorithms for to do this tasks to finaly > create a complete

Re: How much sanity checking is required for function inputs?

2016-04-19 Thread Michael Selik
On Tue, Apr 19, 2016 at 11:23 PM Christopher Reimer < christopher_rei...@icloud.com> wrote: > On 4/19/2016 1:02 AM, Michael Selik wrote: > > > Why relocate rather than remove? What message would you provide that's > > better than ``KeyError: 42`` with a trace

Re: Creating Dict of Dict of Lists with joblib and Multiprocessing

2016-04-20 Thread Michael Selik
On Wed, Apr 20, 2016 at 10:50 AM Sims, David (NIH/NCI) [C] < david.si...@nih.gov> wrote: > Hi, > > Cross posted at > http://stackoverflow.com/questions/36726024/creating-dict-of-dicts-with-joblib-and-multiprocessing, > but thought I'd try here too as no responses there so far. > > A bit new to pyt

Re: Detecting repeated subsequences of identical items

2016-04-20 Thread Michael Selik
On Wed, Apr 20, 2016 at 11:11 PM Steven D'Aprano wrote: > I want to group [repeated] subsequences. For example, I have: > "ABCABCABCDEABCDEFABCABCABCB" > and I want to group it into repeating subsequences. I can see two > ways... How can I do this? Does this problem have a standard name and/or >

Re: Detecting repeated subsequences of identical items

2016-04-20 Thread Michael Selik
On Thu, Apr 21, 2016 at 2:35 AM Michael Selik wrote: > On Wed, Apr 20, 2016 at 11:11 PM Steven D'Aprano > wrote: > >> I want to group [repeated] subsequences. For example, I have: >> "ABCABCABCDEABCDEFABCABCABCB" >> and I want to group it into rep

Re: Detecting repeated subsequences of identical items

2016-04-21 Thread Michael Selik
On Thu, Apr 21, 2016 at 2:55 AM Vlastimil Brom wrote: > 2016-04-21 5:07 GMT+02:00 Steven D'Aprano : > > I want to group subsequences. > > "ABCABCABCDEABCDEFABCABCABCB" > > ABC ABC ABCDE ABCDE F ABC ABC ABC B > > or: > > ABC ABC ABC D E A B C D E F ABC ABC ABC B > > if I am not missing something,

Re: How much sanity checking is required for function inputs?

2016-04-22 Thread Michael Selik
On Fri, Apr 22, 2016, 1:26 AM Stephen Hansen wrote: > On Thu, Apr 21, 2016, at 08:33 PM, Christopher Reimer wrote: > > On 4/21/2016 7:20 PM, Stephen Hansen wrote: > > > I... that... what... I'd forget that link and pretend you never went > > > there. Its not helpful. > > > > I found it on the Int

Re: How much sanity checking is required for function inputs?

2016-04-23 Thread Michael Selik
On Sat, Apr 23, 2016 at 9:01 PM Christopher Reimer < christopher_rei...@icloud.com> wrote: > On 4/21/2016 9:46 PM, Ethan Furman wrote: > > Oh! and Enum!!! ;) > > OMG! I totally forgot about Enum. Oh, look. Python supports Enum. Now I > don't have to roll my own! > > Hmm... What do we use Enum for

Re: How much sanity checking is required for function inputs?

2016-04-23 Thread Michael Selik
On Sat, Apr 23, 2016 at 9:31 PM Christopher Reimer < christopher_rei...@icloud.com> wrote: > On 4/21/2016 10:25 PM, Stephen Hansen wrote: > > > > Why not, 'color in ("black", "white")'? > > Checkers seems popular around here. What if I want to change "white" to > "red," as red and black is a commo

Re: How much sanity checking is required for function inputs?

2016-04-23 Thread Michael Torrie
On 04/23/2016 07:45 PM, Christopher Reimer wrote: > I had to confront all the bad habits I brought over Java and change my > code to be more Pythonic. This is where I started having fun, learning > the tricks and collapsing multi-line code into a single line code. I've > learned more about Pytho

Re: How much sanity checking is required for function inputs?

2016-04-23 Thread Michael Torrie
On 04/23/2016 08:32 PM, Christopher Reimer wrote: > That's the other problem I'm running into. Building a chess engine is a > big project. This is probably bigger than the Java XML parser I built > from scratch for a college project. I can't seem to find any information > on how to build bigger

Re: How much sanity checking is required for function inputs?

2016-04-23 Thread Michael Torrie
On 04/23/2016 09:41 PM, Christopher Reimer wrote: > I never wanted to learn Java in the first place. My community college > couldn't afford to renew the Microsoft site license, which local > employers required to learn C/C++ in MS Visual Studio, and all flavors > of Java got taught for the progr

Re: How much sanity checking is required for function inputs?

2016-04-23 Thread Michael Selik
On Sun, Apr 24, 2016, 1:51 AM Steven D'Aprano wrote: > On Sun, 24 Apr 2016 12:34 pm, Michael Torrie wrote: > > > There are many aspects to Pythonic programming, not just OOP. For > > example using modules to store shared state for your program components > > is ver

Re: Scraping email to make invoice

2016-04-24 Thread Michael Torrie
On 04/24/2016 12:58 PM, CM wrote: > 1. INPUT: What's the best way to scrape an email like this? The > email is to a Gmail account, and the content shows up in the email as > a series of basically 6x7 tables (HTML?), one table per PO > number/task. I know if the freelancer were to copy and paste the

Re: How much sanity checking is required for function inputs?

2016-04-24 Thread Michael Selik
On Sun, Apr 24, 2016 at 2:08 PM Steven D'Aprano wrote: > On Sun, 24 Apr 2016 04:40 pm, Michael Selik wrote: > > I think we're giving mixed messages because we're conflating > "constants" and globals that are expected to change. > > When you talk abo

Re: what is the difference between one-line-operation and 2-line-operation

2016-04-25 Thread Michael Torrie
On 04/25/2016 08:13 AM, oyster wrote: > so, what produces this difference between py2 and py3 in nature? is > there more examples? where can I find the text abiut his difference? One thing I see is that both your py2 and py3 examples are treating print as a function. It's only a function in Py3.

Re: Scraping email to make invoice

2016-04-25 Thread Michael Torrie
On 04/25/2016 08:39 AM, Grant Edwards wrote: > Your normal gmail password is used for IMAP. Actually, no, unless you explicitly tell Google to allow "less-secure" authentication. Otherwise you are required to set up a special, application-specific password. https://support.google.com/accounts/an

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Michael Torrie
On 04/27/2016 07:12 PM, Christopher Reimer wrote: > class Piece(object): > def __init__(self, color, position, state=None): > if state is None: > self._state = { > 'class': self.__class__.__name__, > 'color': color, > 'fi

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Michael Torrie
On 04/27/2016 08:49 PM, Christopher Reimer wrote: > On 4/27/2016 7:00 PM, Michael Torrie wrote: >> I am guessing that the reason you are storing state as it's own >> dictionary is so that you can pass the state itself to the constructor? > > Someone said it was bad to

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Michael Torrie
On 04/27/2016 10:06 PM, Christopher Reimer wrote: > On 4/27/2016 8:52 PM, Michael Torrie wrote: >> In fact if it were me I would save game state to some kind of ini file, >> which would mean manually going through each object and writing out the >> relevant data to the ini

Re: Query regarding python 2.7.11 release

2016-04-29 Thread Michael Selik
>From searching bugs.python.org, I see that issues referencing CVE-2014-7185, CVE-2013-1752, and CVE-2014-1912 have all been marked as closed. I don't see any issues referencing CVE-2014-4650 via Python's bug tracker, but did spot it on Red Hat's. It appears to be related to issue 21766 ( http://b

Re: Need help understanding list structure

2016-05-02 Thread Michael Torrie
On 05/02/2016 04:33 PM, moa47...@gmail.com wrote: > Yes, that does help. You're right. The author of the library I'm > using didn't implement either a __str__ or __repr__ method. Am I > correct in assuming that parsing a large text file would be quicker > returning pointers instead of strings? I've

Re: Fastest way to retrieve and write html contents to file

2016-05-02 Thread Michael Torrie
On 05/02/2016 01:37 AM, DFS wrote: > So python matches or beats VBScript at this much larger file. Kewl. If you download something large enough to be meaningful, you'll find the runtime speeds should all converge to something showing your internet connection speed. Try downloading a 4 GB file, f

Re: Conditionals And Control Flows

2016-05-04 Thread Michael Selik
On Wed, May 4, 2016 at 10:46 AM Cai Gengyang wrote: > I am trying to understand the boolean operator "and" in Python. It is > supposed to return "True" when the expression on both sides of "and" are > true > Not exactly, because they will short-circuit. Take a look at the docs. ( https://docs.py

Re: No SQLite newsgroup, so I'll ask here about SQLite, python and MS Access

2016-05-04 Thread Michael Selik
On Wed, May 4, 2016, 6:51 PM DFS wrote: > Both of the following python commands successfully create a SQLite3 > datafile which crashes Access 2003 immediately upon trying to open it > (via an ODBC linked table). > Have you tried using Access 2013? On the other hand, a SQLite3 file created in VB

Re: After a year using Node.js, the prodigal son returns

2016-05-05 Thread Michael Torrie
On 05/04/2016 02:59 AM, Steven D'Aprano wrote: > A year ago, Gavin Vickery decided to move away from Python and give > Javascript with Node.js a try. Twelve months later, he has written about his > experiences: > > > http://geekforbrains.com/post/after-a-year-of-nodejs-in-production Very inter

Re: pylint woes

2016-05-07 Thread Michael Selik
On Sat, May 7, 2016 at 12:56 PM DFS wrote: > |mixed-indentation|186 | I always use tab > Don't mix tabs and spaces. I suggest selecting all lines and using your editor to convert spaces to tabs. Usually there's a feature to "tabify". > +-++ >

Re: python - handling HTTP requests asynchronously

2016-05-07 Thread Michael Selik
On Fri, May 6, 2016 at 3:01 AM wrote: > The PDF is generated through an external API. Since currently is generated > on demand, this is handled synchronously via an HTTP request/response. Are you sending the request or are you receiving the request? If you are sending, you can just use threads

pypi download links (e.g. for ansible)

2016-05-09 Thread Michael Ströder
/a/ansible/ansible-2.0.2.0.tar.gz [..] HTTP request sent, awaiting response... 404 Not Found Ciao, Michael. -- https://mail.python.org/mailman/listinfo/python-list

Re: pypi download links (e.g. for ansible)

2016-05-09 Thread Michael Ströder
harirammano...@gmail.com wrote: > On Monday, May 9, 2016 at 3:30:31 PM UTC+5:30, Michael Ströder wrote: >> HI! >> >> Deep-links for downloading a specific version from PyPI seemed to work like >> this: >> >> $ wget >> https://pypi.python.org/pac

Re: pypi download links (e.g. for ansible)

2016-05-09 Thread Michael Ströder
Steven D'Aprano wrote: > On Mon, 9 May 2016 08:00 pm, Michael Strc3b6der wrote: > >> HI! >> >> Deep-links for downloading a specific version from PyPI seemed to work >> like this: >> >> $ wget >> https://pypi.python.org/packages/source/

Re: Python PygLatin

2016-05-09 Thread Michael Torrie
On 05/08/2016 04:21 AM, Cai Gengyang wrote: > This is a long > road ahead, but I believe it is worth it because the power of a new > technology does eventually translate into money. If this is your prime motivation, I think you'll be very disappointed. A good programmer certainly can make a good

Re: String concatenation (was: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?)

2016-05-09 Thread Michael Selik
You're saying that wasn't a coded message? On Sun, May 8, 2016, 10:44 PM srinivas devaki wrote: > I'm so sorry, forgot to lock my phone. > On May 9, 2016 9:01 AM, "srinivas devaki" > wrote: > > > f be gfdnbh be b GB GB BH GB vbjfhjb GB bffbbubbv GB hbu hbu > > fjbjfbbbufhbvh VB have fqb

Re: What should a decorator do if an attribute already exists?

2016-05-10 Thread Michael Selik
On Tue, May 10, 2016 at 11:48 AM Peter Otten <__pete...@web.de> wrote: > Steven D'Aprano wrote: > > I have a decorator that adds an attribute to the decorated function: > >inner.instrument = instrument > >return inner > > the original instrument is still accessible as f.__wrapped__.instr

Re: python - handling HTTP requests asynchronously

2016-05-10 Thread Michael Selik
On Sat, May 7, 2016 at 4:46 PM wrote: > Il giorno sabato 7 maggio 2016 21:04:47 UTC+2, Michael Selik ha scritto: > > On Fri, May 6, 2016 at 3:01 AM wrote: > > > > > The PDF is generated through an external API. Since currently is > generated > > > on demand,

Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?

2016-05-12 Thread Michael Torrie
On 05/12/2016 03:12 AM, alister wrote: > On Tue, 10 May 2016 19:40:02 -0400, DFS wrote: > >> Sometimes I try to be a funny smart-aleck and it doesn't work. > > this is the problem everyone is having with your post, you acknowledge > that it doesn't work so why keep trying. > > I too can fall gu

Re: Average calculation Program *need help*

2016-05-12 Thread Michael Torrie
On 05/12/2016 10:22 PM, Jake Kobs wrote: > On Thursday, May 12, 2016 at 10:48:08 AM UTC-5, Jake Kobs wrote: >> Hello all, I have been struggling with this code for 3 hours now and I'm >> still stumped. My problem is that when I run the following code: >> ---

Re: Average calculation Program *need help*

2016-05-12 Thread Michael Torrie
On 05/12/2016 11:03 PM, Jake Kobs wrote: > Im not sure how to move it inside the for loop. I've been working on > this small problem for like 4 hours lol. I'm sorry it's so frustrating. Sounds like you haven't got down some of the most basic fundamentals yet. In Python, things that should happen

Re: Fw: Question about issue with opening Python

2016-05-13 Thread Michael Torrie
On 05/13/2016 07:05 AM, christopher.amor...@mail.citytech.cuny.edu wrote: > I downloaded an older version of Python and for about an hour it was > working, but started to get the same error message I received when > using the latest version of Python. You'll have to tells us what the error was tha

Re: Fw: Question about issue with opening Python

2016-05-13 Thread Michael Torrie
On 05/13/2016 07:47 AM, christopher.amor...@mail.citytech.cuny.edu wrote: > Hello, > > Thank you for your reply. It says "IDLE's subprocess didn't make > connection. Either IDLE can't start a subprocess or personal firewall > software is blocking the connection." It worked after the first hour > o

Re: How to put back a number-based index

2016-05-13 Thread Michael Selik
On Fri, May 13, 2016 at 12:27 PM David Shi via Python-list < python-list@python.org> wrote: > I lost my indexes after grouping in Pandas. > I managed to rest_index and got back the index column. > But How can I get back a index row? > Was the grouping an aggregation? If so, the original indexes a

Re: Distinction between “class” and “type”

2016-05-13 Thread Michael Selik
On Fri, May 13, 2016 at 1:10 AM Ben Finney wrote: > Howdy all, > > Ever since Python's much-celebrated Grand Unification of classes and > types, I have used those terms interchangeably: every class is a type, > and every type is a class. > > That may be an unwise conflation. With the recent rise

Re: How to put back a number-based index

2016-05-13 Thread Michael Selik
In order to preserve your index after the aggregation, you need to make sure it is considered a data column (via reset_index) and then choose how your aggregation will operate on that column. On Fri, May 13, 2016 at 3:29 PM David Shi wrote: > Hello, Michael, > > Why reset_index before

Re: How to put back a number-based index

2016-05-13 Thread Michael Selik
Just in case I misunderstood, why don't you make a little example of before and after the grouping? This mailing list does not accept attachments, so you'll have to make do with pasting a few rows of comma-separated or tab-separated values. On Fri, May 13, 2016 at 3:56 PM Michael Se

Re: Design: Idiom for classes and methods that are customizable by the user?

2016-05-13 Thread Michael Selik
On Fri, May 13, 2016 at 2:41 AM Gregory Ewing wrote: > Dirk Bächle wrote: > > I'm currently following the "Factory" pattern (more or less) as I know > > it from C++ and similar languages. > > This statement sets off alarm bells for me. If you're using some > design pattern in Python just because

Re: How to put back a number-based index

2016-05-13 Thread Michael Selik
2 B z 3 If that doesn't help, you'll need to explain what you're trying to accomplish in detail -- what variables you started with, what transformations you want to do, and what variables you hope to have when finished. On Fri, May 13, 2016 at 4:36 PM David Sh

Re: How to put back a number-based index

2016-05-13 Thread Michael Selik
dtype: int64 >>> df.iloc[0] X0 Name: a, dtype: int64 On Fri, May 13, 2016 at 4:54 PM David Shi wrote: > Dear Michael, > > To avoid complication, I only groupby using one column. > > It is OK now. But, how to refer to new row index? How do I use floating

Re: How to put back a number-based index

2016-05-13 Thread Michael Selik
What have code you tried? What error message are you receiving? On Fri, May 13, 2016, 5:54 PM David Shi wrote: > Hello, Michael, > > How to convert a float type column into an integer or label or string type? > > > On Friday, 13 May 2016, 22:02, Michael Selik > wrote:

Re: How to put back a number-based index

2016-05-13 Thread Michael Selik
html On Fri, May 13, 2016 at 11:18 PM David Shi wrote: > Hello, Michael, > > I tried to discover the problem. > > df[0] yields nothing > df[1] yields nothing > df[2] yields nothing > > However, df[3] gives the following: > > sid > -92233720368547758

Re: How to put back a number-based index

2016-05-14 Thread Michael Selik
It looks like you're getting a Series. Apparently more that one row has the same index. On Fri, May 13, 2016 at 11:30 PM Michael Selik wrote: > What were you hoping to get from ``df[0]``? > When you say it "yields nothing" do you mean it raised an error? What was > the

Re: How to put back a number-based index

2016-05-14 Thread Michael Selik
David, it sounds like you'll need a thorough introduction to the basics of Python. Check out the tutorial: https://docs.python.org/3/tutorial/ On Sat, May 14, 2016 at 6:19 AM David Shi wrote: > Hello, Michael, > > I discovered that the problem is "two columns of data are

Re: How to put back a number-based index

2016-05-14 Thread Michael Selik
You might also be interested in "Python for Data Analysis" for a thorough discussion of Pandas. http://shop.oreilly.com/product/0636920023784.do On Sat, May 14, 2016 at 10:29 AM Michael Selik wrote: > David, it sounds like you'll need a thorough introduction to the basics of

Re: Why online forums have bad behaviour

2016-05-14 Thread Michael Selik
On Sat, May 14, 2016 at 8:57 AM Ben Finney wrote: > If you dislike someone's behaviour, consider that they may not have a > well-thought-out or coherent rason for it; and, if pressed to come up > with a reason, we will employ all our faculties to *make up* a reason > (typically without be

Re: How to get a directory list sorted by date?

2016-05-15 Thread Michael Selik
On Sun, May 15, 2016, 10:37 AM Grant Edwards wrote: > On 2016-05-15, Tim Chase wrote: > > On 2016-05-15 11:46, Peter Otten wrote: > >> def sorted_dir(folder): > >> def getmtime(name): > >> path = os.path.join(folder, name) > >> return os.path.getmtime(path) > >> > >> retu

Re: Pandas GroupBy does not behave consistently

2016-05-15 Thread Michael Selik
On Sun, May 15, 2016 at 7:07 AM David Shi wrote: > Hello, Michael, > > Pandas GroupBy does not behave consistently. > > Last time, when we had conversation, I used grouby. It works well. > > Now, I thought to re-write the program, so that I can end up with a clean > scri

Re: How to create development Python environment on Linux.

2016-05-16 Thread Michael Selik
On Mon, May 16, 2016 at 5:31 PM wrote: > After considering your guidance I think what I will do is install > virtualenv using apt-get and then use that to create a dev environment. Is > it ok to run get-pip.py in a virtual environment? > Recent versions of the virtualenv application create virtu

<    5   6   7   8   9   10   11   12   13   14   >