Re: Find and Replace Simplification

2013-07-19 Thread Dave Angel
On 07/19/2013 05:44 PM, Devyn Collier Johnson wrote: On 07/19/2013 12:22 PM, Steven D'Aprano wrote: On Fri, 19 Jul 2013 09:22:48 -0400, Devyn Collier Johnson wrote: I have some code that I want to simplify. I know that a for-loop would work well, but can I make re.sub perform all of the below

Re: Share Code Tips

2013-07-19 Thread Dave Angel
On 07/19/2013 09:04 PM, Devyn Collier Johnson wrote: Chris Angelico said that casefold is not perfect. In the future, I want to make the perfect international-case-insensitive if-statement. For now, my code only supports a limited range of characters. Even with casefold, I will have s

Re: Find and Replace Simplification

2013-07-20 Thread Dave Angel
On 07/20/2013 01:03 PM, Joshua Landau wrote: On 20 July 2013 12:57, Serhiy Storchaka wrote: 20.07.13 14:16, Joshua Landau написав(ла): However, some quick timing shows that translate has a very high penalty for missing characters and is a tad slower any way. Really, though, there sh

Re: Find and Replace Simplification

2013-07-20 Thread Dave Angel
On 07/20/2013 02:37 PM, Joshua Landau wrote: On 20 July 2013 19:04, Dave Angel wrote: On 07/20/2013 01:03 PM, Joshua Landau wrote: Still, it seems to me that it should be optimizable for sensible builtin types such that .translate is significantly faster, as there's no theoretical extra

Re: Beginner - GUI devlopment in Tkinter - Any IDE with drag and drop feature like Visual Studio?

2013-07-21 Thread Dave Cook
://qt-project.org/wiki/Packaging_PySide_applications_on_Windows Dave Cook -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginner - GUI devlopment in Tkinter - Any IDE with drag and drop feature like Visual Studio?

2013-07-21 Thread Dave Cook
y load the .ui files: http://srinikom.github.io/pyside-docs/PySide/QtUiTools/QUiLoader.html Dave Cook -- http://mail.python.org/mailman/listinfo/python-list

Re: How to read a make file in python and access its elements

2013-07-22 Thread Dave Angel
On 07/22/2013 03:09 PM, san wrote: How to read/load the cmake file in python and access its elements. I have a scenario, where i need to load the make file and access its elements. I have tried reading the make file as text file and parsing it,but its not the ideal solution Please let me know h

Re: how: embed + extend to control my running app?

2013-07-24 Thread Dave Angel
On 07/24/2013 08:51 PM, David M. Cotter wrote: update: okay so the python27.dll is in /windows/system32 so ignore that i've set my include directory correct, so i can compile i've set my "additional libraries" directory to the "libs" directory (where the ".lib" files are. (note: NOT including

Re: Creating a Simple User Interface for a Function

2013-07-25 Thread Dave Angel
On 07/25/2013 12:03 PM, CTSB01 wrote: I have the following code that runs perfectly: def psi_j(x, j): rtn = [] for n2 in range(0, len(x) * j - 2): n = n2 / j r = n2 - n * j rtn.append(j * x[n] + r * (x[n + 1] - x[n]))

Re: Creating a Simple User Interface for a Function

2013-07-25 Thread Dave Angel
On 07/25/2013 04:58 PM, CTSB01 wrote: Sorry Dave, to answer each part of your response: 1) I decided to use Python 2.7, and I will be sure to specify this in all future threads. 2) It is a list of positive integers. In fact, it is always going to be a list of positive increasing

Re: Critic my module

2013-07-27 Thread Dave Angel
On 07/27/2013 09:19 AM, Devyn Collier Johnson wrote: About the aliases, I have tried setting pwd() as an alias for "os.getcwd()", but I cannot type "pwd()" and get the desired output. Instead, I must type "pwd". I tested this in Guake running Python3.3. >>> os.getcwd() '/home/collier'

Re: Critic my module

2013-07-27 Thread Dave Angel
On 07/27/2013 08:56 AM, Devyn Collier Johnson wrote: Somehow during this thread, you have changed your purpose for this library. It used to be a library that Python programmers could import and use. And now, it's a shell replacement? The user runs the Python interpreter, and types

Re: Critic my module

2013-07-27 Thread Dave Angel
On 07/27/2013 12:32 PM, Alister wrote: On Sat, 27 Jul 2013 08:56:10 -0400, Devyn Collier Johnson wrote: Good point about the Made by/Copyright suggestion. Although, I have not copyrighted the file, can I still say "Copyrighted by ...".-- There is no special process to Copyright anything. the

Re: import syntax

