Re: Suggestion: make sequence and map interfaces more similar

2016-03-30 Thread Marco Sulla via Python-list
On 30 March 2016 at 02:55, Terry Reedy wrote: > To me [seq.items() and seq.keys()] are useless and confusing duplications > since enumerate()(seq) > and range(len(seq)) are quite different from dict.items and dict.keys. It's true. Indeed IMHO it's enumerate() that will be a confusing duplication

Re: Suggestion: make sequence and map interfaces more similar

2016-03-30 Thread Marco Sulla via Python-list
Let me also add that even if it seems that my idea will not break any official contracts, I can create a new ABC class and let maps and sequence types inherit from it. IMHO it's absolutely not needed, but at least the discussion will be no more distracted my secondary considerations, since the main

Re: Suggestion: make sequence and map interfaces more similar

2016-03-30 Thread Mark Lawrence via Python-list
On 30/03/2016 20:35, Marco Sulla via Python-list wrote: On 30 March 2016 at 02:55, Terry Reedy wrote: To me [seq.items() and seq.keys()] are useless and confusing duplications since enumerate()(seq) and range(len(seq)) are quite different from dict.items and dict.keys. It's true. I

Re: Suggestion: make sequence and map interfaces more similar

2016-03-30 Thread Mark Lawrence via Python-list
On 30/03/2016 21:00, Marco Sulla via Python-list wrote: Let me also add that even if it seems that my idea will not break any official contracts, I can create a new ABC class and let maps and sequence types inherit from it. IMHO it's absolutely not needed, but at least the discussion will

Re: Adding borders to ttk radiobuttons

2016-03-30 Thread Mark Lawrence via Python-list
On 30/03/2016 17:35, Terry Reedy wrote: .theme_names() only displays the themes for the OS. I believe that there is a way to access themes for other OSes (unix, mac) but don't remember. Possibly http://bugs.python.org/issue17397 which refers to http://code.activestate.com/lists/python-tkint

Re: Python Array

2016-03-30 Thread Mark Lawrence via Python-list
On 31/03/2016 06:34, [email protected] wrote: I am creating the following aData = [] This is a Python list, not an array as the subject gives. # get my data from database for row in rows: aData.append({row["tierid"]:"name":row["tiername"],"description":row["tierdesc"],"option":row["tie

Which plugin allows quick creation of secure REST services?

2016-03-31 Thread David Shi via Python-list
Hello,  Which plugin allows quick creation of secure REST services?  so that Python scripts can be attached to it. Regards. David -- https://mail.python.org/mailman/listinfo/python-list

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Marco Sulla via Python-list
On 31 March 2016 at 04:40, Steven D'Aprano wrote: > Enough of the hypothetical arguments about what one could do or might do. > Let's see a concrete example of actual real world code used in production, > not a mickey-mouse toy program, where it is desirable that adding or > deleting one key will

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Mark Lawrence via Python-list
On 31/03/2016 12:58, Marco Sulla via Python-list wrote: On 31 March 2016 at 04:40, Steven D'Aprano wrote: Enough of the hypothetical arguments about what one could do or might do. Let's see a concrete example of actual real world code used in production, not a mickey-mouse toy prog

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Marco Sulla via Python-list
uences, so it's much more natural to make map iteration over values by default, as for sequences. This is why I proposed a vdict. On 31 March 2016 at 14:30, Mark Lawrence via Python-list wrote: > Note that dict also supports > __getitem__() and __len__(), but is considered a mapping ra

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Mark Lawrence via Python-list
On 31/03/2016 13:49, Marco Sulla via Python-list wrote: On 31 March 2016 at 14:30, Mark Lawrence via Python-list wrote: Note that dict also supports __getitem__() and __len__(), but is considered a mapping rather than a sequence because the lookups use arbitrary immutable keys rather than

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Mark Lawrence via Python-list
On 31/03/2016 14:08, Antoon Pardon wrote: Op 31-03-16 om 13:57 schreef Chris Angelico: Okay. I'll put a slightly different position: Prove that your proposal is worth discussing by actually giving us an example that we can discuss. So far, this thread has had nothing but toy examples (and bogoex

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Mark Lawrence via Python-list
On 31/03/2016 14:27, Random832 wrote: On Thu, Mar 31, 2016, at 09:17, Mark Lawrence via Python-list wrote: On 31/03/2016 14:08, Antoon Pardon wrote: Op 31-03-16 om 13:57 schreef Chris Angelico: Okay. I'll put a slightly different position: Prove that your proposal is worth discussi

