Re:What is \1 here?

2014-11-11 Thread Dave Angel
satishmlm...@gmail.com Wrote in message: > What does \1 do in the following piece of code(fourth line)? > import re > print(re.sub('[ABC]', '*', 'XAXAXBXBXCXC')) > print(re.sub('[ABC]_', '*', 'XA-XA_XB-XB_XC-XC_')) > print(re.sub('(.) spam', 'spam\\1', 'x spam, y spam')) > def mapper(matchobj): >

Re: Combining lists to dictionary

2014-11-11 Thread Dave Angel
Ben Finney Wrote in message: > Denis McMahon writes: > >> Hi >> >> Given x,y are a lists of keys and value that I wish to combine to a >> dictionary, such that x[n] is the key for value y[n], which is preferred: >> >> z = {a:b for (a,b) in zip(x,y)} > > This one, with the caveat to use PEP-8 c

Re: __missing__ for the top-level Python script

2014-11-12 Thread Dave Angel
Chris Angelico Wrote in message: > On Mon, Nov 10, 2014 at 10:31 AM, Chris Angelico wrote: >> So the semantics should be: If NameError would be raised (not >> including UnboundLocalError, which still represents an error), attempt >> to import the absent name. If successful, continue as if it had

Re: Synchronizing a sound with a widget change

2014-11-13 Thread Dave Angel
"ast" Wrote in message: > > "ast" a écrit dans le message de > news:54648e75$0$12771$426a7...@news.free.fr... >> >> "ast" a écrit dans le message de >> news:54648d03$0$1981$426a7...@news.free.fr... >> >>> >>> I have the idea to run an other thread to emit the sound, but I didn't try >>> yet.

Re: Synchronizing a sound with a widget change

2014-11-13 Thread Dave Angel
"Yimr Zero" Wrote in message: > body { line-height: 1.5; }blockquote { margin-top: 0px; margin-bottom: 0px; > margin-left: 0.5em; }body { font-size: 10.5pt; font-family: 'Segoe UI'; > color: rgb(0, 0, 0); line-height: 1.5; } > Hi, > You may try to add the sleep(5) after the color change statemen

Re:python on android: where to start

2014-11-14 Thread Dave Angel
maurog Wrote in message: > I looked at the newsgroup, but I didn't find recent infos on this topic. > On the other side I went lost by looking for this topic with google. So > I'm asking you my question, if I want to develop or run some code with > python on android, what are the resources to s

Re:Strange result with timeit execution time measurment

2014-11-15 Thread Dave Angel
"ast" Wrote in message: > Hi > > I needed a function f(x) which looks like sinus(2pi.x) but faster. > I wrote this one: > > -- > from math import floor > > def sinusLite(x): > x = x - floor(x) > return -16*(x-0.25)**2 + 1 if x < 0.5 else 16*(x-0.75)**2 - 1 >

Re:Where is inspect() located?

2014-11-15 Thread Dave Angel
Igor Korot Wrote in message: > Hi, ALL, > > C:\Documents and Settings\Igor.FORDANWORK\Desktop\winpdb>python > Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit > (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for more information. from a.b import c p

Re:How modules work in Python

2014-11-16 Thread Dave Angel
Abdul Abdul Wrote in message: > Hello, > > I'm new to Python, and just have a small question, and thought you might have > an idea on it. You should start any new thread with a specification of the versions of software you're asking about. Since you didn't, I'll assume python version 2.7, P

Re:import math error

2014-11-16 Thread Dave Angel
You forgot to specify your Python version here. ryguy7272 Wrote in message: > When I type 'import math', it seems like my Python recognizes this library. > Great. When I try to run the following script, I get an error, which > suggests (to me) the math library is not working correctly. Noth

Re:from pylab import *

2014-11-16 Thread Dave Angel
Abdul Abdul Wrote in message: > I came across an example that uses "Matplotlib". > > It used the following import to use that module: > > from pylab import * > > When I tried to run the example, I got the following error: > > C:\Python27\python.exe > C:/Users/abc/PycharmProjects/ComputerVisio

Re: import os

2014-11-16 Thread Dave Angel
Abdul Abdul Wrote in message: > Thanks for your reply. Yes, I came across this page, but didn't understand > what is meant by the operating system dependent functionality. What does that > mean? Is importing that module that serious? > > Please don't top-post here. Add your comments after some

Re: How modules work in Python

2014-11-16 Thread Dave Angel
newsreader, use the mailing list, or manually fix the double spacing. Hundres of posts on here about it, just search out one of them) Abdul Abdul Wrote in message: > Dave, > > Thanks for your nice explanation. For your answer on one of my questions: > > >> Modules don't