2013-07-29 Thread Dave Angel
On 07/29/2013 03:48 PM, Devyn Collier Johnson wrote: The PEP8 recommends importing like this: import os import re not like this: import os, re Why is that? Is there a performance advantage to one of the styles? Pep 8 is not about performance, it's about readability. And unless the two l

Re: importing modules

2013-07-30 Thread Dave Angel
On 07/29/2013 05:57 PM, syed khalid wrote: I am attempting to import modules from Shogun to python from a non-standard python directory ie from my /home/xxx directory. is there a way on ubuntu to selectively some modules, scripts, data from one directory and others modules, scripts from another

Re: Is python a interpreted or compiled language?

2012-06-20 Thread Dave Angel
On 06/20/2012 07:30 PM, gmspro wrote: > Hi, > > Is python a interpreted or compiled language? > What does happen after this command: python f.py > > I knew python makes file.pyc file to store the bytecode. For java , .class > file is the bytecode file, someone can run that file from any machine. S

Re: Can parellelized program run slower than single process program?

2012-06-20 Thread Dave Angel
On 06/21/2012 01:05 AM, Yesterday Paid wrote: > from multiprocessing import Pool > from itertools import product > > def sym(lst): > x,y=lst > tmp=x*y > if rec(tmp): > return tmp > else: > return None > > def rec(num): > num=str(num) > if num == "".join(rever

Re: Strange threading behaviour

2012-06-21 Thread Dave Angel
On 06/21/2012 11:19 AM, Rotwang wrote: > Hi all, I'm using Python 2.7.2 on Windows 7 and a module I've written > is acting strangely. I can reproduce the behaviour in question with > the following: > > --- begin bugtest.py --- > > import threading, Tkinter, os, pickle > > class savethread(threading

Re: Strange threading behaviour

2012-06-21 Thread Dave Angel
On 06/21/2012 02:03 PM, Rotwang wrote: > On 21/06/2012 18:07, Dave Angel wrote: >> On 06/21/2012 11:19 AM, Rotwang wrote: >>> Hi all, I'm using Python 2.7.2 on Windows 7 and a module I've written >>> is acting strangely. I can reproduce the behavio

Re: cPickle - sharing pickled objects between scripts and imports

2012-06-23 Thread Dave Angel
On 06/23/2012 12:13 PM, Peter Otten wrote: > Rotwang wrote: > >> Hi all, I have a module that saves and loads data using cPickle, and >> I've encountered a problem. Sometimes I want to import the module and >> use it in the interactive Python interpreter, whereas sometimes I want >> to run it as a

Re: exception problem

2012-06-24 Thread Dave Angel
On 06/24/2012 06:30 PM, Charles Hixson wrote: > Sorry, I left out: > er$ python3 --version > Python 3.2.3rc1 > > On 06/24/2012 03:26 PM, Charles Hixson wrote: >> The code: >> print("pre-chunkLine") >> chunks=[] >> try: >>

Re: exception problem

2012-06-24 Thread Dave Angel
On 06/24/2012 07:16 PM, Charles Hixson wrote: > On 06/24/2012 03:43 PM, MRAB wrote: >> On 24/06/2012 23:26, Charles Hixson wrote: >>> >>> >>> >> Don't use a bare "except"; it'll catch _any__exception. Catch only what >> you expect. >> >> For all I know, it could be that the name "l" doesn't exist.

Re: Executing Python Scripts on Mac using Python Launcher

2012-06-26 Thread Dave Angel
On 06/26/2012 01:19 PM, David Thomas wrote: > I have installed Python 2.7.3 from Python.org also in Terminal it states that > I have 2.7.3. > How can I execute the script from Terminal? I've tried typing python into > the window and then dragging the file to terminal but I get a syntax error.

Re: Executing Python Scripts on Mac using Python Launcher

2012-06-26 Thread Dave Angel
(You forgot to include the list on this message, but I'm including them in my reply) On 06/26/2012 02:07 PM, David Thomas wrote: > > > On Tuesday, June 26, 2012 6:37:42 PM UTC+1, Dave Angel wrote: >> >> On 06/26/2012 01:19 PM, David Thomas wrote: >>>

Re: Executing Python Scripts on Mac using Python Launcher

2012-06-26 Thread Dave Angel
On 06/26/2012 03:16 PM, Hans Mulder wrote: > > > Python is an executable, and is > typically located in a "bin" directory. To find out where > it is, type > > type python > > at the shell prompt (that's the first prompt you get if you > open a Terminal window). > > That's a typo. You presu

Re: Executing Python Scripts on Mac using Python Launcher

2012-06-26 Thread Dave Angel
On 06/26/2012 05:48 PM, Hans Mulder wrote: > On 26/06/12 22:41:59, Dave Angel wrote: > > No, I meant: $ type python python is > /Library/Frameworks/Python.framework/Versions/2.7/bin/python 'type' is > a bash builtin that tells you how bash would interpret a command

Re: how can I implement "cd" like shell in Python?

2012-06-28 Thread Dave Angel
On 06/28/2012 05:30 AM, 梦幻草 wrote: > how can I implement "cd" like shell in Python? > import os os.chdir("newdirectory") But the more important question is why you want to. Inside a Python program, many people find that changing directory causes unexpected difficulties, and they simply keep tra

Re: I can't send images to this mail-list

2012-06-29 Thread Dave Angel
On 06/29/2012 06:59 PM, Dennis Lee Bieber wrote: > On Fri, 29 Jun 2012 21:13:09 +0100, Mark Lawrence > declaimed the following in > gmane.comp.python.general: > >> On 29/06/2012 16:26, Ethan Furman wrote: >>> Ben Finney wrote: Chris Angelico writes: > ??? wrote: >> why can't I sen

Re: [ANN] IPython 0.13 is officially out!

2012-07-01 Thread Dave Cook
p install --upgrade ipython Dave Cook -- http://mail.python.org/mailman/listinfo/python-list

Re: code review

2012-07-03 Thread Dave Angel
On 07/03/2012 12:05 PM, Mark Lawrence wrote: > On 03/07/2012 16:53, Chris Angelico wrote: >> On Wed, Jul 4, 2012 at 1:50 AM, Mark Lawrence >> wrote: >>> On 03/07/2012 03:25, John O'Hagan wrote: On Tue, 3 Jul 2012 11:22:55 +1000 I agree to some extent, but as a counter-example,

Re: locals().update(...)

2012-07-04 Thread Dave Angel
On 07/04/2012 07:56 AM, eis...@gmail.com wrote: > I expected this to work: > > > def f(**args): > locals().update(args) > print locals() > print a > > d=dict(a=1) > > f(**d) > > but: >> global name 'a' is not defined > Where is my mistake? Chris has given you the place where it's docum

Re: what's the effect of cmp here?

2012-07-10 Thread Dave Angel
On 07/10/2012 11:01 AM, levi nie wrote: > what's the effect of cmp here? The bList and cList is the same at last. > > code: > aList=[3,2,5,4] > > bList=aList[:] > bList.sort() > print "bList is",bList > > cList=aList[:] > cList.sort(cmp) > print "cList is",cList > > The main effect is for the read

Re: introduction and first question about multithreading

2012-07-12 Thread Dave Angel
On 07/11/2012 03:51 AM, Vojtěch Polášek wrote: > Greetings, > My name is Vojta and I am blind student. I am slowly learning Python for > about 4 years and I like it alot, mostly its ability to run on various > platforms. > My primary system is Ubuntu 12.04, but I have Windows XP at hand. I am > usi

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Dave Angel
On 07/17/2012 07:01 AM, Lipska the Kat wrote: > > > Anyway, I'm looking at Python as a rapid prototyping language. > I have an idea and just want to get it down in basic outline code as > quickly as possible before it departs my aging brain... I'm not used > to using variables without declaring th

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Dave Angel
On 07/18/2012 08:58 AM, Steven D'Aprano wrote: > > > > 2) To check your internal reasoning in a function or method. > > For example: > > def foo(something): > n = len(something) > x = math.sqrt(x) > # We expect that x must be less than half of n. > # E.g. n=100 gives 10 < 50, whic

Re: Need help connecting via a remote VPN

2012-07-18 Thread Dave Angel
On 07/18/2012 09:36 PM, The Coca Cola Kid wrote: > I need to connect to a site/server that's only accessible after > logging into a remote VPN, then scan a directory for a file pattern > and then copy those files. I know how to do the latter using glob, > and I think I figured out how to connect t

Re: shutil ignore fails on passing a tuple?

2012-07-19 Thread Dave Angel
On 07/19/2012 12:43 PM, Alex van der Spek wrote: > This beats me: > ipatterns > ('*.txt', '*.hdf', '*.pdf', '*.png') igf = shutil.ignore_patterns(ipatterns) ignorethis = igf(ddftopdir,os.listdir(ddftopdir)) > > > Why does it fail on passing in a tuple of ignore

Re: best way to handle this in Python

2012-07-19 Thread Dave Angel
On 07/19/2012 07:51 PM, Rita wrote: > Hello, > > I have data in many files (/data/year/month/day/) which are named like > YearMonthDayHourMinute.gz. > > I would like to build a data structure which can easily handle querying the > data. So for example, if I want to query data from 3 weeks ago till

Re: Need help connecting via a remote VPN

2012-07-19 Thread Dave Angel
On 07/19/2012 09:41 PM, The Coca Cola Kid wrote: > "Dave Angel" wrote in message > news:mailman.2284.1342663213.4697.python-l...@python.org... > >> Starting a VPN simply makes it possible for IP packets to get to the >> specified machine. You still need

Sudden doubling of nearly all messages

2012-07-21 Thread Dave Angel
Has anybody else noticed the sudden double-posting of nearly all messages in the python mailing list? Previously, I've seen some messages double posted, and it was nearly always a newbie, presumably posting via some low-end gateway. But now i'm noticing nearly every message appears twice, identic

Re: Sudden doubling of nearly all messages

2012-07-21 Thread Dave Angel
On 07/21/2012 07:05 AM, Andrew Berg wrote: > On 7/21/2012 5:48 AM, Dave Angel wrote: >> Has anybody else noticed the sudden double-posting of nearly all >> messages in the python mailing list? > I am also using the mailing list, but I haven't experienced this. Well, my own m

Re: A thread import problem

2012-07-21 Thread Dave Angel
On 07/21/2012 10:54 AM, Bruce Sherwood wrote: > Thanks much for this suggestion. I'm not sure I've correctly > understood the operation "start_new_thread(lambda: __import__( module>), ())". By "your module" do you mean the user program which > imported the module that will execute start_new_thread?

Re: Sudden doubling of nearly all messages

2012-07-21 Thread Dave Angel
On 07/21/2012 06:48 AM, Dave Angel wrote: > Has anybody else noticed the sudden double-posting of nearly all > messages in the python mailing list? > > Previously, I've seen some messages double posted, and it was nearly > always a newbie, presumably posting via some low-e

Re: My first ever Python program, comments welcome

2012-07-21 Thread Dave Angel
On 07/21/2012 03:08 PM, Lipska the Kat wrote: > Greetings Pythoners > > A short while back I posted a message that described a task I had set > myself. I wanted to implement the following bash shell script in Python > You already have comments from Ian and MRAB, and I'll try to point out only thin

Re: A thread import problem

2012-07-21 Thread Dave Angel
On 07/21/2012 04:36 PM, Bruce Sherwood wrote: > Thanks much for this clear statement. I hadn't managed to find any > documentation on this specific issue. > > Bruce Sherwood > > On Sat, Jul 21, 2012 at 10:26 AM, Dave Angel wrote: >> Two of the things you mustn&#

Re: A thread import problem

2012-07-21 Thread Dave Angel
On 07/21/2012 05:35 PM, Bruce Sherwood wrote: > On Sat, Jul 21, 2012 at 2:53 PM, Dave Angel wrote: >> >> For docs on the threading thing, see: >> >> http://docs.python.org/library/threading.html >> >> " ... an import should not have the side effect

Re: Sudden doubling of nearly all messages

2012-07-21 Thread Dave Angel
On 07/21/2012 08:13 PM, Steven D'Aprano wrote: > On Sat, 21 Jul 2012 06:48:29 -0400, Dave Angel wrote: > >> Has anybody else noticed the sudden double-posting of nearly all >> messages in the python mailing list? > No I have not. > > It sounds like a problem wit

Re: My first ever Python program, comments welcome

2012-07-21 Thread Dave Angel
On 07/21/2012 09:56 PM, MRAB wrote: > On 22/07/2012 01:32, Steven D'Aprano wrote: >> On Sat, 21 Jul 2012 20:40:46 +0100, MRAB wrote: >> >>> On 21/07/2012 20:08, Lipska the Kat wrote: l=sorted(l, key=itemgetter(0)) >>> >>> Short is: >>> >>> l.sort(key=itemgetter(0)) >> >> Shorter, and

Re: Sudden doubling of nearly all messages

2012-07-22 Thread Dave Angel
On 07/22/2012 05:30 AM, Alan Ristow wrote: > On 07/21/2012 12:48 PM, Dave Angel wrote: >> Has anybody else noticed the sudden double-posting of nearly all >> messages in the python mailing list? > [snip] >> I'm using Thunderbird 14.0 on Linux 11.04, with mail configur

Re: Converting a list of strings into a list of integers?

2012-07-22 Thread Dave Angel
On 07/22/2012 11:29 AM, Tony the Tiger wrote: > Hi, > Is there such a thing in the language, or do I have to invent it myself? > > I came up with the following: > > # options.modus_list contains, e.g., "[2,3,4]" > # (a string from the command line) > > > > So which is it, a list of strings, o

Re: python package confusion

2012-07-23 Thread Dave Angel
On 07/23/2012 06:02 AM, Lipska the Kat wrote: > Hello again pythoners > > I'm trying to understand the python package stuff > > I have the following directory > > /home/lipska/python/dev/mods > > In this directory I have two files, both executable > > -- > > #! /usr/bin/env pyth

Re: the meaning of rユ.......�¾

2012-07-23 Thread Dave Angel
On 07/23/2012 09:06 AM, Chris Angelico wrote: > On Mon, Jul 23, 2012 at 10:55 PM, Roy Smith wrote: >> Some day, we're going to have programming languages that take advantage >> of the full unicode character set. Right now, we're working in ASCII >> and creating silly digrams/trigrams like r'' for

Re: How to deal with python 32bit memory error

2012-07-24 Thread Dave Angel
On 07/24/2012 04:06 AM, Sammy Danso wrote: > Hello Experts, > I am having a 'memory error', Please post the actual error message. > which suggest that I > have run out of memory, but I am not sure this is the case as I have > considerable amount of memory unused on my computer. What OS, vers

Re: catch UnicodeDecodeError

2012-07-25 Thread Dave Angel
On 07/25/2012 08:09 AM, jaroslav.dob...@gmail.com wrote: > On Wednesday, July 25, 2012 1:35:09 PM UTC+2, Philipp Hagemeister wrote: >> Hi Jaroslav, >> >> you can catch a UnicodeDecodeError just like any other exception. Can >> you provide a full example program that shows your problem? >> >> This w

Re: pexcept module

2012-07-26 Thread Dave Angel
On 07/25/2012 07:29 AM, Pritam Das wrote: > Is dere any good tutorial for pexcept module. > > As far as I can tell, there's no such module in the standard library. If you're talking about some 3r4 party product, it'd be polite to specify which one. Try: http://pexpect.sourceforge.net/pexpect.h

Re: why the different output in Eclipse and Python Shell?

2012-08-01 Thread Dave Angel
On 08/01/2012 12:45 AM, levi nie wrote: > my code in Eclipse: > > dict.fromkeys(['China','America']) > print "dict is",dict > > output: dict is > > my code in Python Shell: > > dict.fromkeys(['China','America']) > > output:{'America': None, 'China': None} > > Output in Python Shell is what i wanna

Re: why the different output in Eclipse and Python Shell?

2012-08-01 Thread Dave Angel
On 08/01/2012 11:26 AM, Prasad, Ramit wrote: >>> my code in Eclipse: >>> >>> dict.fromkeys(['China','America']) >>> print "dict is",dict >>> >>> output: dict is >>> >>> my code in Python Shell: >>> >>> dict.fromkeys(['China','America']) >>> >>> output:{'America': None, 'China': None} >>> >>> Outpu

Re: attribute is accessed from Nonetype

2012-08-02 Thread Dave Angel
On 08/02/2012 06:28 AM, Shanth Kumar wrote: > Hi ,All, > I am Shanthkumar. Good to see the mailing list for python programmers. Welcome to the list. > Please find my query below, > > In my source code in a python file e.g xyz.py couple of classes are defined > also there is a wrapper class, a non

Re: Error help

2012-08-02 Thread Dave Angel
On 08/02/2012 06:58 AM, danielashi...@googlemail.com wrote: > Hi all > > This error has been bugging me for days. I know it's minor, but it's really > getting in the way of my programming. I'm programming a data analysis > programme for a psychology experiment which takes pickled data from the >

Re: attribute is accessed from Nonetype

2012-08-03 Thread Dave Angel
On 08/03/2012 03:01 AM, Prasad, Ramit wrote: >> Also, please use the names correctly and consistently. The None object >> (yes, there is only one) is not the same as a none object. And there is >> no standard type called Nonetype. > To be fair, this is not very clear to a beginner. > len(No

Re: attribute is accessed from Nonetype

2012-08-03 Thread Dave Angel
On 08/03/2012 06:41 PM, Chris Angelico wrote: > On Sat, Aug 4, 2012 at 8:20 AM, Dave Angel wrote: >> I'm sorry, what's not clear? Nonetype is not the same as NoneType. >> Python is case sensitive. > There isn't a NoneType either. I get a NameError. > >

Re: attribute is accessed from Nonetype

2012-08-03 Thread Dave Angel
On 08/03/2012 09:35 PM, Steven D'Aprano wrote: > On Fri, 03 Aug 2012 19:03:20 -0400, Dave Angel wrote: > >> On 08/03/2012 06:41 PM, Chris Angelico wrote: >>> On Sat, Aug 4, 2012 at 8:20 AM, Dave Angel wrote: >>>> I'm sorry, what's not clear? None

Re: Is there a clever way to pass arguments

2012-08-08 Thread Dave Angel
On 08/08/2012 08:41 PM, bruceg113...@gmail.com wrote: > Is there a way in Python to pass arguments without listing each argument? > For example, my program does the following: > > testData (z[0], z[1], z[2], z[3], z[4], z[5], z[6], z[7]) > > Is there a clever way to pass arguments in a single s

Re: socketserver.BaseRequestHandler and socketserver.StreamRequestServer docs

2012-08-09 Thread Dave Angel
On 08/09/2012 02:37 PM, lipska the kat wrote: > On 09/08/12 18:39, Dennis Lee Bieber wrote: >> On Thu, 09 Aug 2012 16:15:33 +0100, lipska the kat >> declaimed the following in >> gmane.comp.python.general: >> >> >>> in the examples in this chapter we see usage examples for >>> socketserver.BaseRe

Re: no data exclution and unique combination.

2012-08-09 Thread Dave Angel
On 08/09/2012 04:06 PM, giuseppe.amatu...@gmail.com wrote: > > > print unique > {(4, 5): 1, (5, 4): 1, (4, 4): 2, (2, 3): 1, (4, 3): 2} > > I choose this solution because i could not install "from collections import > Counter". Nothing to install, at least for Python 2.7. collections is in the

Re: save dictionary to a file without brackets.

2012-08-09 Thread Dave Angel
On 08/09/2012 05:34 PM, Roman Vashkevich wrote: > Actually, they are different. > Put a dict.{iter}items() in an O(k^N) algorithm and make it a hundred > thousand entries, and you will feel the difference. > Dict uses hashing to get a value from the dict and this is why it's O(1). Sure, that's wh

Re: save dictionary to a file without brackets.

2012-08-09 Thread Dave Angel
On 08/09/2012 06:03 PM, Andrew Cooper wrote: > On 09/08/2012 22:34, Roman Vashkevich wrote: >> Actually, they are different. >> Put a dict.{iter}items() in an O(k^N) algorithm and make it a hundred >> thousand entries, and you will feel the difference. >> Dict uses hashing to get a value from the

Re: save dictionary to a file without brackets.

2012-08-09 Thread Dave Angel
On 08/09/2012 06:54 PM, Andrew Cooper wrote: > On 09/08/2012 23:26, Dave Angel wrote: >> On 08/09/2012 06:03 PM, Andrew Cooper wrote: >>> On 09/08/2012 22:34, Roman Vashkevich wrote: >>>> Actually, they are different. >>>> Put a dict.{iter}items() in

Re: save dictionary to a file without brackets.

2012-08-09 Thread Dave Angel
On 08/09/2012 06:53 PM, Chris Angelico wrote: > On Fri, Aug 10, 2012 at 8:26 AM, Dave Angel wrote: >> On 08/09/2012 06:03 PM, Andrew Cooper wrote: >>> O(n) for all other entries in the dict which suffer a hash collision >>> with the searched entry. >>> >>

Re: save dictionary to a file without brackets.

2012-08-09 Thread Dave Angel
On 08/09/2012 08:16 PM, Tim Chase wrote: > On 08/09/12 18:33, Mark Lawrence wrote: >> On 10/08/2012 00:24, Roy Smith wrote: ... you mean, Python lets you make a hash of it? >>> Only if you order it with spam, spam, spam, spam, spam, spam, and spam. >> Now now gentlemen we're getting slightly o

Re: [newbie] A question about lists and strings

2012-08-10 Thread Dave Angel
On 08/10/2012 05:19 AM, Mok-Kong Shen wrote: > > In an earlier question about lists, I was told about the issue of > creation of local names in a function. However, I still can't > understand why the program below outputs: > > [999] sss > [999] > > and not two identical lines of output. For both op

Re: [newbie] A question about lists and strings

2012-08-10 Thread Dave Angel
On 08/10/2012 06:12 AM, Mok-Kong Shen wrote: > Am 10.08.2012 11:48, schrieb Roman Vashkevich: >> [snip] > >The function It takes list by reference and creates a new local > > str. When it's called with listb and strb arguments, listb is passed > > by reference and mutated. A string "sss" is co

Re: [newbie] A question about lists and strings

2012-08-10 Thread Dave Angel
On 08/10/2012 06:31 AM, Mok-Kong Shen wrote: > Am 10.08.2012 12:07, schrieb Dave Angel: > [snip] >> At this point, in top-level code, the listb object has been modified, >> and the strb one has not; it still is bound to the old value. > > This means there is no way of m

Re: [newbie] A question about lists and strings

2012-08-10 Thread Dave Angel
hat "5," is a one-element tuple >>>> a > (1, 2, 3, 4, 5) >>>> b > (1, 2, 3, 4) > > > By the way: > > On Fri, Aug 10, 2012 at 8:07 PM, Dave Angel wrote: >> But if you said c=651 and d=651, you'd have two >> objects, and the t

Re: [newbie] A question about lists and strings

2012-08-10 Thread Dave Angel
On 08/10/2012 06:48 AM, Mok-Kong Shen wrote: > Am 10.08.2012 12:40, schrieb Chris Angelico: > >> But it's probably worth thinking about exactly why you're wanting to >> change that string, and what you're really looking to accomplish. >> There may well be a better way. > > My problem is the followi

Re: dictionary into desired variable....

2012-08-10 Thread Dave Angel
On 08/10/2012 10:02 AM, Tamer Higazi wrote: > Hi! > suppose you have a dictionary that looks like this: > > x = [1,3,6,1,1] which should represent a certain other variable. > > in reality it would represent: > > y[1][3][6][1][1] > > Now, how do I write a python routine, that points in this dictiona

Re: Unable to execute the script

2012-08-10 Thread Dave Angel
On 08/10/2012 01:14 PM, Smaran Harihar wrote: > Hi, > > I have set executable permissions for my py script (cgi-script) but for > some reason rather than executing it, the browser simply downloads the py > script. > > Here is the > link

Re: Keep getting this in PyDev "TypeError: quiz() takes exactly 1 argument (0 given)"

2012-08-10 Thread Dave Angel
On 08/10/2012 02:52 PM, Chuck wrote: > Hi all, I cannot figure why I keep getting this error. It is my > understanding that all methods need a self argument when designing a class. > Here is my code: It'd be much more useful if you'd actually quote the entire error. > import random > > class El

Re: Unable to execute the script

2012-08-10 Thread Dave Angel
You posted privately to me, so I'm sending it back to the list. Don't forget to do reply-all, or equivalent. On 08/10/2012 02:44 PM, Smaran Harihar wrote: > Is the location of this script acceptable to your web host? > > How can I check that? By asking your web host tech support, or reading the

Re: Keep getting this in PyDev "TypeError: quiz() takes exactly 1 argument (0 given)"

2012-08-10 Thread Dave Angel
On 08/10/2012 04:28 PM, Chuck wrote: > Thanks for the help guys! I finally got it working. Shouldn't I technically > call quiz() through the constructor, though? Otherwise, the constructor is > pointless. > > Thanks again! > What language did you use before trying Python? Was it java, by

Re: set and dict iteration

2012-08-16 Thread Dave Angel
On 08/16/2012 02:00 PM, Aaron Brady wrote: > Hello, > > I observed an inconsistency in the behavior of 'set' and 'dict' iterators. > It is "by design" according to the docs. > > ''' > http://docs.python.org/dev/library/stdtypes.html#dict-views > > iter(dictview). Iterating views while adding or

Re: Verify the integrity of the tar file with tarfile module?

2012-08-16 Thread Dave Angel
On 08/16/2012 10:51 AM, Ramchandra Apte wrote: > Just opening the file may not create an error. > You have to read some files to check for errors. You have no context in front of your message, and it's not a reply to anything existing. So it must be top-posted. Try again. -- DaveA -- http

Re: [ANNC] pybotwar-0.8

2012-08-16 Thread Dave Angel
On 08/16/2012 10:37 AM, Ramchandra Apte wrote: > nah.. "war" sounds better than "contest" Top-posting yet again? -- DaveA -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I display unicode value stored in a string variable using ord()

2012-08-16 Thread Dave Angel
On 08/16/2012 06:09 PM, Charles Jensen wrote: > Everyone knows that the python command > > ord(u'…') > > will output the number 8230 which is the unicode character for the horizontal > ellipsis. > > How would I use ord() to find the unicode value of a string stored in a > variable? > > So

Re: set and dict iteration

2012-08-16 Thread Dave Angel
On 08/16/2012 05:26 PM, Paul Rubin wrote: > Dave Angel writes: >> Everything else is implementation defined. Why should an implementation >> be forced to have ANY extra data structure to detect a static bug in the >> caller's code? > For the same reason the interpre

Re: Crashes always on Windows 7

2012-08-17 Thread Dave Angel
On 08/17/2012 09:38 AM, zmagi...@gmail.com wrote: > Hi, > > Downloaded ActiveSync ActivePython on my Windows 7 machine. Worked for a > little while and now it crashes every time I try to boot the IDLE or open a > program, it crashes. Help please? Thanks I'm not aware of any boot option for Windo

Re: How do I display unicode value stored in a string variable using ord()

2012-08-17 Thread Dave Angel
On 08/17/2012 02:45 PM, wxjmfa...@gmail.com wrote: > Le vendredi 17 août 2012 20:21:34 UTC+2, Jerry Hill a écrit : >> >> >> I don't understand what any of this has to do with Python. Just >> >> output your text in UTF-8 like any civilized person in the 21st >> >> century, and none of that is a pr

Re: How do I display unicode value stored in a string variable using ord()

2012-08-17 Thread Dave Angel
On 08/17/2012 08:21 PM, Ian Kelly wrote: > On Aug 17, 2012 2:58 PM, "Dave Angel" wrote: >> The internal coding described in PEP 393 has nothing to do with latin-1 >> encoding. > It certainly does. PEP 393 provides for Unicode strings to be represented > internally a

Re: New internal string format in 3.3

2012-08-19 Thread Dave Angel
On 08/19/2012 08:14 AM, wxjmfa...@gmail.com wrote: > Le dimanche 19 août 2012 12:26:44 UTC+2, Chris Angelico a écrit : >> On Sun, Aug 19, 2012 at 8:19 PM, wrote: >> >>> This is precicely the weak point of this flexible >>> representation. It uses latin-1 and latin-1 is for >>> most users simply u

Re: New internal string format in 3.3

2012-08-19 Thread Dave Angel
(pardon the resend, but I accidentally omitted a couple of words) On 08/19/2012 08:14 AM, wxjmfa...@gmail.com wrote: > Le dimanche 19 août 2012 12:26:44 UTC+2, Chris Angelico a écrit : >> >> >> >> No, it uses Unicode, and as an optimization, attempts to store the >> codepoints in less than four by

Re: How does .rjust() work and why it places characters relative to previous one, not to first character - placed most to left - or to left side of screen?

2012-08-19 Thread Dave Angel
On 08/19/2012 12:25 PM, crispy wrote: > > So I have guessed, that characters processed by .rjust() function, are placed > in output, relative to previous ones - NOT to first, most to left placed, > character. rjust() does not print to the console, it just produces a string. So if you want to k

Re: How do I display unicode value stored in a string variable using ord()

2012-08-19 Thread Dave Angel
On 08/19/2012 01:03 PM, Blind Anagram wrote: > "Steven D'Aprano" wrote in message > news:502f8a2a$0$29978$c3e8da3$54964...@news.astraweb.com... > > On Sat, 18 Aug 2012 01:09:26 -0700, wxjmfauth wrote: > > [...] > If you can consistently replicate a 100% to 1000% slowdown in string > handling, plea

Re: How to set the socket type and the protocol of a socket using create_connection?

2012-08-20 Thread Dave Angel
On 08/20/2012 11:04 AM, Guillaume Comte wrote: > > Because I work on a network emulator and I want to check biterros patterns so > I need to access the data of the packets. An dsince my test program is > written in Python, it's easier to do it in Python. You should look up scapy. http://www.s

Re: Why does dynamic doc string do not work?

2012-08-21 Thread Dave Angel
On 08/21/2012 12:44 PM, Miki Tebeka wrote: > >>> class B: > ... '''a {} string'''.format('doc') > ... B.__doc__ > I wonder why the first B docstring is empty. Thanks, -- Miki According to some early documentation: "convenient initialization of the |__doc__| attribute of modu

Re: asking

2012-08-21 Thread Dave Angel
On 08/22/2012 12:17 AM, Ian Foote wrote: > Oops, hopefully this with indent correctly: > > def all_in(string, substrings): > for substring in substrings: > if substring not in string: > return False > return True The POP's question was ambiguous (did he want to match an

Re: asking

2012-08-22 Thread Dave Angel
On 08/22/2012 03:17 AM, mingqiang hu wrote: > I mean any of "a","b","c" in string "adfbdfc" makes the statement true,can > I not use a function? suppose I got lots of substring let's say > s1="a",s2="b",s3="c" ...,not wrap them as a tuple or a list , just make the > statement as simple as possibl

Re: Objects in Python

2012-08-22 Thread Dave Angel
On 08/22/2012 11:25 AM, shaun wrote: > Here is some code: > //This is the object I want to create: > #!/usr/bin/python > import cx_Oracle > import sys > import time > import datetime > > > class batchParam: > > def __init__(self,array): > self.array=arra

Re: PyCrypto builds neither with MSVC nor MinGW

2012-08-22 Thread Dave Angel
On 08/22/2012 02:21 PM, bikewave wrote: > I also had the unresolved externals problem (not the mdir.h problem, though) > and my solution was different. > a) reinstall correct python2.6.4, using an Intel-flavor msi vice > AMD64-flavor > b) source the c:\program files(x86\microsoft visual studio > 9.

Re: writelines puzzle

2012-08-22 Thread Dave Angel
On 08/22/2012 02:00 PM, William R. Wing (Bill Wing) wrote: > On Aug 22, 2012, at 12:48 PM, Chris Kaynor wrote: > >> Reading your post, I do not see for sure what your actual issue is, so >> I am taking my best guess: that the file does not contain as much data >> as would be expected. >> > Sorry,

python-list@python.org

2012-08-24 Thread Dave Angel
On 08/24/2012 12:39 PM, rusi wrote: > On Aug 24, 8:58 pm, rusi wrote: >> >> Your posts are coming in doubles. >> And the quoted lines are coming double-spaced! > Just saw other double-posts > So checked the mailing list archive which does not seem to have them. > > So please ignore my double-pos

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