Re: Suggestion: make sequence and map interfaces more similar

2016-04-01 Thread Mark Lawrence via Python-list
On 01/04/2016 08:59, Antoon Pardon wrote: Op 31-03-16 om 16:12 schreef Mark Lawrence via Python-list: On 31/03/2016 14:27, Random832 wrote: So can we discuss how a unified method to get a set of all valid subscripts (and/or subscript-value pairs) on an object would be a useful thing to have

Re: The next major Python version will be Python 8

2016-04-01 Thread Gisle Vanem via Python-list
Michael Selik wrote: > It suddenly occurred to me that if Microsoft announced it's > Ubuntu-in-Windows feature today, no one would believe it. My feeling too, but this was announced 30 March. In the video in this link: http://www.cnx-software.com/2016/03/31/microsoft-brings-bash-on-ubuntu-on-w

Re: Drowning in a teacup?

2016-04-01 Thread Mark Lawrence via Python-list
On 01/04/2016 21:27, Fillmore wrote: notorious pass by reference vs pass by value biting me in the backside here. Proceeding in order. It is pass by object. By definition your following analysis is wrong. To my knowledge this has been discussed at least twice a year for the past 15 years.

Re: [beginner] What's wrong?

2016-04-01 Thread Mark Lawrence via Python-list
On 01/04/2016 23:10, Michael Okuntsov wrote: Nevermind. for j in range(1,8) should be for j in range(8). Thank you for your correction, we in Python land greatly appreciate such things :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language

Re: Strange range

2016-04-01 Thread Mark Lawrence via Python-list
On 01/04/2016 21:44, Marko Rauhamaa wrote: Rob Gaddi : Marko Rauhamaa wrote: There's a bit of a cognitive dissonance between iterables and iterators. On the one hand, they behave identically in many contexts. On the other hand, the distinction is crucial in some special cases. You're missing

Re: [beginner] What's wrong?

2016-04-01 Thread Mark Lawrence via Python-list
On 01/04/2016 23:44, [email protected] 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 many times I've gotten bit in the ass with that off-by-one mistake whenever I use a range th

Re: Drowning in a teacup?

2016-04-02 Thread Mark Lawrence via Python-list
On 02/04/2016 06:51, Michael Selik wrote: 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

tkinter Entry validation modes

2016-04-02 Thread Mark Lawrence via Python-list
A typical call to create an Entry field would be:- e = Entry(master, validate='all', ...) Once this call has been made is it possible to change the validation mode at runtime? Background, I'm knocking up an app so I can play with the various modes so that I can see how they work, as I'm just

Re: [beginner] What's wrong?

2016-04-02 Thread Mark Lawrence via Python-list
On 02/04/2016 17:31, Dennis Lee Bieber wrote: On Sat, 2 Apr 2016 19:15:36 +1100, Chris Angelico declaimed the following: 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 remembe

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

2016-04-02 Thread Mark Lawrence via Python-list
On 02/04/2016 23:23, Loop.IO wrote: On Saturday, April 2, 2016 at 11:09:13 PM UTC+1, BartC wrote: On 02/04/2016 22:59, Loop.IO wrote: Hey So I built a keylogger using python as a test, got the code from the tutorial online, I want to improve on it to make it more automated, but the issue I'm

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

2016-04-02 Thread Mark Lawrence via Python-list
On 02/04/2016 23:37, Michael Selik wrote: 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 Batch

Re: [beginner] What's wrong?

2016-04-02 Thread Mark Lawrence via Python-list
On 03/04/2016 00:49, Steven D'Aprano wrote: On Sun, 3 Apr 2016 03:12 am, Thomas 'PointedEars' Lahn wrote: Marko Rauhamaa wrote: Steven D'Aprano : So you're saying that learning to be a fluent speaker of English is a pre-requisite of being a programmer? No more than learning Latin is a prer

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

2016-04-02 Thread Mark Lawrence via Python-list
On 03/04/2016 01:12, BartC wrote: On 02/04/2016 23:31, Loop.IO wrote: Oh i see, so the code prompts for a name.. so i'm more lost than i thought, what do I need to change to make it just create the file with the chosen name Launch2.bat without the prompt? If you don't want the user to enter a