Re: caught in the import web again

2014-11-17 Thread Dave Angel
"Charles T. Smith" Wrote in message: > Well, I guess that's the definitive answer... the tips for delaying > import are good, I'll try to leverage them. > > I was hoping there would be a way to have python postpone evaluation > similar to C's forward references. > In a module that might get ta

Re: caught in the import web again

2014-11-17 Thread Dave Angel
Ian Kelly Wrote in message: > On Mon, Nov 17, 2014 at 3:17 PM, Dave Angel wrote: >> In a module that might get tangled in a cycle, avoid global code >> that depends on other modules. Instead of putting such >> initialization at top level, put inside a function that gets

Re: caught in the import web again

2014-11-18 Thread Dave Angel
Ian Kelly Wrote in message: > On Mon, Nov 17, 2014 at 6:20 PM, Dave Angel wrote: >> Ian Kelly Wrote in message: >>> On Mon, Nov 17, 2014 at 3:17 PM, Dave Angel wrote: >> >>>> In a module that might get tangled in a cycle, avoid global code >>>

Re: caught in the import web again

2014-11-18 Thread Dave Angel
Chris Angelico Wrote in message: > On Wed, Nov 19, 2014 at 6:09 AM, Dave Angel wrote: >> I once worked on (and then >> fixed) a build system that could not complete a build from clean. >> It needed some pieces from a previous build in order to get to >> the point

Re:scipy shape

2014-11-18 Thread Dave Angel
Abdul Abdul Wrote in message: > I came across an example that starts as follows: > > from scipy.ndimage import filters > img = zeros(im.shape) > > What does the second line mean here? Is it setting the image pixels to zero? > What is "shape" here? > This example is incomplete. Neither zeros n

Help with an 8th grade science project

2014-11-20 Thread dave em
n example for calculating the factorial of 10 is our program gives: Execution time = ', 1.5703258514404297 I presume this is telling us it took 1.57 seconds to complete the calculation? Thanks in advance for any help / suggestions. Best regards, Dave -- https://mail.python.org/mailman/listinfo/python-list

Re:Help with an 8th grade science project

2014-11-20 Thread Dave Angel
dave em Wrote in message: > Hello, > > I am the adult advisor (aka father) to an 8th grader who is doing a science > project that will compare / benchmark CPU performance between an AMD 64 > Phenom II running Ubuntu 14.04 and a Raspberry Pi 700MHz ARM. > > Basic procedu

Re: I have no class

2014-11-23 Thread Dave Angel
On 11/23/2014 05:52 AM, Seymore4Head wrote: On Sun, 23 Nov 2014 17:00:08 +1100, Chris Angelico wrote: 1) Python's namespacing rules mean that 'key' is a part of the RPS class, and can be referred to as 'self.key' or as 'RPS.key' 2) Use of 'self.key' for the textual form of the throw is shadow

Re: Challenge: optimizing isqrt

2014-11-23 Thread Dave Angel
On 11/21/2014 03:15 AM, Stephen Tucker wrote: On Thu, Nov 20, 2014 at 6:00 PM, Serhiy Storchaka wrote: On 01.11.14 03:29, Steven D'Aprano wrote: There is an algorithm for calculating the integer square root of any positive integer using only integer operations: Here is my optimized im

Re: I have no class

2014-11-23 Thread Dave Angel
On 11/23/2014 10:54 AM, Seymore4Head wrote: On Sun, 23 Nov 2014 10:16:28 -0500, Dave Angel wrote: On 11/23/2014 05:52 AM, Seymore4Head wrote: On Sun, 23 Nov 2014 17:00:08 +1100, Chris Angelico wrote: 1) Python's namespacing rules mean that 'key' is a part of the RPS cl

Re: python 2.7 and unicode (one more time)

