Functions that raise exceptions.

2008-06-25 Thread Alex G
Does anyone know how I would go about conditionally raising an exception in a decorator (or any returned function for that matter)? For example: def decorator(arg): def raise_exception(fn): raise Exception return raise_exception class some_class(object): @raise_exception d

Re: Functions that raise exceptions.

2008-06-25 Thread Alex G
whoops! The code should be: def decorator(arg):     def raise_exception(fn):       raise Exception   return raise_exception class some_class(object):     @decorator('meaningless string')     def some_method(self):         print "An exception should be raised when I'm called, but not when I'm

Re: Functions that raise exceptions.

2008-06-25 Thread Alex G
I'm sorry about the typos, but that doesn't seem to be what the issue is (I typed it into the textbox rather carelessly, I apologize :-( ). It seems to be an issue with passing the decorator an argument: Given: def decorator(arg): def raise_exception(fn): raise Exception return ra

HTTP request error with urlopen

2008-07-02 Thread spandana g
Hello , I have written a code to get the page source of the google search page .. this is working for other urls. I have this problem with import re from urllib2 import urlopen string='http://www.google.com/search?num=20&hl=en&q=ipod&btnG=Search' file_source=file("google_source.txt",'w'

HTTP request error with urlopen

2008-07-03 Thread spandana g
Hello , I have written a code to get the page source of the google search page .. this is working for other urls. I have this problem with import re from urllib2 import urlopen string='http://www.google.com/search?num=20&hl=en&q=ipod&btnG=Search' file_source=file("google_source.txt",'w'

Fwd: Hello

2008-07-17 Thread spandana g
b2.urlopen(req).read() its still giving the error mentioned above .. Iam accessing the yahoo search engine .. link is "http://search.yahoo.com/search?n=20&p=ipod"; I'm attaching the python file i have written just have a look and suggest me something that works for this query

Re: Game design : Making computer play

2008-04-14 Thread Carl G.
oves that have been shown to be be superior (this speeds up the computer's response). Carl G. -- http://mail.python.org/mailman/listinfo/python-list

Re: DO NOT USE JAVA BECAUSE IT IS NOT OPEN SOURCE

2006-04-06 Thread Dean G.
to be sure. I will need to solder together my own devices, as even though the patents have expired, the old devices are still encumbered by trademarks. I'll get back to you in 20 years after I have removed the last traces of evil intellectual property from my life. So long commrad, Dean G. --

Beginner Q. interrogate html object OR file search?

2009-12-02 Thread Mark G
Hi all, I am new to python and don't yet know the libraries well. What would be the best way to approach this problem: I have a html file parsing script - the file sits on my harddrive. I want to extract the date modified from the meta-data. Should I read through lines of the file doing a string.f

Re: Beginner Q. interrogate html object OR file search?

2009-12-02 Thread Mark G
e the html file > parsing script you say you have already, or how the date is 'modified > from' the meta-data. > > On Wed, Dec 2, 2009 at 10:24 PM, Mark G wrote: > > Hi all, > > > I am new to python and don't yet know the libraries well. What would > >

Cannot send email

2010-07-15 Thread G F
A while back I was working for a company and set up a little python script to send out maintenance emails for some equipment we had set up in the field. The script collected information about the equipment composed an email and sent it out to interested persons. Then I left the company and they

Re: difference between raw_input() and input()

2009-08-22 Thread Juraj G.
if you prefix number with zero, it will turn into octal number... I too wasn't aware of it... at least in python :/ http://en.wikipedia.org/wiki/Octal It seems like bad practice to put zeroes before any decimal number in any language :) Juraj -- http://mail.python.org/mailman/listinfo/python-list

Example of exec_proxy

2010-09-27 Thread Prathibha G
Hi Team, I am very new to this python world. Below is my problem. I have a "Machine A" where i want to execute some commands(dos commands from command prompt), delete/create some files, delete/create some directories. All this i need to do from my local host. Is there a way which i can do? Can

Re: getting source code line of error?

2021-11-20 Thread Paolo G. Cantore
Am 20.11.21 um 20:15 schrieb Ulli Horlacher: Stefan Ram wrote: r...@zedat.fu-berlin.de (Stefan Ram) writes: except Exception as inst: print( traceback.format_exc() ) More to the point of getting the line number: As I wrote in my initial posting: I already have the line number. I am

for loop in python

2016-04-28 Thread g . v . aarthi
start_list = [5, 3, 1, 2, 4] square_list = [] # Your code here! for square_list in start_list: x = pow(start_list, 2) square_list.append(x) square_list.sort() print square_list TypeError: unsupported operand type(s) for ** or pow(): 'list' and 'int' Please provide me the solution for the

Re: Python help needed

2019-08-08 Thread Paolo G. Cantore
Am 08.08.19 um 01:18 schrieb MRAB: On 2019-08-07 21:36, Kuyateh Yankz wrote: #trying to write a function that takes a list value as an argument and returns a string with all the items separated by a comma and a space, with and inserted before the last item. For example, passing the previous sp

Re: How to create an Excel app that runs Python?

2020-03-24 Thread Paolo G. Cantore
On Tue, Mar 24, 2020, 4:45 PM wrote: I have the following scenario: I have created lots of python files that I use to calculate a Cashflow model, when I run these files I get a beautiful pandas DataFrame that contains my final model. My mission is to show this table to the rest of the compan

Re: How to create an Excel app that runs Python?

2020-03-28 Thread Paolo G. Cantore
Am 25.03.20 um 15:21 schrieb farayao...@gmail.com: Hello Paolo, Thanks for your reply, indeed now I'm thinking on building a web app, do you have any suggestions for this? I am thinking of using Tkinter, the method that you describe using HTML is also using Javascript? Kind Regards Felipe

Re: [Fwd: Re: hex string to hex value]

2005-11-22 Thread Brett g Porter
42) 66 >>> -- // Today's Oblique Strategy (© Brian Eno/Peter Schmidt): // Repetition is a form of change // Brett g Porter * [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Problem cmpiling M2Crypto

2005-11-29 Thread Thomas G. Apostolou
Hello all. i am trying to make some win32 binaries of M2Crypto 0.15 What I use is: Python 2.3.3 openssl-0.9.7i swigwin 1.3.27 I have build the openssl binaries and have installed the Swig binary python dir is C:\Program Files\Plone 2\Python openssl dir is c:\openssl Swig dir is c:\swig so I ha

Re: Problem cmpiling M2Crypto

2005-12-01 Thread Thomas G. Apostolou
or macros. building '__m2crypto' extension C:\SWIG\swig.exe -python -ISWIG -I"c:\openssl\include" -o SWIG/_m2crypto.c SWIG/_m2crypto.i SWIG\_lib.i(527): Error: Syntax error in input(1). error: command 'swig.exe' failed with exit status 1 any help would be n

Re: Problem cmpiling M2Crypto

2005-12-01 Thread Thomas G. Apostolou
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thomas G. Apostolou wrote: > > >> C:\Program Files\Plone 2\Python\lib\distutils\extension.py:128: > > UserWarning: > >> Unknown Extension options: 'swig_opts' &g

Re: Problem cmpiling M2Crypto

2005-12-02 Thread Thomas G. Apostolou
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thomas G. Apostolou wrote: > > > I still get the error: > > "SWIG/_m2crypto.c(80) : fatal error C1083: Cannot open include file: > > 'Python.h': No such file or di

Re: Problem cmpiling M2Crypto under Plone

2005-12-02 Thread Thomas G. Apostolou
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thomas G. Apostolou wrote: > > > So what you say is that the Python installed with Plone doesn't have > > Python.h in ./include but Python installers from Python.org do have

Problem patching SimpleXMLRPCServer.py

2005-12-06 Thread Thomas G. Apostolou
access private attribute "%s"' % i ) else: obj = getattr(obj,i) return obj def list_public_methods(obj): """Returns a list of attribute strings, found in the specified object, which represent callable attributes"""

Re: Problem patching SimpleXMLRPCServer.py

2005-12-06 Thread Thomas G. Apostolou
Its ok now, it seems the problem was that i had saved the file in UTF-8 format ??? I got it again and saved it in Greek(ISO) format and it now goes fine "Thomas G. Apostolou" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello all, > I use Python

Question about start using ZServerSSL on win box...

2005-12-07 Thread Thomas G. Apostolou
2\Zope\bin" Do i HAVE to reinstall Plone and set it not to run as service? Thank you in advance... Thomas G. Apostolou -- http://mail.python.org/mailman/listinfo/python-list

Re: Mutability of function arguments?

2005-12-07 Thread Brett g Porter
erwise". If you're trying to return multiple values from a function, Python lets you do that >>> def multiFoo(x, y, z): ... return x*2, y*2, z*2 ... >>> x = 1 >>> y = 2 >>> z = 3 >>> x, y, z = multiFoo(x, y, z) >>> x 2 >>> y 4 >>> z 6 >>> -- // Today's Oblique Strategy (© Brian Eno/Peter Schmidt): // Repetition is a form of change // Brett g Porter * [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: PHP = Perl Improved

2005-12-09 Thread Thomas G. Marshall
Roedy Green said something like: > On 9 Dec 2005 11:15:16 -0800, "Xah Lee" <[EMAIL PROTECTED]> wrote, quoted > or indirectly quoted someone who said : > >> recently i got a project that involves the use of php. In 2 days, i >> read almost the entirety of the php doc. Finding it a breeze because it

An interesting python problem using Zope 2.7.3

2005-02-05 Thread ranjith g p
Greetings!!! I ran the following simple string commands in Linux + Python and the results are: [EMAIL PROTECTED] root]# python Python 2.2.2 (#1, Feb 24 2003, 19:13:11) [GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>

Re: How to compare files

2005-07-01 Thread Brett g Porter
e > different( eventhough without '\n' are the same) > > Thanks for help. > LAd. > Have you looked at the difflib module that comes with Python? http://docs.python.org/lib/module-difflib.html -- // Today's Oblique Strategy (© Brian Eno/Peter Schmidt): // Change

Re: Defending Python

2005-07-13 Thread Brett g Porter
he "It's" man) in _The First 20 Years of Monty Python_ by Kim "Howard" Johnson (St. Martin's Press, 1989), p.20 -- // Today's Oblique Strategy (© Brian Eno/Peter Schmidt): // Change instrument roles // Brett g Porter * [EMAIL PROTECTED] // http://bgporter.inknoise.com/JerseyPorkStore -- http://mail.python.org/mailman/listinfo/python-list

Re: First Script Problem

2005-09-16 Thread Brett g Porter
. And at the end of the last > loops do I somehow have to set my mySet to NULL? Any ideas here? > > -- > edward hotchkiss > > > > > > # Script to Evaluate every possible IP Address Combo, then write it to a > text file > # 9/15/05 >

Re: How to turn a variable name into a string?

2005-03-11 Thread Paolo G. Cantore
Hi Stewart, what about the other way, string -> var and not var -> string? My suggestion: mylist = ["a", "b", "c"] for my in mylist: if locals()[my] == None: print "you have a problem with %s" % my Paolo Stewart Midwinter wrote: I'd like to do something like the following: a = 1; b = 2; c

Re: dot products

2004-12-20 Thread Alan G Isaac
[Rahul]. > I want to compute dot product of two vectors stored as lists a and b.a > and b are of the same length from scipy import dot ans=dot(a,b) This times faster than the alternatives I have seen mentioned so far, given scipy. Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/

Re: dot products

2004-12-20 Thread Alan G Isaac
"Alan G Isaac" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > This times faster than the alternatives I have seen mentioned so far, > given scipy. Actually, since I am new to 'timeit', I probably should check that I am not overlooking something. Es

Re: Is this a good use for lambda

2004-12-20 Thread Alan G Isaac
I need a clarification of the argument. Are the opponents saying that I should not be able to: def compose(list_of_functions): return reduce(lambda f, g: lambda x: f(g(x)), list_of_functions) In a nutshell: why? And may I see the proposed "better" replacement for function compositio

Re: Is this a good use for lambda

2004-12-21 Thread Alan G Isaac
So as I understand it, so far the "best" proposal for a replacement of my function-composition function uses a (compatibility reducing) Python 2.4 feature that Nick suggests will end up on "Gotcha" lists. Hmmm: lambda is looking pretty good, I'd say. The readability issue is valid, of course. Bu

New to Tkinter...

2005-04-19 Thread Peter G Carswell
Good Morning. I am new to Tkinter. I have been testing the installation of Tkinter through the python web site. The first two test steps give no errors, 'import _tkinter' and 'import Tkinter'. However, the third step, 'Tkinter._test', gives the error: An

Re: New to Tkinter...

2005-04-19 Thread Peter G Carswell
Eric Brunel wrote: On Tue, 19 Apr 2005 09:35:03 -0400, Peter G Carswell <[EMAIL PROTECTED]> wrote: Good Morning. I am new to Tkinter. I have been testing the installation of Tkinter through the python web site. The first two test steps give no errors, 'import _tkinter' and

Re: New to Tkinter...

2005-04-19 Thread Peter G Carswell
.py", line 3118, in _test label = Label(root, text=text) File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 2285, in __init__ Widget.__init__(self, master, 'label', cnf, kw) File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 1780, in __init__ self.tk.cal

Fwd: os.statvfs bug or my incompetence ?

2011-10-14 Thread Peter G. Marczis
 Hi list, I'm happy to join to this nice mail list. At my company we use python to handle system administration tasks. I found the next problem during my work: test.py: # cat test.py #!/usr/bin/python import os os.statvfs('/') r

Re: Fwd: os.statvfs bug or my incompetence ?

2011-10-17 Thread Peter G. Marczis
Hi, not yet, I will check it today, thanks for the idea ! We may have some deeper problem... Br, Peter. On 10/15/2011 05:46 PM, ext Kev Dwyer wrote: Peter G. Marczis wrote: Hello Peter, Welcome to the list. Have you tried calling statvfs from a C program? What happens if you do? Best

Re: Question about start using ZServerSSL on win box...

2005-12-13 Thread Thomas G. Apostolou
After reading and searching for a while i found that all about running ZService as service start from C:\Program Files\Plone 2\Data\bin\zopeservice.py But still i cannot fully understand where the server is called so that i replace it with z2s.py or what ever needed... Any ideas? "Tho

Re: Pattern matching with string and list

2005-12-13 Thread Brett g Porter
BartlebyScrivener wrote: > Even without the marker, can't you do: > > sentence = "the fabric is red" > colors = ["red", "white", "blue"] > > for color in colors: > if (sentence.find(color) > 0): > print color, sentence.find(color) > That depends on whether you're only looking for who

Re: Xah's Edu Corner: Examples of Quality Technical Writing

2005-12-18 Thread Thomas G. Marshall
Lars Rune Nøstdal said something like: > hi, > everyone thinks youreoay faggot and that youreh stupid .. now go > fugkght yourselfes > > peasse out .. yo! Idiot. -- http://mail.python.org/mailman/listinfo/python-list

Re: URL 'special character' replacements

2006-01-09 Thread Brett g Porter
'/~connolly/'. unquote_plus(string) Like unquote(), but also replaces plus signs by spaces, as required for unquoting HTML form values. -- // Today's Oblique Strategy (© Brian Eno/Peter Schmidt): // Accretion // Brett g Porter * [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: String handling and the percent operator

2006-07-13 Thread Brett g Porter
Justin Azoff wrote: > Tom Plunket wrote: >> boilerplate = \ >> """ > [big string] >> """ >> >> return boilerplate % ((module,) * 3) >> [deletia...] > Of course.. > stuff = {'lang': 'python', 'page': 'typesseq-strings.html'} print """I should read the %(lang)s documentation at

Re: Python newbie needs constructive suggestions

2006-07-22 Thread David G. Wonnacott
Many thanks to those of you who responded to my question about anonymous functions with local variables, filling me in on e) do something else clever and Pythonic that I don't know about yet? by pointing out that I can use (among other good things) lambda with default arguments. That should sui

Re: random shuffles

2006-07-22 Thread David G. Wonnacott
From: "danielx" <[EMAIL PROTECTED]> Date: 22 Jul 2006 01:43:30 -0700 Boris Borcic wrote: > does > > x.sort(cmp = lambda x,y : cmp(random.random(),0.5)) > > pick a random shuffle of x with uniform distribution ? ... Let e be the element which was in the first position t

Re: Python-list Digest, Vol 34, Issue 373

2006-07-24 Thread David G. Wonnacott
Subject: Re: random shuffles To: python-list@python.org Ross Ridge wrote: > David G. Wonnacott wrote: > > Couldn't we easily get an n*log(n) shuffle... > > Why are you trying to get an O(n*log(n)) shuffle when an O(n) shuffle > algorithim is well known

P.S. Re: Python newbie needs constructive suggestions

2006-07-24 Thread David G. Wonnacott
In response to my question, ``What is the idiomatically appropriate Python way to pass, as a "function-type parameter", code that is most clearly written with a local variable?'', a number of you made very helpful suggestions, including the use of a default argument; if one wanted to give a name to

Re: xmlrpclib and methods declared at runtime

2006-07-26 Thread Brett g Porter
but in cases like this where you don't know in advance what the class will need to handle, it lets your code hide the magic in a way that lets the users of your code forget that there's anything magic going on at all. It just looks like code. -- // Brett g Porter * [EMAIL PROTECTED] // http://www.bgporter.net/blog -- http://mail.python.org/mailman/listinfo/python-list

Re: do people really complain about significant whitespace?

2006-08-09 Thread Brett g Porter
being consistent). Pushing the scutwork down onto tools is not as good a solution as eliminating the scutwork, especially when it shouldn't be necessary at all... -- // Brett g Porter * [EMAIL PROTECTED] // http://www.bgporter.net/blog -- http://mail.python.org/mailman/listinfo/python-list

handling many default values

2006-11-10 Thread Alan G Isaac
My class MyClass reuses many default parameters with a small number of changes in each instance. For various reasons I decided to put all the parameters in a separate Params class, instances of which reset the default values based on keyword arguments, like this: class Params: def __init__(se

Re: Fredrik Lundh [was "Re: explicit self revisited"]

2006-11-12 Thread Alan G Isaac
On Sun, 12 Nov 2006 02:14:32 -0500, Doug <[EMAIL PROTECTED]> wrote: > I was going to link to > a definition of FUD to show I really meant to use that term. Oooh. If you had just mentioned your dyslogia, it would have saved us all some time. Thanks! Alan -- http://mail.python.org/mailman/listinfo/

Tetris

2006-06-18 Thread Devon G. Parks
I've been searching google and this group for a while now for a good tutorial on making a Tetris-style game in Python. I hear Tetris is a good starting point, and although I am fairly new to programming I think I would learn best if I had some code to experiment with because without a tutorial I ha

replacing all 'rng's in a buffer with consecutive r[1], r[2]'s

2006-10-04 Thread m g william
I read a file into a buffer and subject it to re.sub() I can replace every occurrence of a pattern with a fixed string but when I try to replace each occurrence with a string that changes (by having an incrementing number in it, (ie 'repTxt[1]','repTxt[2]'etc), I note that the incrementing number g

Re: How to *Search* with google from inside my programme and get the search result?

2006-02-15 Thread Brett g Porter
I V wrote: > Frank Potter wrote: >> Does google supply some webservice to programmers? I did see > > Googling for "google api" gets you to: > > http://www.google.com/apis/ > > It appears to be a SOAP API, which you can access with python, but I > think you'll need a third-party library. Googling

Re: do design patterns still apply with Python?

2006-03-02 Thread Thomas G. Willis
get the message that patterns apply a lot differently in python as compared to the {...;} languages. Details here.http://mindview.net/Books/Python/ThinkingInPython.html-- Thomas G. Willis--- http://i-see-sound.comhttp://tomwillis.sonicdiscord.comAmerica, still more rights than North Korea -- http://mail.python.org/mailman/listinfo/python-list

Re: Python forum

2005-05-17 Thread Brett g Porter
people answering > questions without any problem and it goes very well > > Thanks Don't forget that there's also the Tutor list (see http://www.python.org/mailman/listinfo/tutor ), targeted to people looking to learn the language... -- // Today's Oblique Strategy

Re: GridCellEditor

2005-05-22 Thread david . g . morgenthaler
On Sun, 22 May 2005 10:29:50 +0300, "gralex" <[EMAIL PROTECTED]> wrote: >Hi,all! > >How i can manually start CellEditor in wxGrid for spicified Cell in grid in >my programm: > >mygrid.SetGridCursor(2,3) >mygrid.MakeCellVisible(2,3) ># starting editing... ?? >mygrid.ShowCellEdi

Re: What are OOP's Jargons and Complexities?

2005-05-23 Thread Thomas G. Marshall
Paul McGuire coughed up: > Is this supposed to be some sort of wake-up call or call-to-arms to > all the CS lemmings who have been hoodwinked by Sun into the realm of > jargon over substance? ...[rip]... > You certainly seem to have a lot of energy and enthusiasm for these > topics. It would be

Re: What are OOP's Jargons and Complexities?

2005-05-24 Thread Thomas G. Marshall
John W. Kennedy coughed up: > alex goldman wrote: >> John W. Kennedy wrote: >> >> >>> Strong >>> typing has been a feature of mainstream programming languages since >>> the late 1950's. >> >> >> Is Fortran a strongly typed language? I don't think so. Strong >> typing has been invented in the 70's,

Re: What are OOP's Jargons and Complexities?

2005-05-25 Thread Thomas G. Marshall
[EMAIL PROTECTED] coughed up: > Thomas G. Marshall wrote: > *Missattributed* --Thomas G. Marshall (I) did /not/ write the following: >>> I am not familiar with modern Fortran. Surely it at least has >>> argument prototyping by now? > > Since the 1990 standa

Re: What are OOP's Jargons and Complexities?

2005-05-25 Thread Thomas G. Marshall
Xah Lee coughed up: > The Rise of "Static" versus "Instance" variables You are clearly unable to form a proper argument, *AND* you have irritated nearly everyone frequently. Ahthe blessed silence -- http://mail.python.org/mailman/listinfo/python-list

Re: bool behavior in Python 3000?

2007-07-10 Thread Alan G Isaac
Peter Otten wrote: > The last I have seen is > http://mail.python.org/pipermail/python-3000/2007-January/005284.html OK. Thanks. > Do you care to explain what is broken? I suppose one either finds coercion of arithmetic operations to int to be odd/broken or does not. But that's all I meant

comparison with None

2007-04-18 Thread Alan G Isaac
>>> None >= 0 False >>> None <= 0 True Explanation appreciated. Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Cgi File Upload without Form

2007-04-27 Thread Karsten . G . Weinert
Hello, what is the simplest way to upload a file (or a long string) to a server using cgi/python? Since I want to upload the data programmatically, a form based solution is not good. I am not experienced with SOAP/WSDL and I believe that would be more difficult than necessary. The client program

Re: Cgi File Upload without Form

2007-04-30 Thread Karsten . G . Weinert
Thanks for your replies, however I think urlllib can not help me here. I have control over the server side (I can write a cgi-script in python), but I have very little control on the client side (I have to use VBA). Kind regards, Karsten. -- http://mail.python.org/mailman/listinfo/python-list

Re: Cgi File Upload without Form

2007-04-30 Thread Karsten . G . Weinert
On 30 Apr., 15:51, "Dave Borne" <[EMAIL PROTECTED]> wrote: > > Since I want to upload the data programmatically, a form based > > solution is not good. > > Karsten, > Could you explain this statement? When I want to move data to a > server in a CGI environment, a form post is the easiest way I can

Re: Cgi File Upload without Form

2007-04-30 Thread Karsten . G . Weinert
OK, I think I have a simple solution now. I am going to use FTP in my VBA-Client (it's possible) and don't need to do any server-side programming. Kind regards, Karsten. -- http://mail.python.org/mailman/listinfo/python-list

Re: change of random state when pyc created??

2007-05-09 Thread Alan G Isaac
Diez B. Roggisch wrote: > Not really, but that depends on what you know about the concept of sets and > maps as collections of course. > > The contract for sets and dicts doesn't imply any order whatsoever. Which is > essentially the reason why > > set(xrange(10))[0] > > doesn't exist, and quite

Re: change of random state when pyc created??

2007-05-09 Thread Alan G Isaac
Robert Kern wrote: > http://docs.python.org/lib/typesmapping.html > """ > Keys and values are listed in an arbitrary order which is non-random, varies > across Python implementations, and depends on the dictionary's history of > insertions and deletions. > """ Even this does not tell me that if I

Basic question

2007-05-12 Thread Cesar G. Miguel
I've been studying python for 2 weeks now and got stucked in the following problem: for j in range(10): print j if(True): j=j+2 print 'interno',j What happens is that "j=j+2" inside IF does not change the loop counter ("j") as it would in C or Java, for example. Am I missing so

Re: Basic question

2007-05-12 Thread Cesar G. Miguel
On May 12, 2:45 pm, Basilisk96 <[EMAIL PROTECTED]> wrote: > On May 12, 12:18 pm, "Cesar G. Miguel" <[EMAIL PROTECTED]> wrote: > > > > > I've been studying python for 2 weeks now and got stucked in the > > following problem: > > > for j

Re: Basic question

2007-05-12 Thread Cesar G. Miguel
On May 12, 3:09 pm, Karlo Lozovina <[EMAIL PROTECTED]> wrote: > Cesar G. Miguel wrote: > > - > > L = [] > > file = ['5,1378,1,9', '2,1,4,5'] > > str='' > > for item in file: > >

Re: Basic question

2007-05-12 Thread Cesar G. Miguel
On May 12, 3:40 pm, Dmitry Dzhus <[EMAIL PROTECTED]> wrote: > > Actually I'm trying to convert a string to a list of float numbers: > > str = '53,20,4,2' to L = [53.0, 20.0, 4.0, 2.0] > > str="53,20,4,2" > map(lambda s: float(s), str.split(',')) > > Last expression returns: [53.0, 20.0, 4.0, 2.0] >

Re: Basic question

2007-05-13 Thread Cesar G. Miguel
On May 12, 8:13 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > Cesar G. Miguel <[EMAIL PROTECTED]> wrote: > > > On May 12, 3:40 pm, Dmitry Dzhus <[EMAIL PROTECTED]> wrote: > > > > Actually I'm trying to convert a string to a list of float numbers: > >

RE: Using python for a CAD program

2007-05-29 Thread George, Harry G
l Message- > From: Dan Fabrizio [mailto:[EMAIL PROTECTED] > Sent: Saturday, May 26, 2007 3:46 PM > To: python-list@python.org; George, Harry G > Subject: Using python for a CAD program > > Hello, > > I saw your post from last year about using python for a EE > CAD pr

Re: Iteration over strings

2007-07-31 Thread Brett g Porter
Robert Dailey wrote: > Hi, > > I have the following code: > > str = "C:/somepath/folder/file.txt" > > for char in str: > if char == "\\": > char = "/" > > The above doesn't modify the variable 'str' directly. I'm still pretty > new to Python so if someone could explain to me why th

Re: Eureka moments in Python

2007-03-13 Thread Brett g Porter
Steven D'Aprano wrote: > I'd be interested in hearing people's stories of Eureka moments in Python, > moments where you suddenly realise that some task which seemed like it > would be hard work was easy with Python. Mine was definitely when I was first working with the xmlrpc module, and I was pu

Re: Eureka moments in Python

2007-03-13 Thread Brett g Porter
Dustan wrote: > On Mar 13, 10:05 am, Brett g Porter <[EMAIL PROTECTED]> wrote: >> Steven D'Aprano wrote: >>> I'd be interested in hearing people's stories of Eureka moments in Python, >>> moments where you suddenly realise that some task which see

socket.error: (9, 'Bad file descriptor') Python 2.5

2007-03-16 Thread Brian G. Merrell
I'm getting the following trace in python 2.5: Traceback (most recent call last): File "./template_unittest.py", line 36, in zencc.start_browser(machines.zones[0].devices.get_primary_servers()[0]) File "/home/bean/code/automation/nrm-qa/trunk/brimstone/lib/zcc.py", line 221, in start_browse

vocab question

2007-04-13 Thread Alan G Isaac
Pardon the vocab question; I'm not a computer science type. According to the Reference Manual, a class defintion has the structure:: classdef ::= "class" classname [inheritance] ":" suite What is the entire part before the suite called? (Just pointing to a reference is fine & helpful,

Re: vocab question

2007-04-13 Thread Alan G Isaac
Steven Bethard wrote: > As far as I > know, there's no official term for the first four elements of a class > statement. I'd probably call it the class statement header. That will have to do for now. Thanks! Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: GLE-like python package

2007-10-14 Thread Cesar G. Miguel
On Oct 14, 12:54 pm, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > Hello there, > > I'm exploring possibilities of using python as an alternative to Matlab. > The obvious way to go seems to be matplotlib for plotting, but I do like > GLE http://glx.sourceforge.net/> a lot. One reason is that w

RE: Python does not play well with others

2007-01-24 Thread George, Harry G
other, using strictly Open Source Software, and enjoying the process. .NET/Mono and C# don't pass either the "lots" or the "enjoy" tests. > -Original Message- > From: egbert [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 24, 2007 10:05 AM > To: Ge

Re: A JEW hacker in California admits distributing malware that let him steal usernames and passwords for Paypal accounts.

2007-11-13 Thread Richard G Riley
Hendrik Maryns <[EMAIL PROTECTED]> writes: > ___ > /| /| | | > ||__|| | Please do | > / O O\__ NOT | > /

Re: Non-web-based templating system

2006-04-28 Thread Brett g Porter
Diez B. Roggisch wrote: > [EMAIL PROTECTED] wrote: > > Maybe the built-in string interpolation is sufficient? > > print "Hello %(name)s" % dict(name="Peter Pan") Or in recent pythons, the built-in string templating system (see http://docs.python.org/lib/node109.html) >>> from string import

Re: pairs from a list

2008-01-23 Thread Alan G Isaac
Steven D'Aprano wrote: > In fact, "fastest" isn't even a meaningful attribute. Does it mean: > > * the worst-case is fastest > * the best-case is fastest > * the average-case is fastest > * fastest on typical data > * all of the above I confess that it did not occur to me that there might be an

Re: Python printing!

2008-01-23 Thread Alan G Isaac
SMALLp wrote: > Hy. How to use printer in python. http://tgolden.sc.sabren.com/python/win32_how_do_i/print.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Formatting arrays using myarrayy.tolist()

2008-02-06 Thread Alan G Isaac
http://www.scipy.org/Cookbook/InputOutput> hth, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Python 3: range objects cannot be sliced

2009-01-16 Thread Alan G Isaac
Is the behavior below expected? Documented? (The error msg is misleading.) Thanks, Alan Isaac >>> x = range(20) >>> s = slice(None,None,2) >>> x[s] Traceback (most recent call last): File "", line 1, in TypeError: sequence index must be integer, not 'slice' -- http://mail.python.org/mailman/li

Re: Python 3: range objects cannot be sliced

2009-01-16 Thread Alan G Isaac
On 1/16/2009 1:15 PM Paul Rubin apparently wrote: range is an iterator now. Try itertools.islice. Well yes, it behaves like xrange did. But (also like xrange) it supports indexing. (!) So why not slicing? I expected this (to keep it functionally more similar to the old range). Alan Isaac -- h

Re: Python 3: range objects cannot be sliced

2009-01-16 Thread Alan G Isaac
It is documented: http://docs.python.org/3.0/library/stdtypes.html#sequence-types-str-bytes-bytearray-list-tuple-range -- http://mail.python.org/mailman/listinfo/python-list

tuple methods: documentation missing

2009-01-16 Thread Alan G Isaac
http://docs.python.org/3.0/library/stdtypes.html#sequence-types-str-bytes-bytearray-list-tuple-range I see no mention of the tuple methods? Right after the paragraph "Most sequence types support the following operations." it seems appropriate to have one stating "Most sequence types support the

Re: tuple methods: documentation missing

2009-01-16 Thread Alan G Isaac
Alan G Isaac wrote: http://docs.python.org/3.0/library/stdtypes.html#sequence-types-str-bytes-bytearray-list-tuple-range I see no mention of the tuple methods? Right after the paragraph "Most sequence types support the following operations." it seems appropriate to have one sta

Re: tuple methods: documentation missing

2009-01-17 Thread Alan G Isaac
On 1/16/2009 6:44 PM Terry Reedy apparently wrote: http://bugs.python.org/issue4966 Is this another lacuna or am I overlooking it? I cannot find the 3.0 documentation of string formatting with the ``%`` operator. Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Python 3: exec arg 1

2009-01-17 Thread Alan G Isaac
In Python 3, you can no longer ``exec(open(filename))``. I guess the reason is that in 3.0 ``open`` returns a stream, instead of open file, and exec wants "a string, bytes, or code object" and not a "TextIOWrapper". So it returns an error. Is it intentional that ``exec`` cannot handle a TextIOWr

<    1   2   3   4   >