Re: [beginner] What's wrong?

2016-04-02 Thread Mark Lawrence via Python-list
On 03/04/2016 01:48, Steven D'Aprano wrote: On Sun, 3 Apr 2016 07:42 am, Michael Selik wrote: Gaming also helps your reaction time. Normally 0.3 ms, but 0.1 ms for top gamers. And fighter pilots. Does gaming help reaction time, or do only people with fast reaction times become top gamers? Pe

ONE CLICK REST API

2016-04-03 Thread David Shi via Python-list
Eclipse has got one click app for creating REST services. What is it equivalent in Python? Regards. David -- https://mail.python.org/mailman/listinfo/python-list

Re: Strange range

2016-04-04 Thread Mark Lawrence via Python-list
On 03/04/2016 17:28, Ethan Furman wrote: On 04/02/2016 11:58 PM, Marko Rauhamaa wrote: Stephen Hansen : I'm pretty sure that 99+% of the non-stdlib code out there is also completely inaccessible (or at least inconveniently accessible) to Stephen as well. http://nullege.com/codes/search?cq=r

Re: [beginner] What's wrong?

2016-04-04 Thread Mark Lawrence via Python-list
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 referring to me, frankly I haven't a clue. I read this list with Thunderbird on Windows, I hit "reply" to somethi

How can I install

2016-04-04 Thread Mohamed Ali via Python-list
I have tried to install python and nltk but I couldn't. Please could you please help me because I need to work on natural language processing using Python. Regards,Mohamed -- https://mail.python.org/mailman/listinfo/python-list

Re: Best Practices for Internal Package Structure

2016-04-04 Thread Mark Lawrence via Python-list
On 04/04/2016 19:45, Michael Selik wrote: 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 ├── _c

Re: IDLE's subprocess didn't make connection. Either IDLE can't start or personal firewall software is blocking connection.

2016-04-04 Thread Mark Lawrence via Python-list
On 04/04/2016 21:19, Steven Gao wrote: I’m getting “IDLE's subprocess didn't make connection. Either IDLE can't start or personal firewall software is blocking connection.”. Any ideas? Sent from Mail for Windows 10 Asked and answered repeatedly, please search the archives for the answer. --

Re: ONE CLICK REST API

2016-04-05 Thread Roland Mueller via Python-list
for yourself: - http://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask BR, Roland 2016-04-04 9:09 GMT+03:00 David Shi via Python-list : > Eclipse has got one click app for creating REST services. > What is it equivalent in Python? > Regards. > David

Re: Label behavior's difference between tkinter and ttk