2014-11-23 Thread Dave Angel
On 11/23/2014 01:13 PM, random...@fastmail.us wrote: On Sun, Nov 23, 2014, at 11:33, Dennis Lee Bieber wrote: Why would that be possible? Many truetype fonts only supply glyphs for single-byte encodings (ISO-Latin-1, for example -- pop up the Windows character map utility and see what so

Re: I have no class

2014-11-23 Thread Dave Angel
On 11/23/2014 11:21 PM, Steven D'Aprano wrote: In some of these languages, the use of "this/self/me" is optional, but I'm not aware of *any* OOP language where there is no named reference to the current object at all. The case I found astounding in C++ was in the initializer list where the l

Re: I have no class

2014-11-23 Thread Dave Angel
On 11/24/2014 12:11 AM, Dave Angel wrote: On 11/23/2014 11:21 PM, Steven D'Aprano wrote: In some of these languages, the use of "this/self/me" is optional, but I'm not aware of *any* OOP language where there is no named reference to the current object at all. The case I

Re: FW: Unexpexted behaviot of python operators on list

2014-11-25 Thread Dave Angel
On 11/25/2014 04:23 AM, PANDEY2 Archana (MORPHO) wrote: Hello Welcome. This is apparently your first post, or at least first for quite a while. Note that this is a text forum (usenet, mailing list), and doesn't properly support either html messages nor attachments. Just tell your mailer

Re: Dictionary error

2014-11-25 Thread Dave Angel
On 11/25/2014 04:34 AM, Thuruv V wrote: Please Clarify the 'TypeError: zip argument #1 must support iteration' import openpyxl book = openpyxl.load_workbook('c:/users/c_thv/desktop/tax.xlsx') sheet = book.get_sheet_by_name('Thilip') cell = sheet.cell(row=2,column = 4) i = 2 x = [] y = []while

Re: Challenge: optimizing isqrt

2014-11-25 Thread Dave Angel
On 11/25/2014 02:31 PM, Serhiy Storchaka wrote: п'ятниця, 21-лис-2014 08:15:57 ви написали: This looks very good indeed. As a matter of interest, is there any particular reason you have used 2*b instead of b+b? Might b+b be faster than b*2? Yes, it is slightly faster, but the effect is indisce

Re: GUI toolkit(s) status

2014-11-26 Thread Dave Cook
for a project that was required to run on win32 and OS X, and for some reason my layout, wich was fine under win32, was screwed up on OS X. I switched back to wxpython 3.0, which looks very good under OS X. Dave Cook -- https://mail.python.org/mailman/listinfo/python-list

Re: Where is path.py?

2014-11-27 Thread Dave Angel
On 11/27/2014 09:10 AM, David Aldrich wrote: Hi I am running Python 2.7 on Windows 8.1. Today I installed path.py using easy_install: easy_install path.py The example code that I've seen imports path.py as follows: from path import path I am fairly new to Python and have a f

Re: Can you use self in __str__

2014-11-27 Thread Dave Angel
On 11/27/2014 08:26 PM, Seymore4Head wrote: def __str__(self): s = "Hand contains " for x in self.hand: s = s + str(x) + " " return s This is part of a Hand class. I need a hand for the dealer and a hand for the player. dealer=Hand() player=Hand()

Re: Can you use self in __str__

2014-11-28 Thread Dave Angel
On 11/27/2014 10:31 PM, Seymore4Head wrote: On Thu, 27 Nov 2014 21:49:29 -0500, Dave Angel wrote: class Hand: def __init__(self): self.hand = [] # create Hand object def __str__(self): s = 'Hand contains ' for x in self.hand:

Re: Can you use self in __str__

2014-11-28 Thread Dave Angel
On 11/27/2014 08:43 PM, Chris Angelico wrote: On Fri, Nov 28, 2014 at 12:26 PM, Seymore4Head wrote: dealer=Hand() player=Hand() This prints out 'Hand contains " foo bar for both the dealer's hand and the player's hand. Is there a way to include "self" in the __string__ so it reads Dealer hand

Re: Iterate over text file, discarding some lines via context manager

2014-11-28 Thread Dave Angel
On 11/28/2014 10:04 AM, fetchinson . wrote: Hi all, I have a feeling that I should solve this by a context manager but since I've never used them I'm not sure what the optimal (in the python sense) solution is. So basically what I do all the time is this: for line in open( 'myfile' ): if n

Re: Iterate over text file, discarding some lines via context manager

2014-11-28 Thread Dave Angel
On 11/28/2014 11:01 AM, Ned Batchelder wrote: On 11/28/14 10:22 AM, Dave Angel wrote: On 11/28/2014 10:04 AM, fetchinson . wrote: Hi all, I have a feeling that I should solve this by a context manager but since I've never used them I'm not sure what the optimal (in the python sense

Re: Iterate over text file, discarding some lines via context manager

2014-11-28 Thread Dave Angel
Please don't start a new thread when responding to an existing topic. Just reply-List to the message you're responding to, and include some context from that message. On 11/28/2014 12:06 PM, ast wrote: Hi Here is a solution with a custom iterator which operate on files. I tested it with a sma

Re: Python handles globals badly.

2014-12-02 Thread Dave Angel
On 12/02/2014 11:32 PM, Skybuck Flying wrote: Some issues I'd like to address to you: 1. Structured programming requires more programming time. 2. Structured programming implies structure which might be less flexible. 3. Python objects require "self" keyword to be used everywhere, and other akwa

Re: Looking for download link for ArcPY

2014-12-03 Thread Dave Angel
On 12/02/2014 05:48 PM, sravan kumar wrote: Can I find where Arcpy.exe to download in order to use for my course work I don't know the package. But it shouldn't be hard to find. Go to duckduckgo.com (or google, if that's your preference) type arcpy in the search box One of the result lin

Re: About Modifying Globals

2014-12-04 Thread Dave Angel
On 12/04/2014 03:09 PM, LJ wrote: Hi All, I have a quick question regarding the modification of global variables within functions. To illustrate, consider the following toy example: a={"1": set()} b=9 def gt(l): a["1"] = a["1"] | set([l]) When calling this last function and checking the

Re: time.monotonic() roll over

2014-12-04 Thread Dave Angel
On 12/04/2014 07:39 PM, Steven D'Aprano wrote: Marko Rauhamaa wrote: So, if I call time.sleep(86400) and the program is suspended for 24 hours, should time.sleep() return right after it is resumed or after another 24 hours? If the program is suspended, then no time should pass for that prog

Re: time.monotonic() roll over

2014-12-04 Thread Dave Angel
On 12/04/2014 09:54 PM, Steven D'Aprano wrote: Dave Angel wrote: On 12/04/2014 07:39 PM, Steven D'Aprano wrote: Marko Rauhamaa wrote: So, if I call time.sleep(86400) and the program is suspended for 24 hours, should time.sleep() return right after it is resumed or after anothe

Re: help with processing text file

2014-12-04 Thread Dave Angel
On 12/04/2014 11:46 PM, C. Ng wrote: Hi, Given the sample text file below (where the gibberish represent the irrelevant portions) : abcddsdfffgfg ggfhghghgfhghgh round 5 xccdcxcfd sdfdffdfbcvcvbbvnghg score = 0.4533 abcddsdfffgfg round 5 level = 0.15 ggfhghghgfhghgh round 10 dfsdf

Re: Tabs for indentation & Spaces for alignment in Python 3?

2014-12-05 Thread Dave Angel
On 12/05/2014 09:48 PM, Aahan Krish wrote: Hello Ned, I didn't notice that he was using tabs more than as needed for indentation. Guess I trusted the wrong guy. :P Anyway, it's one more thing to keep in mind. G! Several times now you have started a new thread to comment on an existing one

Re: module import questions and question about pytest and module imports

2014-12-07 Thread Dave Angel
On 12/05/2014 11:50 PM, sam pendleton wrote: garage/ |- __init__.py |- cars/ |- __init__.py |- hummer.py tests/ |- test_cars.py at the top of test_cars.py, there is this: from garage.cars import hummer pytest is on this import statement, so i guess it's inc

Re: Setting default_factory of defaultdict to key

2014-12-07 Thread Dave Angel
On 12/05/2014 03:51 PM, John J Posner wrote: At the beginning of this thread, Ian Kelly said: Since this clearly is intended to be part of the earlier thread, please make it so by using reply-list or whatever equivalent your email program has. Not with defaultdict, but you can subcla

Re: Nested dictionaries from a list ?

2014-12-07 Thread Dave Angel
On 12/07/2014 11:18 AM, Wacky wrote: New to Python, so please go easy. I've a list of users, who have different profiles on different computers. How to tackle this through lists and dictionaries? Here is the data example. More interested in learning how to declare this structure and add/delete/

Re: Setting default_factory of defaultdict to key

2014-12-07 Thread Dave Angel
On 12/07/2014 11:43 AM, Shiyao Ma wrote: On Dec 07 at 11:31 -0500, Dave Angel wrote: Since this clearly is intended to be part of the earlier thread, please make it so by using reply-list or whatever equivalent your email program has. Kinda OT. But interested what's the difference be

Re: module import questions and question about pytest and module imports

2014-12-08 Thread Dave Angel
On 12/07/2014 11:50 AM, sam pendleton wrote: Thanks for getting back with me! On Sun, Dec 7, 2014 at 11:26 AM, Dave Angel wrote: On 12/05/2014 11:50 PM, sam pendleton wrote: garage/ |- __init__.py |- cars/ |- __init__.py |- hummer.py tests

Re: Nested dictionaries from a list ?

2014-12-08 Thread Dave Angel
On 12/07/2014 06:52 PM, Denis McMahon wrote: On Sun, 07 Dec 2014 12:01:26 -0500, Dave Angel wrote: On 12/07/2014 11:18 AM, Wacky wrote: I've a list of users I haven't run this through the Python, so please forgive any typos. users = [ mess = { users is red

Re: When do default parameters get their values set?

2014-12-08 Thread Dave Angel
On 12/08/2014 05:10 PM, bSneddon wrote: I ran into an issue setting variables from a GUI module that imports a back end module. My approach was wrong obviously but what is the best way to set values in a back end module. To answer the subject line, the default parameter(s) are evaluated whe

Re: Maintaining Maximum Line Length When Using Tabs Instead of Spaces?

2014-12-08 Thread Dave Angel
On 12/08/2014 03:20 PM, sohcahto...@gmail.com wrote: On Sunday, December 7, 2014 6:26:01 PM UTC-8, jtan wrote: One reason why you would want max length 79 is because of working with terminals. Maybe ssh to you server and check how many spaces are consumed by a tab? In my boxes, it is usua

Re: Question on lambdas

2014-12-09 Thread Dave Angel
On 12/09/2014 02:15 AM, memilanuk wrote: On 12/08/2014 09:30 PM, Ben Finney wrote: memilanuk writes: ... lambda: update_label2('A', 100) would this work the same? (I don't know what you mean here by “the same”; the same as what?) The above creates a new function, which expects no paramete

Re: encrypt the http request url on the local machine

2014-12-09 Thread Dave Angel
On 12/09/2014 07:43 AM, iMath wrote: 在 2014年12月9日星期二UTC+8下午2时58分36秒,iMath写道: my software on the local machine needs to send http request to a specific web server , is there any way to protect the http request url from being found by Packet analyzer software like Wireshark and fiddler. The seve

Re: module import questions and question about pytest and module import

2014-12-09 Thread Dave Angel
To: sam pendleton On 12/07/2014 11:50 AM, sam pendleton wrote: > Thanks for getting back with me! > > On Sun, Dec 7, 2014 at 11:26 AM, Dave Angel wrote: >> On 12/05/2014 11:50 PM, sam pendleton wrote: >>> >>> garage/ >>> |- __init__.py >&

Re: Nested dictionaries from a list ?

2014-12-09 Thread Dave Angel
To: Denis McMahon On 12/07/2014 06:52 PM, Denis McMahon wrote: > On Sun, 07 Dec 2014 12:01:26 -0500, Dave Angel wrote: > >> On 12/07/2014 11:18 AM, Wacky wrote: > >>> I've a list of users > >> I haven't run this through the Python, so please for

Re: When do default parameters get their values set?

2014-12-09 Thread Dave Angel
To: bSneddon On 12/08/2014 05:10 PM, bSneddon wrote: > I ran into an issue setting variables from a GUI module that imports a back end module. My approach was wrong obviously but what is the best way to set values in a back end module. > To answer the subject line, the default parameter(s) ar

Re: Maintaining Maximum Line Length When Using Tabs Instead of Spaces?

2014-12-09 Thread Dave Angel
To: sohcahto...@gmail.com On 12/08/2014 03:20 PM, sohcahto...@gmail.com wrote: >> > > On Sunday, December 7, 2014 6:26:01 PM UTC-8, jtan wrote: >> One reason why you would want max length 79 is because of working with terminals. Maybe ssh to you server and check how many spaces are consumed by

Re: Text Code(from 'Getting Started in Beautiful Soup' re: cd Soup , returns 'Syntax Error, invalid syntax'

2014-12-11 Thread Dave Angel
Please give your environment when starting a new thread. Python version and OS version. In this case, I'm guessing Windows, because I have to guess something to give a meaningful answer. On 12/11/2014 02:21 PM, Simon Evans wrote: At the start of Chapter 3 of 'Getting Started in Beautiful Sou

Re: Text Code(from 'Getting Started in Beautiful Soup' re: cd Soup , returns 'Syntax Error, invalid syntax'

2014-12-11 Thread Dave Angel
On 12/11/2014 02:40 PM, Chris Angelico wrote: On Fri, Dec 12, 2014 at 6:34 AM, Dave Angel wrote: Please give your environment when starting a new thread. Python version and OS version. In this case, I'm guessing Windows, because I have to guess something to give a meaningful answer.

Re: Bug? Feature? setattr(foo, '3', 4) works!

2014-12-19 Thread Dave Angel
On 12/19/2014 06:40 AM, Cem Karan wrote: I'm bringing this discussion over from the python-ideas mailing list to see what people think. I accidentally discovered that the following works, at least in Python 3.4.2: class foo(object): ... pass ... setattr(foo, '3', 4) dir(foo) ['3', '__c

Re: Changing script's search path at install time

2014-12-19 Thread Dave Angel
On 12/19/2014 05:51 PM, Mitko Haralanov wrote: Hi all, I have a question regarding installation of Python scripts and modules using distutils that I can't find an answer to by searching through Google and the Python website. Hopefully, someone on this list might have ideas? I am writing a Pytho

Re: very weird pandas behavior

2014-12-21 Thread Dave Angel
On 12/21/2014 07:44 AM, ryguy7272 wrote: On Saturday, December 20, 2014 10:46:40 AM UTC-5, ryguy7272 wrote: I downloaded pandas and put it in my python directory, then, at the C-prompt, I ran this: "pip install pandas" Thanks Steven. I just tried what you recommended, and got this. import

Re: very weird pandas behavior

2014-12-21 Thread Dave Angel
On 12/21/2014 08:01 PM, ryguy7272 wrote: On Saturday, December 20, 2014 10:46:40 AM UTC-5, ryguy7272 wrote: I downloaded pandas and put it in my python directory, then, at the C-prompt, I ran this: "pip install pandas" It looks like everything downloaded and installed fine. Great. Now, in Py

Re: very weird pandas behavior

2014-12-22 Thread Dave Angel
On 12/22/2014 10:55 AM, ryguy7272 wrote: I just uninstalled Python and deleted 15 Python books that I found online. AH! I feel great That's the way i felt when I uninstalled Windows. It's better not to not have something installed that you won't run. Likewise

Encryption - was Hello World

2014-12-22 Thread Dave Angel
On 12/22/2014 12:25 PM, Chris Angelico wrote: There's one exception. Writing your own crypto is a bad idea if that means reimplementing AES... but if you want something that's effective on completely different levels, sometimes it's best to write your own. I had a project a while ago that needed

Re: Program calling unwanted functions

2014-12-22 Thread Dave Angel
On 12/22/2014 02:55 PM, Luke Tomaneng wrote: Hello to all those in this forum, Hello. When starting a thread, please tell us your environment. In this case, it would be the python version and OS. My code seems to have a mind of its own. I have been writing a program to reenact the "

Re: what is wrong with d.clear()?

2014-12-22 Thread Dave Angel
On 12/22/2014 04:19 PM, sohcahto...@gmail.com wrote: On Monday, December 22, 2014 12:54:55 PM UTC-8, Rick Johnson wrote: On Monday, December 22, 2014 12:16:03 PM UTC-6, sohca...@gmail.com wrote: On Monday, December 22, 2014 12:16:15 AM UTC-8, shawool wrote: [snip: OP's adolescent accessorizing

Re: Encryption - was Hello World

2014-12-22 Thread Dave Angel
On 12/22/2014 05:29 PM, Chris Angelico wrote: On Tue, Dec 23, 2014 at 6:57 AM, Dave Angel wrote: I figure I must be misunderstanding something in your explanation, since a brute-force password guesser would seem to only need four billion tries to (probably) crack that. As to the

Re: TypeError: unhashable type: 'list'

2014-12-22 Thread Dave Angel
On 12/22/2014 06:10 PM, ronald.kevin.bur...@gmail.com wrote: I am getting an exception that the traceback looks like: Traceback (most recent call last): File "C:\Projects\QA\robot_20141103\resources\assessment_utilities.py", line 2

Re: Program calling unwanted functions

2014-12-22 Thread Dave Angel
On 12/22/2014 06:48 PM, Ian Kelly wrote: On Dec 22, 2014 2:37 PM, "Dave Angel" wrote: I'll pick on one function first, called instructions(). If the user types something invalid, you print "Invalid input." and call the function again. In this case, because the ca

Re: what is wrong with d.clear()?

2014-12-22 Thread Dave Angel
On 12/22/2014 09:33 PM, Steven D'Aprano wrote: Dave Angel wrote: Or even better: Don't use html email for forum messages. It frequently messes up the colors, the font, the formatting (like indentation), or even prevents some people from even seeing and/or replying to the message

Re: Select method of Range class failed

2014-12-23 Thread Dave Angel
On 12/23/2014 06:04 AM, Jaydeep Patil wrote: Hi all, I have developed python code which copy & paste data from one excel sheet to another excel sheet. I have compiled code both for 32 bit & 64 bit. It is working fine on 64 bit machine. But on 32 bit, it is giving below error. rng.Select() "Se

Re: what is wrong with d.clear()?

2014-12-23 Thread Dave Angel
On 12/23/2014 07:59 AM, shawool wrote: Thank you for answering my query. Fonts and colors are reset to defaults now. Sorry for the inconvenience caused. Regards, Shawool The following is a piece of your message: Thank you for answering my query.Fonts and colors are reset to defaults now. Sor

question on string object handling in Python 2.7.8

2014-12-24 Thread Dave Tian
, Dave -- https://mail.python.org/mailman/listinfo/python-list

Re: Program calling unwanted functions

2014-12-24 Thread Dave Angel
On 12/22/2014 07:04 PM, sohcahto...@gmail.com wrote: def test(t): ... print(t) ... test(t+1) ... test(1) 1 2 3 4 998 999 Traceback (most recent call last): File "", line 1, in File "", line 3, in test File "", line 3, in test File "", line 3, in test File "", line 3,

Re: question on string object handling in Python 2.7.8

2014-12-24 Thread Dave Angel
On 12/23/2014 08:28 PM, Dave Tian wrote: Hi, Hi, please do some things when you post new questions: 1) identify your Python version. In this case it makes a big difference, as in Python 2.x, the range function is the only thing that takes any noticeable time in this code. 2) when

Re: Searching through more than one file.

2014-12-28 Thread Dave Angel
On 12/28/2014 12:27 PM, Seymore4Head wrote: I need to search through a directory of text files for a string. Here is a short program I made in the past to search through a single text file for a line of text. How can I modify the code to search through a directory of files that have different fi

Re: Searching through more than one file.

2014-12-28 Thread Dave Angel
On 12/28/2014 02:12 PM, Dave Angel wrote: On 12/28/2014 12:27 PM, Seymore4Head wrote: I need to search through a directory of text files for a string. Here is a short program I made in the past to search through a single text file for a line of text. How can I modify the code to search through

Re: Python 2.7 segfaults on 'import site'

2014-12-29 Thread Dave Angel
On 12/29/2014 09:33 AM, Chris Angelico wrote: rosuav@sikorsky:~$ python -S Python 2.7.3 (default, Mar 13 2014, 11:03:55) [GCC 4.7.2] on linux2 rosuav@sikorsky:~$ python Segmentation fault This is the system Python on Debian Wheezy, and I haven't changed site.py at all. This broke some time in

Re: Python console rejects an object reference, having made an object with that reference as its name in previous line

2015-01-04 Thread Dave Angel
On 01/04/2015 07:49 AM, Simon Evans wrote: Dear Michael Torrie, Thanks for pointing that out to me re: it not being a syntax problem. The thing is there is a file called 'EcologicalPyramid.html'. I put it in a folder called 'Soup' as the text advised on page 28. For what its worth I also shifted

Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Dave Angel
On 01/06/2015 05:27 AM, Andrew Robinson wrote: Hi, I'm building a custom numeric class that works with values that have uncertainty and am wanting to make it as compatible with floating point objects as possible -- so as to be usable in legacy code with minimal rewites; but but I am having troubl

Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Dave Angel
On 01/06/2015 08:30 AM, Andrew Robinson wrote: So, I'm not sure I can subclass boolean either because that too is a built in class ... but I'm not sure how else to make an object that acts as boolean False, but can be differentiated from false by the 'is' operator. It's frustrating -- what go

Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Dave Angel
On 01/06/2015 09:01 PM, Andrew Robinson wrote: On 01/06/2015 06:02 AM, Dave Angel wrote: On 01/06/2015 08:30 AM, Andrew Robinson wrote: So, I'm not sure I can subclass boolean either because that too is a built in class ... but I'm not sure how else to make an object that acts

Re: Comparisons and sorting of a numeric class....

2015-01-06 Thread Dave Angel
On 01/06/2015 10:37 PM, Andrew Robinson wrote: On 01/06/2015 06:31 PM, Chris Angelico wrote: I already KNOW that 'C++' does have a workaround mechanism, as I've mentioned in a different e-mail, so that there's no reason to instantiate an instance of the subclass of a singleton if you don't w

Re: String character encoding when converting data from one type/format to another

2015-01-07 Thread Dave Angel
On 01/07/2015 06:04 AM, Jacob Kruger wrote: I'm busy using something like pyodbc to pull data out of MS access .mdb files, and then generate .sql script files to execute against MySQL databases using MySQLdb module, but, issue is forms of characters in string values that don't fit inside

Re: String character encoding when converting data from one type/format to another

2015-01-07 Thread Dave Angel
On 01/07/2015 08:32 AM, Jacob Kruger wrote: Thanks. Please don't top-post. Put your responses after each quoted part you're responding to. And if there are parts you're not responding to, please delete them. Issue with knowing encoding could just be that am pretty sure at least some of the

Re: String character encoding when converting data from one type/format to another

2015-01-07 Thread Dave Angel
On 01/07/2015 08:38 AM, Jacob Kruger wrote: Thanks. Makes more sense now, and yes, using 2.7 here. Unfortunately, while could pass the binary values into blob fields well enough, using forms of parameterised statements, the actual generation of sql script text files is a step they want to work

Re: Playing with threads

2015-01-07 Thread Dave Angel
On 01/07/2015 09:00 PM, Ganesh Pal wrote: Hi friends, I'm trying to use threads to achieve the below work flow 1. Start a process , while its running grep for a string 1 2. Apply the string 1 to the command in step 1 and exit step 2 3. Monitor the stdout of step1 and print success if the is pa

Re: Decimals and other numbers

2015-01-08 Thread Dave Angel
On 01/08/2015 09:33 PM, Devin Jeanpierre wrote: I noticed some very PHP-ish behavior today: import decimal x = 0 y = float(x) z = decimal.Decimal(x) x == y == z == x True x ** x 1 y**y 1.0 z**z Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.7/decimal

Re: Array of hash table

2015-01-08 Thread Dave Angel
On 01/09/2015 02:17 AM, jyoti690sa...@gmail.com wrote: Hello, Can any one tell me how to create graph={ "nodes": [ { "id": "n0", "label": "A node", "x": 0, "y": 0, "size": 3 }, { "id": "n1", "label": "Another node",

Re: Decimals and other numbers

2015-01-08 Thread Dave Angel
On 01/09/2015 02:37 AM, Chris Angelico wrote: On Fri, Jan 9, 2015 at 6:28 PM, Marko Rauhamaa wrote: Devin Jeanpierre : If 0**0 is defined, it must be 1. You can "justify" any value a within [0, 1]. For example, choose y(a, x) = log(a, x) Then, limy(a, x) = 0 x -> 0+ and

Re: Generate jpg files using line length (pixels) and orientation (degrees)

2015-01-09 Thread Dave Angel
On 01/09/2015 04:51 PM, semeon.ri...@gmail.com wrote: On Friday, 9 January 2015 12:18:46 UTC-6, Joel Goldstick wrote: On Fri, Jan 9, 2015 at 12:49 PM, wrote: (double-spaced nonsense mostly trimmed) i = 0 a = [] b = [] What are a and b supposed to contain? Please use more informative

Re: Python : writing to a file

2015-01-10 Thread Dave Angel
On 01/10/2015 10:14 AM, Ganesh Pal wrote: Please provide you input on the below questions: For each new thread, you should specify at a minimum your Python version and OS. it frequently matters, and it's better to specify than to have everyone try to guess. I'll assume Python 2.7 and Linux

Re: Syntax error

2015-01-10 Thread Dave Angel
On 01/10/2015 04:36 PM, Abdul Abdul wrote: Hello, I have the following program that employs the dcm2jpg.exe software: import os os.system(“dcm2jpg.exe IM-0004-0004.dcm”) exit When I tried to run it, I got the following error: SyntaxError: Non-ASCII character '\xe2' in file dicomjpg.py on line

Re: Python : writing to a file

2015-01-11 Thread Dave Angel
at, Jan 10, 2015 at 9:07 PM, Dave Angel wrote: I did execute the program multiple times, It appeared that it was not working because I was trying to view the contents of the file using cat commad and cat didn't display the data. case (a) output with cat: node- 1# file test_2.txt test_2.

Re: Few Coding suggestions - resending

2015-01-11 Thread Dave Angel
On 01/11/2015 06:47 AM, Ganesh Pal wrote: Hello Team, Iam trying to generate a file which should have the contents in the below format # cat /root/schedule.conf Sunday 10:20 10:30 Sunday 10:30 10:40 Sunday 10:50 10:60 I have to build the above format on the local linux machine using pytho

Re: Generate jpg files using line length (pixels) and orientation (degrees)

2015-01-11 Thread Dave Angel
On 01/11/2015 02:41 PM, semeon.ri...@gmail.com wrote: On Saturday, 10 January 2015 21:31:25 UTC-6, Denis McMahon wrote: # using lists of values for length in a: for orientation in b: makeimg(length, orientation) -- Denis McMahon, denismfmcma...@gmail.com The code is working c

Re: Python 3 regex woes (parsing ISC DHCPD config)

2015-01-12 Thread Dave Angel
On 01/12/2015 01:20 PM, Jason Bailey wrote: Hi all, What changed between 1:03 and 1:20 that made you post a nearly identical second message, as a new thread? Unfortunately, I get no matches. From output on the command line, I can see that Python is adding extra backslashes to my re.compil

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\ua000' in position 0: ordinal not in range(128)

2015-01-14 Thread Dave Angel
On 01/13/2015 10:26 PM, Peng Yu wrote: Hi, First, you should always specify your Python version and OS version when asking questions here. Even if you've been asking questions, many of us cannot keep track of everyone's specifics, and need to refer to a standard place, the head of the cur

<    9   10   11   12   13   14   15   16   17   18   >