2016-04-05 Thread Mark Lawrence via Python-list
On 05/04/2016 07:57, ast wrote: Hello I currently migrate a GUI from tkinter to ttk and I found a problem Here is a piece of code, with comments which explain what is wrong. import tkinter as tk import tkinter.ttk as ttk root = tk.Tk() BITMAP0 = """ #define zero_width 24 #define zero_height

Re: tkinter Entry validation modes

2016-04-05 Thread Mark Lawrence via Python-list
On 02/04/2016 19:45, Terry Reedy wrote: On 4/2/2016 11:11 AM, Mark Lawrence via Python-list wrote: A typical call to create an Entry field would be:- e = Entry(master, validate='all', ...) Once this call has been made is it possible to change the validation mode at runtime? AF

Re: python script for .dat file

2016-04-05 Thread Mark Lawrence via Python-list
On 05/04/2016 16:23, Muhammad Ali wrote: Hello, Could any body tell me a general python script to generate .dat file after the extraction of data from more than 2 files, say file A and file B? Or could any body tell me the python commands to generate .dat file after the extraction of data fr

Re: Install request

2016-04-05 Thread Mark Lawrence via Python-list
On 05/04/2016 16:56, Igor Korot wrote: Hi, python community, Recently there was a huge number of e-mail stating that the python installer does not work. When asked about it, people reveal that they wee using Windows and they were getting errors about missing DLL. I know for a fact that in the

Re: Best Practices for Internal Package Structure

2016-04-05 Thread Mark Lawrence via Python-list
On 05/04/2016 19:49, Sven R. Kunze wrote: It appears to me as if you like messy code then. ;) The messy code is with the person who needlessly splits a single module of a few thousand lines into several modules just for the sake of it. If you want to play yo-yo, leaping from source file to

Re: python script for .dat file

2016-04-05 Thread Mark Lawrence via Python-list
On 05/04/2016 21:35, Michael Selik wrote: What code have you written so far? Would you please not top post on this list, it drives me nuts!!! -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/ma

Re: Promoting Python

2016-04-06 Thread Mark Lawrence via Python-list
On 06/04/2016 12:06, BartC wrote: On 05/04/2016 06:48, Gordon( Hotmail ) wrote: I am struggling to understand the basic principles of Python having spent many years as a pure Amateur tinkering with a variety of BASIC Last time I looked, there seemed to be around 250 dialects of Basic, and with

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

2016-04-06 Thread Mark Lawrence via Python-list
On 06/04/2016 14:07, ast wrote: Hello 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 ? Example: def to_base(nber, base=16, use_af=True, sep=''): assert isinstance(nber, int) and nber >= 0 ass

Re: Promoting Python

2016-04-06 Thread Mark Lawrence via Python-list
On 06/04/2016 14:54, BartC wrote: On 06/04/2016 12:46, Marko Rauhamaa wrote: BartC : It'll cope with ordinary coding as well, although such programs seem to be frowned upon here; they are not 'Pythonic'. I wonder what is left of Python after your list of exclusions. There are plenty of fe

Re: Promoting Python

2016-04-06 Thread Mark Lawrence via Python-list
On 06/04/2016 15:34, Ned Batchelder wrote: On Wednesday, April 6, 2016 at 10:25:13 AM UTC-4, Mark Lawrence wrote: On 06/04/2016 14:54, BartC wrote: On 06/04/2016 12:46, Marko Rauhamaa wrote: BartC : It'll cope with ordinary coding as well, although such programs seem to be frowned upon here

Re: Promoting Python

2016-04-06 Thread Mark Lawrence via Python-list
On 06/04/2016 18:55, Ned Batchelder wrote: It took us a while to understand where Bart was coming from, but now we understand, and we don't have to go around in circles. No it didn't, it was quite clear from the beginning that he knew squat, and since then he's admitted that he knows squat.

Re: deque is not a subclass of Sequence.

2016-04-07 Thread Mark Lawrence via Python-list
On 07/04/2016 10:25, Antoon Pardon wrote: the index() method seems to be added in 3.5, so is deque a subclass of Sequence in 3.5? Yes, this http://bugs.python.org/issue23704 refers. Use the builtin https://docs.python.org/3/library/functions.html#issubclass to try it. >>> issubclass(deque

Re: how to convert code that uses cmp to python3

2016-04-07 Thread Mark Lawrence via Python-list
On 07/04/2016 13:05, Antoon Pardon wrote: I am looking at my avltree module for converting it to python3. One of the things that trouble me here is how python3 no longer has cmp and how things have to be of "compatible" type in order to be comparable. So in python2 it wasn't a problem to have a

Re: how to convert code that uses cmp to python3

2016-04-07 Thread Mark Lawrence via Python-list
On 07/04/2016 21:56, Antoon Pardon wrote: Op 07-04-16 om 14:22 schreef Chris Angelico: ... There's no __cmp__ method, but you could easily craft your own compare() function: def compare(x, y): """Return a number < 0 if x < y, or > 0 if x > y""" if x == y: return 0 return -1 if

Re: [beginner] What's wrong?

2016-04-08 Thread Mark Lawrence via Python-list
On 08/04/2016 23:59, [email protected] wrote: On Friday, April 1, 2016 at 3:57:40 PM UTC-7, Mark Lawrence wrote: On 01/04/2016 23:44, [email protected] 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

Re: QWERTY was not designed to intentionally slow typists down

2016-04-09 Thread Mark Lawrence via Python-list
On 09/04/2016 01:43, Ben Finney wrote: Dennis Lee Bieber writes: Yet another completely irrelevant thread that has nothing to do with Python. As this is meant to be the main Python mailing list, why don't the moderators put a stop to such tripe? -- My fellow Pythonistas, ask not what our

Re: Find the number of robots needed to walk through the rectangular grid

2016-04-09 Thread Mark Lawrence via Python-list
On 09/04/2016 18:13, Joe wrote: On Saturday, 9 April 2016 18:44:20 UTC+2, Ian wrote: On Sat, Apr 9, 2016 at 8:18 AM, Joe wrote: How to find the number of robots needed to walk through the rectangular grid The movement of a robot in the field is divided into successive steps In one step a rob

Re: Unicode normalisation [was Re: [beginner] What's wrong?]

2016-04-09 Thread Mark Lawrence via Python-list
On 09/04/2016 17:08, Rustom Mody wrote: On Saturday, April 9, 2016 at 7:14:05 PM UTC+5:30, Ben Bacarisse wrote: The problem with that theory is that 'er/re' (this is e and r in either order) is the 3rd most common pair in English but have been placed together. ou and et (in either order) are th

Re: QWERTY was not designed to intentionally slow typists down

2016-04-09 Thread Mark Lawrence via Python-list
On 09/04/2016 20:25, Tim Golden wrote: On 09/04/2016 20:13, Mark Lawrence via Python-list wrote: On 09/04/2016 01:43, Ben Finney wrote: Dennis Lee Bieber writes: Yet another completely irrelevant thread that has nothing to do with Python. As this is meant to be the main Python mailing

Re: Find the number of robots needed to walk through the rectangular grid

2016-04-09 Thread Mark Lawrence via Python-list
On 09/04/2016 20:41, Joe wrote: Sorry, I was desperate I deleted the post You didn't. This will be showing in the archives in several places, e.g https://mail.python.org/pipermail/python-list/2016-April/707160.html -- My fellow Pythonistas, ask not what our language can do for you, ask wh

Re: QWERTY was not designed to intentionally slow typists down

2016-04-09 Thread Mark Lawrence via Python-list
On 09/04/2016 21:22, alister wrote: On Sat, 09 Apr 2016 20:13:15 +0100, Mark Lawrence wrote: On 09/04/2016 01:43, Ben Finney wrote: Dennis Lee Bieber writes: Yet another completely irrelevant thread that has nothing to do with Python. As this is meant to be the main Python mailing list, w

Re: one-element tuples

2016-04-11 Thread Larry Hudson via Python-list
On 04/10/2016 08:19 PM, Fillmore wrote: Thank you for trying to help, Martin. So: On 04/10/2016 09:08 PM, Martin A. Brown wrote: #1: I would not choose eval() except when there is no other solution. If you don't need eval(), it may save you some headache in the future, as well, to f

RE: how to setup for localhost:8000

2016-04-14 Thread Dan Strohl via Python-list
If you got an empty page with no errors (and no warnings trying to get there...) it is likely that your server is working, and you are trying to access it correctly, but the server is not serving anything. Most of the time, if the server is not present, you will get a timeout error saying the b

Re: How to XOR a byte output?

2016-04-14 Thread Chris Juried via Python-list
Hello list, I am new to the list and was wondering if anyone is using Python for MCU programing? In particular the AVR and ARM based controllers. Is Python a plausible language for MCU programming or is C/C++ or Assembly the only way to go? Thanks in advance for your insight.  Sincerely,      Ch

RE: How to print a part of a string?

2016-04-15 Thread Dan Strohl via Python-list
As with lots of things in python, there are lots of ways of approaching this, here are some hints for you to think about (in no particular order): - REGEX - replace() - string[:y] - split() And of course, you could consider creating a table with every possible string that could start with "ABC

Fraud

2016-04-16 Thread Mel Drosis via Python-list
My phone my accounts my home network have all been affected because of someone using coding from Python and Linux and GitHub and json. I don't even know what this stuff is but how do I get rid of it all. It's ruined my life. Sent from my iPhone -- https://mail.python.org/mailman/listinfo/pytho

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

2016-04-27 Thread Christopher Reimer via Python-list
On 4/26/2016 8:56 PM, Random832 wrote: what exactly do you mean by property decorators? If you're just accessing them in a dictionary what's the benefit over having the values be simple attributes rather than properties? After considering the feedback I got for sanity checking my code, I've d

RE: Controlling the passing of data

2016-04-28 Thread Dan Strohl via Python-list
In addition to Peter's points, - I would suggest breaking out the list comprehensions into standard for loops and/or functions. That makes it easier to read and troubleshoot. (you can always re-optimize It if needed.) - Peter's point about making things into functions will also help troublesh

RE: online python courses

2016-04-28 Thread Dan Strohl via Python-list
I've heard good things about codeacademy.com and learnpython.org. Also, I've heard that pycharm educational edition is helpful. (https://www.jetbrains.com/pycharm-edu/ ) I haven't personally tried any of these though, so your mileage may vary. Good Luck! Dan Strohl > -Original Message

RE: Controlling the passing of data

2016-04-28 Thread Dan Strohl via Python-list
If I am reading this correctly... you have something like (you will have to excuse my lack of knowledge about what kinds of information these actually are): 1234 first 5678 second And you want something like: nominations = [(1,1234), (2,5678)] meetings = [(1,'first')

RE: What should Python apps do when asked to show help?

2016-04-28 Thread Dan Strohl via Python-list
I would suggest using argparse https://docs.python.org/3/library/argparse.html as it handles all of that natively... including validating arguments, showing errors, help, etc... however, assuming you don't want to; Send it to stdout, that allows the user to redirect it if they want to (and play

RE: What should Python apps do when asked to show help?

2016-04-28 Thread Dan Strohl via Python-list
From: John Wong [mailto:[email protected]] Sent: Thursday, April 28, 2016 10:06 AM To: Dan Strohl Cc: alister ; [email protected] Subject: Re: What should Python apps do when asked to show help? On Thu, Apr 28, 2016 at 1:02 PM, Dan Strohl via Python-list mailto:[email protected]

RE: What should Python apps do when asked to show help?

2016-04-28 Thread Dan Strohl via Python-list
I would hesitate to take this approach unless the tool was one that only I was going to be using, and I knew exactly what environments it was going to be in. I know that many of the system items in python work differently in different operating systems, and different os's report things different

RE: What should Python apps do when asked to show help?

2016-04-28 Thread Dan Strohl via Python-list
Yup.. another reason to use something like argparse... you define the argument descriptions, help, and when you raise an error, it automatically handles the output, sending it to the right place (stderr/stdout)... as well as allowing you to define different levels of verbosity easily... (or not

Simplest way to locate a string in a column and get the value on the same row in another column

2016-04-28 Thread David Shi via Python-list
What is the simplest way to locate a string in a column and get the value on the same row in another column ? 1  a2  b3  c Locate b and obtain 2 in a table. Looking forward to hearing from you. Regards. David -- https://mail.python.org/mailman/listinfo/python-list

Pivot table of Pandas

2016-04-28 Thread David Shi via Python-list
Hello, Matt, Please see the web link.Pandas Pivot Table Explained |   | |   |   |   |   |   | | Pandas Pivot Table ExplainedExplanation of pandas pivot_table function. | | | | View on pbpython.com | Preview by Yahoo | | | |   | Debra and Fred have their own groups. How to split the pivot

Not x.islower() Versus x.isupper Output Results

2016-04-29 Thread Christopher Reimer via Python-list
Greetings, I was playing around with a piece of code to remove lowercase letters and leave behind uppercase letters from a string when I got unexpected results. string = 'Whiskey Tango Foxtrot' list(filter((lambda x: not x.islower()), string)) ['W', ' ', 'T', ' ', 'F'] Note the

How to fill in abbreviation in one column based on state name in another column?

2016-04-30 Thread David Shi via Python-list
I am trying to use apply to execute a lookup function, so that we can put abbreviation in a new column, in accordance to a state name in another column. Does anyone knows how to make this to work? Regards. David state_to_code = {"VERMONT": "VT", "GEORGIA": "GA", "IOWA": "IA", "Armed Forces Pacifi

How to fill in abbreviation in one column based on state name in another column?

2016-05-01 Thread David Shi via Python-list
Hello, I am back.  Thank you very much for your positive response. I am trying to use Pandas apply to execute a lookup function, so that we can put abbreviation in a new column, in accordance to a state name in another column. Does anyone knows how to make this to work? Regards.DavidLook up funct

RE: Need help understanding list structure

2016-05-03 Thread Dan Strohl via Python-list
Take a look at the docs for print() https://docs.python.org/3.5/library/functions.html#print str() https://docs.python.org/3.5/library/stdtypes.html#str repr() https://docs.python.org/3.5/library/functions.html#repr When you do "print(object)", python will run everything through str() and outp

RE: Need help understanding list structure

2016-05-03 Thread Dan Strohl via Python-list
> I added a __repr__ method at the end of the gedcom library like so: > > def __repr__(self): > """ Format this element as its original string """ > result = repr(self.level()) > if self.pointer() != "": > result += ' ' + self.pointer() > result += ' '

RE: Use __repr__ to show the programmer's representation (was: Need help understanding list structure)

2016-05-03 Thread Dan Strohl via Python-list
> > One other point for you, if your "__repr__(self)" code is the same as > > the "__str__(self)" code (which it looks like it is, at a glance at > > least), you can instead reference the __str__ method and save having a > > duplicate code block... > > Alternatively, consider: the ‘__repr__’ metho

How to call a Python Class?

2016-05-03 Thread David Shi via Python-list
I found a Python class within an Open Source software. I would like to use it in my own Python script. I tried to import it, but I got following message. from intersection import *Traceback (most recent call last):  File "", line 1, in     from intersection import *ImportError: bad magic number i

Re: How to become more motivated to learn Python

2016-05-03 Thread Larry Hudson via Python-list
On 05/03/2016 07:55 PM, Cai Gengyang wrote: Cool, I have finally summoned up enough activation energy to start on Unit 3, now going through the topic on Conditionals and Control Flows (stuff like this) boolthree = 200 == (50 * 5) boolthree False Guess it would be really cool to work on AI an

Re: pylint woes

2016-05-08 Thread Larry Hudson via Python-list
On 05/08/2016 06:01 AM, Chris Angelico wrote: [snip...] ... I like to recommend a little thing called "IIDPIO debugging" - If In Doubt, Print It Out. That means: If you have no idea what a piece of code is doing, slap in a print() call somewhere. It'll tel

Re: pylint woes

2016-05-08 Thread Larry Hudson via Python-list
On 05/08/2016 03:07 PM, Chris Angelico wrote: On Mon, May 9, 2016 at 6:45 AM, Larry Hudson via Python-list wrote: On 05/08/2016 06:01 AM, Chris Angelico wrote: [snip...] ... I like to recommend a little thing called "IIDPIO debugging" - I

Re: Python 3.5.1 Not Working

2016-05-13 Thread Aidan Silcock via Python-list
Sent from Yahoo Mail on Android On Fri, 13 May, 2016 at 16:59, Aidan Silcock wrote: HelloI have tried to download python 3.5.1 today and it has downloaded but each time I try to open it it says I need to Modify, Repair or Uninstall the program.I have tried repairing it neumerous times a

How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
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? Regards. David -- https://mail.python.org/mailman/listinfo/python-list

Re: How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
Hello, Michael,Thank you.  Yes, aster grouping I lost my indexing in both x, y directions. How to convert a row, and a column into indexes or labels? On Friday, 13 May 2016, 17:57, Michael Selik wrote: On Fri, May 13, 2016 at 12:27 PM David Shi via Python-list wrote: I lost my

Re: How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
Hello, Michael, Why reset_index before grouping? Regards. David On Friday, 13 May 2016, 17:57, Michael Selik wrote: On Fri, May 13, 2016 at 12:27 PM David Shi via Python-list wrote: I lost my indexes after grouping in Pandas. I managed to rest_index and got back the index column

Re: How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
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 grouping? Regards. David On Friday, 13 May 2016, 17:57, Michael Selik wrote: On Fri, May 13, 2016 at 12:27 PM David Shi via Python-list wrote

Re: How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
eset_index before grouping? Regards. David On Friday, 13 May 2016, 17:57, Michael Selik wrote: On Fri, May 13, 2016 at 12:27 PM David Shi via Python-list 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

Re: How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
hy 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 Selik wrote: In order to preserve yo

Re: How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
d Shi wrote: Dear Michael, I have done a number of operation in between. Providing that information does not help you How to reset index after grouping and various operations is of interest. How to type in a command to find out its current dataframe? Regards. David On Friday, 13

Re: How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48], [0, 2, 1, 3, 4, 5, 7, 6, 8, 9, 11, 12, 13, 10, 14, 15, 16, 19, 18, 17, 20, 21, 23, 22, 24, 27, 31, 28, 29, 30, 32, 25, 26, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 45, 44, 46, 48, 47, 49]], names=[u'StateFIPS', 0])Re

Re: How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
43, 44, 45, 46, 47, 48], [0, 2, 1, 3, 4, 5, 7, 6, 8, 9, 11, 12, 13, 10, 14, 15, 16, 19, 18, 17, 20, 21, 23, 22, 24, 27, 31, 28, 29, 30, 32, 25, 26, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 45, 44, 46, 48, 47, 49]], names=[u'StateFIPS', 0])Regards. David On Friday, 13 M

Re: How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
0, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48], [0, 2, 1, 3, 4, 5, 7, 6, 8, 9, 11, 12, 13, 10, 14, 15, 16, 19, 18, 17, 20, 21, 23, 22, 24, 27, 31, 28, 29, 30, 32, 25, 26, 33, 34, 35, 36,

Re: How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48], [0, 2, 1, 3, 4, 5, 7, 6, 8, 9, 11, 12, 13, 10, 14, 15, 16, 19, 18, 17, 20, 21, 23, 22, 24, 27, 31, 28, 29, 30, 32, 25, 26, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 45, 44, 46, 48, 47, 49]], names=[u'StateFIPS

Re: How to put back a number-based index

2016-05-13 Thread David Shi via Python-list
2, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48], [0, 2, 1, 3, 4, 5, 7, 6, 8, 9, 11, 12, 13, 10, 14, 15, 16, 19, 18, 17, 20, 21, 23, 22, 24, 27, 31, 28, 29, 30, 32, 25, 26, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 45, 44, 46, 48, 47, 49]

Re: How to put back a number-based index

2016-05-14 Thread David Shi via Python-list
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48], [0, 2, 1, 3, 4, 5, 7, 6, 8, 9, 11, 12, 13, 10, 14, 15, 16, 19, 18, 17, 20, 21, 23, 22, 24, 27, 31, 28, 29, 30, 32, 25, 26, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 45, 44, 46, 48, 47, 49]], names=

Pandas GroupBy does not behave consistently

2016-05-15 Thread David Shi via Python-list
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48], [0, 2, 1, 3, 4, 5, 7, 6, 8, 9, 11, 12, 13, 10, 14, 15, 16, 19, 18, 17, 20, 21, 23, 22, 24, 27, 31, 28, 29, 30,

RE: Wanted Python programmer to join team

2016-05-16 Thread Dan Strohl via Python-list
> My team is getting more projects that it can handle so we are looking for > Python programers to join. You will be given tasks to complete full or part of > the project. > > Skype: piefektas > > Contact me now with short description about yourself, your skills and > projects you have worked on.

Re: Summing/combining tuples

2016-05-18 Thread Larry Hudson via Python-list
On 05/18/2016 05:59 PM, DFS wrote: Have aList = [ ('x','Name1', 1, 85), ('x','Name2', 3, 219), ('x','Name2', 1, 21), ('x','Name3', 6, 169) ] want aList = [ ('Name1', 1, 85), ('Name2', 4, 240), ('Name3', 6, 169) ] This drops the first element in each tuple: alist = [(b,c,d) for a,b,c,d in ali

Re: Program prints questions for user input, but won't show the answer output

2016-05-18 Thread Larry Hudson via Python-list
On 05/18/2016 06:50 PM, Jake Kobs wrote: MRAB, I am not quite sure how to return the print statements so I thought that returning the displayInfo def would help.. Im so lost. Why do you think you want to _return_ a print statement? The print statement _DOES_ the printing, there is nothing th

Re: Summing/combining tuples

2016-05-19 Thread Larry Hudson via Python-list
On 05/18/2016 09:53 PM, DFS wrote: On 5/18/2016 10:58 PM, Larry Hudson wrote: [snip...] Why two loops? Put both summations in a single loop. Then you're only scanning the alist once instead of twice. groups1 = defaultdict(int) groups2 = defaultdict(int) for nm, matches, words in alist: g

RE: reduction

2016-05-31 Thread Dan Strohl via Python-list
> My problem. I have lists of substrings associated to values: > > ['a','b','c','g'] => 1 > ['a','b','c','h'] => 1 > ['a','b','c','i'] => 1 > ['a','b','c','j'] => 1 > ['a','b','c','k'] => 1 > ['a','b','c','l'] => 0 # <- Black sheep!!! > ['a','b','c','m'] => 1 > ['a','b','c','n'] => 1 > ['a','b','

<    29   30   31   32   33   34   35   36   37   38   >