The '-c' CLI option removes just the command str.

2020-05-05 Thread Simon Forman via Python-list
Is this anything? When you run a python command from the shell to just print the command line args you get this: $ python -c "import sys; print(sys.argv)" ['-c'] But I would expect one of these: Either the '-c' option consumes both args: $ python -c "import sys; print(sys.argv)"

Re: A curious bit of code...

2014-02-14 Thread Simon Forman
On Friday, February 14, 2014 1:01:48 PM UTC-8, Mark Lawrence wrote: [snip] Pleased to have you on board, as I'm know that Terry Reedy et al can do with a helping hand. But please note you appear to be using google groups, hence the double line spacing above and trying to reply to

A curious bit of code...

2014-02-14 Thread Simon Forman
(Apologies if this results in a double-post.) On Friday, February 14, 2014 1:01:48 PM UTC-8, Mark Lawrence wrote: [snip] Pleased to have you on board, as I'm know that Terry Reedy et al can do with a helping hand. But please note you appear to be using google groups, hence the double

Pigeon Computer 0.1 Initial (BETA) release

2012-12-21 Thread Simon Forman
Pigeon Computer 0.1 Initial (BETA) release Summary The Pigeon Computer is a simple but sophisticated system for learning and exploring the fundamentals of computers and programming. It is written to support a course or class (as yet pending) to learn programming from the bit to the

Re: testing if a list contains a sublist

2011-08-20 Thread Simon Forman
On Mon, Aug 15, 2011 at 4:26 PM, Johannes dajo.m...@web.de wrote: hi list, what is the best way to check if a given list (lets call it l1) is totally contained in a second list (l2)? for example: l1 = [1,2], l2 = [1,2,3,4,5] - l1 is contained in l2 l1 = [1,2,2,], l2 = [1,2,3,4,5] - l1 is

[issue12590] First line and cursor not visible when opening files

2011-07-26 Thread Simon Forman
Simon Forman forman.si...@gmail.com added the comment: You're very welcome. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12590 ___ ___ Python

[issue12590] First line and cursor not visible when opening files

2011-07-19 Thread Simon Forman
New submission from Simon Forman forman.si...@gmail.com: In IDLE if you open a file that is longer than the editor window the first line, with the cursor, is scrolled off the top of the window making it appear as though the file begins at the second line. This can be fixed by adding 'text.see

Re: parallel class structures for AST-based objects

2009-11-22 Thread Simon Forman
On Sun, Nov 22, 2009 at 4:50 AM, Diez B. Roggisch de...@nospam.web.de wrote: Steve Howell schrieb: On Nov 21, 4:07 pm, MRAB pyt...@mrabarnett.plus.com wrote: I don't see the point of EvalNode and PrettyPrintNode. Why don't you just give Integer, Sum and Product 'eval' and 'pprint' methods?

Re: make two tables having same orders in both column and row names

2009-11-19 Thread Simon Forman
On Wed, Nov 18, 2009 at 3:57 PM, Ping-Hsun Hsieh hsi...@ohsu.edu wrote: Hi, I would like to compare values in two table with same column and row names, but with different orders in column and row names. For example, table_A in a file looks like the follows: AA100   AA109   AA101   AA103  

Re: Language mavens: Is there a programming with if then else ENDIF syntax?

2009-11-18 Thread Simon Forman
On Wed, Nov 18, 2009 at 4:15 AM, Steve Howell showel...@yahoo.com wrote: On the topic of switch statements and even-more-concise-then-we-have- already if/elif/else/end constructs, I have to say that Python does occasionally force you to write code like the code below.  Maybe force is too

Re: using struct module on a file

2009-11-18 Thread Simon Forman
On Wed, Nov 18, 2009 at 11:42 AM, Ulrich Eckhardt dooms...@knuut.de wrote: Hia! I need to read a file containing packed binary data. For that, I find the struct module pretty convenient. What I always need to do is reading a chunk of data from the file (either using calcsize() or a

Re: Anything equivalent to cassert in C++?

2009-11-17 Thread Simon Forman
On Tue, Nov 17, 2009 at 4:19 PM, Peng Yu pengyu...@gmail.com wrote: There are some assertion code (testing if a condition is false, if it is false, raise an Error object) in my python, which is useful when I test my package.  But such case would never occur when in the produce code. If I keep

Re: Python Go

2009-11-15 Thread Simon Forman
On Sat, Nov 14, 2009 at 5:10 PM, Terry Reedy tjre...@udel.edu wrote: Paul Rubin wrote: Mark Chu-Carroll has a new post about Go:  http://scienceblogs.com/goodmath/2009/11/the_go_i_forgot_concurrency_an.php In a couple of minutes, I wrote his toy prime filter example in Python, mostly from

Re: Calendar Stuff

2009-11-10 Thread Simon Forman
On Tue, Nov 10, 2009 at 12:53 PM, Victor Subervi victorsube...@gmail.com wrote: Hi; I have the following code: import calendar, datetime def cal():   ...   myCal = calendar.Calendar(calendar.SUNDAY)   today = datetime.date.today()   day = today.day   mo = today.month   yr = today.year

Re: Serious Privileges Problem: Please Help

2009-11-09 Thread Simon Forman
On Mon, Nov 9, 2009 at 12:44 PM, Victor Subervi victorsube...@gmail.com wrote: Did you give up on me? V Please don't top-post. -- http://mail.python.org/mailman/listinfo/python-list

Re: NEWB problem with urllib2

2009-11-09 Thread Simon Forman
On Mon, Nov 9, 2009 at 6:29 PM, Penn powderd...@gmail.com wrote: I just installed PyDev into Eclipse using the 'update' method and did the standard installation.  I allowed it to Auto Configure itself and ran a Hello World module to make sure I was in the ballpark. I got an starting module up

Re: Why do you use python?

2009-11-05 Thread Simon Forman
On Sat, Oct 31, 2009 at 2:11 AM, sk catchyouraak...@gmail.com wrote: What would be your answer if this question is asked to you in an interview? a modified version might be: Where would you use python over C/C++/Java? (because my resume says I know C/C++/Java)? Mark Miller has some adages

Re: disutils, project structure developing - n00b question

2009-10-29 Thread Simon Forman
On Thu, Oct 29, 2009 at 2:42 PM, Wells we...@submute.net wrote: So I have my project partitioned like so: ./setup.py ./pymlb/ ./pymlb/fetcher.py ./demos ./demos/demo.py In demo.py I have: from pymlb import fetcher However, it fails b/c pymlb is up a folder. It's also NOT installed as

Re: disutils, project structure developing - n00b question

2009-10-29 Thread Simon Forman
On Thu, Oct 29, 2009 at 3:45 PM, Simon Forman sajmik...@gmail.com wrote: In order for from pymlb import fetcher no work you must make the s/no/to/ D'oh! -- http://mail.python.org/mailman/listinfo/python-list

Re: What IDE has good git and python support?

2009-10-28 Thread Simon Forman
On Tue, Oct 27, 2009 at 11:56 AM, Aweks a...@ewadev.com wrote: what do you use? I use IDLE for python and Bash for GIT. Regards, ~Simon -- http://mail.python.org/mailman/listinfo/python-list

Re: python web service or Apache?

2009-10-26 Thread Simon Forman
On Mon, Oct 26, 2009 at 10:00 AM, Peng Yu pengyu...@gmail.com wrote: On Sun, Oct 25, 2009 at 11:09 PM, Simon Forman sajmik...@gmail.com wrote: On Sun, Oct 25, 2009 at 4:47 PM, Peng Yu pengyu...@gmail.com wrote: Although, python can be used to provide web service. The following webpage also

Re: handling PAMIE and lxml

2009-10-26 Thread Simon Forman
On Mon, Oct 26, 2009 at 3:05 AM, elca high...@gmail.com wrote: Hello, i was open anther new thread ,old thread is too long. Too long for what? first of all,i really appreciate other many people's help in this newsgroup. im making webscraper now. but still problem with my script source.

Re: python web service or Apache?

2009-10-25 Thread Simon Forman
On Sun, Oct 25, 2009 at 4:47 PM, Peng Yu pengyu...@gmail.com wrote: Although, python can be used to provide web service. The following webpage also mentioned, Apache the best and most widely used web server on the Internet today, check it out. If you want to run your own web server this is the

Re: Simple audio

2009-10-20 Thread Simon Forman
On Tue, Oct 20, 2009 at 4:04 PM, Peter Chant pet...@mpeteozilla.vco.uke wrote: What are recommendations for simple audio playback?  I want to play back on linux (Slackware), which uses alsa.  There seem to be many ways - but some are a couple of years old and won't compile, like pymedia, or

Re: Iterators

2009-10-16 Thread Simon Forman
On Fri, Oct 16, 2009 at 8:22 AM, Duncan Booth duncan.bo...@invalid.invalid wrote: Chris Rebert c...@rebertia.com wrote: Essentially, file iterators are dumb and don't keep track of where in the file the next line starts, instead relying on their associated file object to keep track of the

Re: a=[1,2,3,4].reverse() - why a is None?

2009-10-13 Thread Simon Forman
On Mon, Oct 12, 2009 at 4:44 AM, Nadav Chernin nada...@qualisystems.com wrote:        Chris Withers wrote:        ...becauase you were looking for:        reversed([1,2,3,4]) OK, but my question is generic. Why when I use object's function that changed values of the object, I can't to get

Re: Why ELIF?

2009-10-11 Thread Simon Forman
On Sun, Oct 11, 2009 at 2:15 PM, TerryP bigboss1...@gmail.com wrote: On Oct 11, 3:42 pm, Esmail ebo...@hotmail.com wrote: cool .. I hadn't seen that. Not working quite at the 'pythonic' level yet I am not sure I think it's more readable that the if statement. Also, curious if the dictionary

Re: Persistent Distributed Objects

2009-10-11 Thread Simon Forman
On Sun, Oct 11, 2009 at 12:46 PM, John Haggerty bouncy...@gmail.com wrote: Does pyro work inside of stackless? I have no idea, but you wouldn't need both. Only one or the other. ~Simon On Sat, Oct 10, 2009 at 9:54 AM, Simon Forman sajmik...@gmail.com wrote: On Fri, Oct 9, 2009 at 1:11 AM

Re: Persistent Distributed Objects

2009-10-10 Thread Simon Forman
On Fri, Oct 9, 2009 at 1:11 AM, John Haggerty bouncy...@gmail.com wrote: I am interested in seeing how it would be possible in python to have persistent objects (basically be able to save objects midway through a computation, etc) and do so across multiple computers. Something that would

Re: Is there a better way to code variable number of return arguments?

2009-10-08 Thread Simon Forman
On Thu, Oct 8, 2009 at 7:14 PM, Dr. Phillip M. Feldman pfeld...@verizon.net wrote: I'm amazed that this works.  I had not realized that x,y= [3,4] is equivalent to x= 3; y= 4 Python is rather clever. Thanks! Python is very clever: (a, b), c = (1, 2), 3 a, b, c (1, 2, 3) :D --

Re: Object Relational Mappers are evil (a meditation)

2009-10-06 Thread Simon Forman
On Tue, Oct 6, 2009 at 2:00 AM, Carl Banks pavlovevide...@gmail.com wrote: On Oct 5, 7:25 am, Aaron Watters aaron.watt...@gmail.com wrote: This is a bit off topic except that many Python programmers seem to be allergic to typing SQL. RESOLVED:  Using ORMs leads lazy programmers to make bad

Re: Object Relational Mappers are evil (a meditation)

2009-10-05 Thread Simon Forman
On Mon, Oct 5, 2009 at 11:14 PM, Paul Rubin http://phr...@nospam.invalid wrote: Steve Holden st...@holdenweb.com writes: It seems to me that the biggest sin in databases is a failure to use rigorous design techniques. If somebody doesn't understand relational theory Where does one find out

Re: defaults for function arguments bound only once(??)

2009-10-04 Thread Simon Forman
On Sun, Oct 4, 2009 at 2:29 AM, horos11 horo...@gmail.com wrote: All, Another one, this time a bit shorter. It looks like defaults for arguments are only bound once, and every subsequent call reuses the first reference created. Hence the following will print '[10,2]' instead of the expected

Re: Is pythonic version of scanf() or sscanf() planned?

2009-10-04 Thread Simon Forman
On Sun, Oct 4, 2009 at 5:29 AM, Martien Verbruggen martien.verbrug...@invalid.see.sig wrote: On Sun, 4 Oct 2009 01:17:18 + (UTC),        Grant Edwards inva...@invalid.invalid wrote: On 2009-10-03, ryniek90 rynie...@gmail.com wrote: So, whether it is or has been planned the core Python

Re: creating class objects inside methods

2009-10-04 Thread Simon Forman
On Sun, Oct 4, 2009 at 1:12 AM, horos11 horo...@gmail.com wrote: a __main__.Myclass instance at 0x95cd3ec b __main__.Myclass instance at 0x95cd5ac What's the problem? Like I said, the code was a sample of what I was trying to do, not the entire thing.. I just wanted to see if the

Re: creating class objects inside methods

2009-10-04 Thread Simon Forman
On Sun, Oct 4, 2009 at 2:44 PM, horos11 horo...@gmail.com wrote: Thanks for the info, but a couple of points:     1. it wasn't meant to be production code, simply a way to teach python. Speaking as someone who does teach Python, Ew, no!  If you start by teaching people bad habits,

Re: creating class objects inside methods

2009-10-03 Thread Simon Forman
On Sat, Oct 3, 2009 at 11:32 PM, horos11 horo...@gmail.com wrote: All, I've got a strange one.. I'm trying to create a class object inside another class object by using the code template below (note.. this isn't the exact code.. I'm having difficulty reproducing it without posting the whole

Re: Simple Python struct issue

2009-10-02 Thread Simon Forman
On Fri, Oct 2, 2009 at 12:07 PM, Carlo DiCelico carlo.dicel...@gmail.com wrote: I saw an article on O'Reilly about using NumPy and Dislin to analyze and visualize WAV files. It's a really fantastic article but was a little out of date. I updated the script to work with the newer modules etc

Re: Opinions, please, on PEP 8 and local, 3rd party imports

2009-10-02 Thread Simon Forman
On Fri, Oct 2, 2009 at 3:50 PM, Philip Semanchuk phi...@semanchuk.com wrote: Hi all, Our project uses some libraries that were written by 3rd parties (i.e. not us). These libraries fit into a single Python file and live in our source tree alongside other modules we've written. When our app is

Re: How different are a generator's send and next methods

2009-10-01 Thread Simon Forman
On Wed, Sep 30, 2009 at 4:24 PM, Andrey Fedorov anfedo...@gmail.com wrote: As far as I can tell, a generator's .next() is equivalent to .send(None). Is this true? They are equivalent AFAIK. If so, [why] aren't they unified in a method with a single argument which defaults to None? -

Re: iterate over list while changing it

2009-10-01 Thread Simon Forman
On Wed, Sep 30, 2009 at 11:19 PM, Daniel Stutzbach dan...@stutzbachenterprises.com wrote: On Thu, Sep 24, 2009 at 3:32 PM, Torsten Mohr tm...@s.netic.de wrote: a = [1, 2, 3, 4, 5, 6] for i, x in enumerate(a):    if x == 3:        a.pop(i)        continue    if x == 4:        a.push(88)

Re: hii

2009-10-01 Thread Simon Forman
On Thu, Oct 1, 2009 at 7:55 AM, padmapriya sekaran ppriy...@gmail.com wrote: I have a problem in using interp from numpy for which i need 3 array. my first array is x = scipy.linspace(0.009,0.53,100) and the other two array should be read from my file with 100x2 dimension (file1_lines) but

Re: emptying a list

2009-10-01 Thread Simon Forman
On Thu, Oct 1, 2009 at 11:30 AM, lallous lall...@lgwm.org wrote: Hello What is faster when clearing a list? del L[:] or L = [] -- Elias -- http://mail.python.org/mailman/listinfo/python-list The first form actually clears the list, the second for just re-binds the name 'L' to a

Re: Split string but ignore quotes

2009-09-29 Thread Simon Forman
On Tue, Sep 29, 2009 at 11:11 AM, Scooter slbent...@gmail.com wrote: I'm attempting to reformat an apache log file that was written with a custom output format. I'm attempting to get it to w3c format using a python script. The problem I'm having is the field-to-field matching. In my python

Re: Multidimensional arrays/lists

2009-09-28 Thread Simon Forman
On Mon, Sep 28, 2009 at 3:27 PM, Ethan Furman et...@stoneleaf.us wrote: Simon Forman wrote: On Sun, Sep 27, 2009 at 12:40 PM, Someone Something fordhai...@gmail.com wrote: I'm trying to write a little tic-tac-toe program I need a array/list such that I can represent the tic tac toe board

Re: Repeated output when logging exceptions

2009-09-28 Thread Simon Forman
On Mon, Sep 28, 2009 at 4:38 PM, John Gordon gor...@panix.com wrote: In 6bce12c3-f2d9-450c-89ee-afa4f21d5...@h30g2000vbr.googlegroups.com Vinay Sajip vinay_sa...@yahoo.co.uk writes: The logging package allows you to add tracebacks to your logs by using the exception() method, which logs an

Re: Business issues regarding adapting Python

2009-09-27 Thread Simon Forman
On Sun, Sep 27, 2009 at 10:48 AM, Nash nasrul...@gmail.com wrote: On Sep 27, 4:13 pm, Martin P. Hellwig martin.hell...@dcuktec.org wrote: Nash wrote: cut can't get enough Python Developers I think normal market rules will apply to Pakistan too, if your desired trade has not the quantity you

Re: Detecting changes to a dict

2009-09-27 Thread Simon Forman
On Sun, Sep 27, 2009 at 5:36 AM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: I'm pretty sure the answer to this is No, but I thought I'd ask just in case... Is there a fast way to see that a dict has been modified? I don't care what the modifications are, I just want to know

Re: Is there a method (similar to str() method in R) that can print the data structure in python?

2009-09-27 Thread Simon Forman
On Sun, Sep 27, 2009 at 12:14 PM, Peng Yu pengyu...@gmail.com wrote: On Sat, Sep 26, 2009 at 2:05 PM, Robert Kern robert.k...@gmail.com wrote: On 2009-09-26 09:32 AM, Peng Yu wrote: Hi, I am looking for a method in python that is similar to the function str() in R, if you are familiar with

Re: Multidimensional arrays/lists

2009-09-27 Thread Simon Forman
On Sun, Sep 27, 2009 at 12:40 PM, Someone Something fordhai...@gmail.com wrote: I'm trying to write a little tic-tac-toe program I need a array/list such that I can represent the tic tac toe board with an x axis and y axis and i can access each square to find out whether there is an X or an O.

Re: Most active coroutine library project?

2009-09-25 Thread Simon Forman
On Fri, Sep 25, 2009 at 11:42 AM, Grant Edwards inva...@invalid.invalid wrote: On 2009-09-25, Piet van Oostrum p...@cs.uu.nl wrote: exar...@twistedmatrix.com (e) wrote: e I specifically left out all yield statements in my version, since that's e exactly the point here. :)  With real coroutines,

Re: Most active coroutine library project?

2009-09-25 Thread Simon Forman
On Fri, Sep 25, 2009 at 2:07 PM, Jason Tackaberry t...@urandom.ca wrote: On Fri, 2009-09-25 at 15:42 +, Grant Edwards wrote: You can't call a function that yields control back to the other coroutine(s).  By jumping through some hoops you can get the same effect, but it's not very intuitive

Re: flow control and nested loops

2009-09-25 Thread Simon Forman
On Fri, Sep 25, 2009 at 3:01 PM, kj no.em...@please.post wrote: In Perl, one can label loops for finer flow control.  For example: X: for my $x (@X) {  Y: for my $y (@Y) {    for my $z (@Z) {      next X if test1($x, $y, $z);      next Y if test2($x, $y, $z);      frobnicate($x, $y, $z);

Re: Regex trouble

2009-09-24 Thread Simon Forman
On Thu, Sep 24, 2009 at 10:43 AM, Support Desk m...@ipglobal.net wrote: I am trying to loop over a dictionary  of phone numbers and using a python regex to determine if they are long distance or local and then adding them to their appropriate dictionary, My regex doesn't appear to be working

Re: iterate over list while changing it

2009-09-24 Thread Simon Forman
On Thu, Sep 24, 2009 at 4:32 PM, Torsten Mohr tm...@s.netic.de wrote: Hello, a = [1, 2, 3, 4, 5, 6] for i, x in enumerate(a):    if x == 3:        a.pop(i)        continue    if x == 4:        a.push(88)    print i, i, x, x I'd like to iterate over a list and change that list while

Re: Regex trouble

2009-09-24 Thread Simon Forman
On Thu, Sep 24, 2009 at 6:31 PM, Rhodri James rho...@wildebst.demon.co.uk wrote: On Thu, 24 Sep 2009 19:45:37 +0100, Simon Forman sajmik...@gmail.com wrote: FWIW this problem is too simple (IMHO) for regular expressions. Simply carve off the first three digits and check against sets

Re: Most active coroutine library project?

2009-09-23 Thread Simon Forman
On Sun, Aug 23, 2009 at 11:02 AM, Phillip B Oldham phillip.old...@gmail.com wrote: I've been taking a look at the multitude of coroutine libraries available for Python, but from the looks of the projects they all seem to be rather quiet. I'd like to pick one up to use on a current project but

Re: arrays in python

2009-09-23 Thread Simon Forman
On Wed, Sep 23, 2009 at 1:14 PM, Rudolf yellowblueyel...@gmail.com wrote: Can someone tell me how to allocate single and multidimensional arrays in python. I looked online and it says to do the following x = ['1','2','3','4'] However, I want a much larger array like a 100 elements, so I cant

Re: arrays in python

2009-09-23 Thread Simon Forman
On Wed, Sep 23, 2009 at 1:22 PM, Donn donn.in...@gmail.com wrote: On Wednesday 23 September 2009 19:14:20 Rudolf wrote: I want to allocate an array and then populate it using a for loop. You don't need to allocate anything, just use the list or dictionary types. l=[] #empty list for x in

Re: Most active coroutine library project?

2009-09-23 Thread Simon Forman
On Wed, Sep 23, 2009 at 2:05 PM, exar...@twistedmatrix.com wrote: On 05:00 pm, sajmik...@gmail.com wrote: On Sun, Aug 23, 2009 at 11:02 AM, Phillip B Oldham phillip.old...@gmail.com wrote: I've been taking a look at the multitude of coroutine libraries available for Python, but from the

Re: Searching Dictionary

2009-09-23 Thread Simon Forman
On Wed, Sep 23, 2009 at 2:31 PM, Support Desk support.desk@gmail.com wrote: i am trying to search a large Python dictionary for a matching value. The results would need to be structured into a new dictionary with the same structure. Thanks. The structure is like this { Key :

Re: arrays in python

2009-09-23 Thread Simon Forman
On Wed, Sep 23, 2009 at 10:03 PM, AggieDan04 danb...@yahoo.com wrote: On Sep 23, 3:02 pm, Simon Forman sajmik...@gmail.com wrote: On Wed, Sep 23, 2009 at 1:14 PM, Rudolf yellowblueyel...@gmail.com wrote: Can someone tell me how to allocate single and multidimensional arrays in python. I

Re: Dynamic Form

2009-09-22 Thread Simon Forman
On Tue, Sep 22, 2009 at 10:46 AM, Victor Subervi victorsube...@gmail.com wrote: Hi; I have a dynamic form in which I do the following: 1) Request two fields (company name, number of entries). That is sent back to the form. 2) If the two fields are not None, the form requests other data. That,

Re: Read header and data from a binary file

2009-09-22 Thread Simon Forman
On Tue, Sep 22, 2009 at 4:30 PM, Jose Rafael Pacheco jose_rafael_pach...@yahoo.es wrote: Hello, I want to read from a binary file called myaudio.dat Then I've tried the next code: import struct name = myaudio.dat f = open(name,'rb') f.seek(0) Don't bother to seek(0) on a file you just

Re: Searching a large dictionary

2009-09-22 Thread Simon Forman
On Tue, Sep 22, 2009 at 5:50 PM, Support Desk support.desk@gmail.com wrote: I need help searching a large python dictionary. The dictionary is setup like so Key[{'item':value,'item2':value,'item3':value,'item4':value,'item5':value','item6':value,'item7':value,'item8':value,'item9':value}]

Re: Searching a large dictionary

2009-09-22 Thread Simon Forman
On Tue, Sep 22, 2009 at 6:30 PM, Support Desk support.desk@gmail.com wrote: Chris,  Yes that is the correct syntax, thanks Okay, but correct syntax of what? Help us help you. On Tue, Sep 22, 2009 at 5:22 PM, Chris Rebert c...@rebertia.com wrote: On Tue, Sep 22, 2009 at 2:50 PM,

Re: How to change string or number passed as argument?

2009-09-20 Thread Simon Forman
On Sep 19, 9:59 pm, Peng Yu pengyu...@gmail.com wrote: Hi, I know that strings or numbers are immutable when they passed as arguments to functions. But there are cases that I may want to change them in a function and propagate the effects outside the function. I could wrap them in a class,

Re: What are the naming convention for private member variable, and private and public member function?

2009-09-20 Thread Simon Forman
On Sep 19, 11:33 pm, Peng Yu pengyu...@gmail.com wrote: Hi, It says inhttp://www.python.org/dev/peps/pep-0008/    Method Names and Instance Variables       Use the function naming rules: lowercase with words separated by       underscores as necessary to improve readability.       Use

Re: Comparison of parsers in python?

2009-09-20 Thread Simon Forman
On Sep 19, 9:34 pm, Peng Yu pengyu...@gmail.com wrote: On Sep 19, 6:05 pm, Robert Kern robert.k...@gmail.com wrote: Peng Yu wrote: Hi, I did a google search and found various parser in python that can be used to parse different files in various situation. I don't see a page that

Re: How to get the minimum number that can be represented?

2009-09-20 Thread Simon Forman
On Sep 20, 11:23 am, Peng Yu pengyu...@gmail.com wrote: On Sun, Sep 20, 2009 at 9:37 AM, Grant Edwards inva...@invalid.invalid wrote: On 2009-09-20, Peng Yu pengyu...@gmail.com wrote: Suppose I want to define a function that return the minimum number that can be represented. def f(x):

Re: Why use locals()

2009-09-18 Thread Simon Forman
On Mon, Sep 14, 2009 at 1:12 AM, Sean DiZazzo half.ital...@gmail.com wrote: Thanks for your explanation Steven.  I see how it can be valuable, but it seems to always break the second rule of Zen.  I don't really want to get into the code of debuggers, but I guess I can see how they might have

Re: detmining name during an assignment

2009-09-18 Thread Simon Forman
On Sep 18, 1:00 pm, Jamie Riotto jamie.rio...@gmail.com wrote: I have an app that uses Python scripting. When a user creates a new object: objName = newObject() I'd like the newObject be able to use objName as its internal name. So, if a user says: cube1 = Cube()  A cube1 object should

Re: Urllib2 not working

2009-08-22 Thread Simon Forman
On Sat, Aug 22, 2009 at 2:12 PM, Carlos Fabian Ramirezcarlosfabianrami...@gmail.com wrote: Hello, When I try to open a URL using urllib2.urlopen it returns Name or service not known. It is not a problem with my Internet I believe, since I have Internet access on my computer, and I have

Re: TypeError while checking for permissions with os.access() on windows xp

2009-08-21 Thread Simon Forman
On Aug 21, 1:33 pm, ryniek90 rynie...@gmail.com wrote: I've got some code that checks priviliges on two paths: First - chosen by user Second - hardcoded home directory represented by **os.getenv('HOME')** - (os.getenv('HOME') works both on Linux and Windows) Here's the code: def

Re: Annoying octal notation

2009-08-20 Thread Simon Forman
On Aug 20, 3:06 pm, David 71da...@libero.it wrote: Hi all, Is there some magic to make the 2.x CPython interpreter to ignore the annoying octal notation? No. You would have to modify and recompile the interpreter. This is not exactly trivial, see How to Change Python's Grammar

Re: incrementing string/hex value from file and write back

2009-08-20 Thread Simon Forman
On Aug 20, 5:08 pm, Matthias Güntert matzeguent...@gmx.de wrote: Hello guys I would like to read a hex number from an ASCII file, increment it and write it back. How can this be performed? I have tried several approaches: my file serial.txt contains: 0C

Re: incrementing string/hex value from file and write back

2009-08-20 Thread Simon Forman
On Aug 20, 5:18 pm, Rami Chowdhury rami.chowdh...@gmail.com wrote: val = val.encode('hex') That's the crucial line -- it's returning a new integer, which you are   re-binding to val. If you then did: No, it returns another string, which still isn't the decimal representation of the hex

Re: recording input from USB port and write to text file

2009-08-19 Thread Simon Forman
On Aug 18, 7:33 pm, Allan af2...@gmail.com wrote: Hi! I'm fairly new to Python.  I understand the basics basics but I'm been trying to write a simple python code that will let me read input data (such as mouse movement) from my USB port and write it in a text file and I am so lost.  Can anyone

Re: Need cleanup advice for multiline string

2009-08-19 Thread Simon Forman
On Aug 19, 12:05 am, Ben Finney ben+pyt...@benfinney.id.au wrote: Simon Forman sajmik...@gmail.com writes: On Tue, Aug 18, 2009 at 8:42 PM, Ben Finneyben+pyt...@benfinney.id.au wrote: We're all unified by our humanity. Bringing any god into the picture is surely counter to any goals

Re: #elements of seq A in seq B

2009-08-19 Thread Simon Forman
On Aug 19, 8:17 pm, Jan Kaliszewski z...@chopin.edu.pl wrote: 20-08-2009 o 01:19:24 Neal Becker ndbeck...@gmail.com wrote: What would be a time efficient way to count the number of occurrences of elements of sequence A in sequence B?  (in this particular case, these sequences are strings,

Re: #elements of seq A in seq B

2009-08-19 Thread Simon Forman
On Aug 19, 11:34 pm, John Machin sjmac...@lexicon.net wrote: On Aug 20, 12:12 pm, Simon Forman sajmik...@gmail.com wrote: On Aug 19, 8:17 pm, Jan Kaliszewski z...@chopin.edu.pl wrote: If you mean: to count non overlaping occurences of string A in B -- simply:    B.count(A) You

Re: comparing XML files to eachother

2009-08-18 Thread Simon Forman
On Mon, Aug 17, 2009 at 3:51 PM, David Brochubrochu...@gmail.com wrote: I need to compare one xml document to another to see if the content matches. Unfortunately, the formatting (spacing) and order of elements may change between files from run to run. I have looked into xml dom minidom but

Re: define class over 2 files

2009-08-18 Thread Simon Forman
On Tue, Aug 18, 2009 at 1:57 AM, Steven D'Apranoste...@remove.this.cybersource.com.au wrote: On Mon, 17 Aug 2009 21:45:57 -0700, naveen wrote: Is it possible to split up a class definition over multiple files? Not exactly, but you can do variations of this: In file A.py, create: class

Re: Need cleanup advice for multiline string

2009-08-18 Thread Simon Forman
On Tue, Aug 18, 2009 at 1:05 PM, Jean-Michel Pichavantjeanmic...@sequans.com wrote: Steve Holden wrote: Robert Dailey: [...] It's a figure of speech. And besides, why would I want programming advice from a woman? lol. Thanks for the help. Sorry, Robert, simply not acceptable. Whether

Re: Inheriting dictionary

2009-08-18 Thread Simon Forman
On Tue, Aug 18, 2009 at 6:08 PM, Simon Formansajmik...@gmail.com wrote: On Aug 18, 3:44 pm, Pavel Panchekha pavpanche...@gmail.com wrote: I want a dictionary that will transparently inherit from a parent dictionary. So, for example: a = InheritDict({1: one, 2: two, 4: four}) b =

Re: Need cleanup advice for multiline string

2009-08-18 Thread Simon Forman
On Tue, Aug 18, 2009 at 8:03 PM, Steven D'Apranost...@remove-this-cybersource.com.au wrote: On Tue, 18 Aug 2009 17:13:02 -0400, Simon Forman wrote: Sexism, racism, homophobia, religious intolerance, etc., all stem from a fundamental forgetfulness of our Unity in God (as I would put

Re: Need cleanup advice for multiline string

2009-08-18 Thread Simon Forman
On Tue, Aug 18, 2009 at 8:42 PM, Ben Finneyben+pyt...@benfinney.id.au wrote: Simon Forman sajmik...@gmail.com writes: Sexism, racism, homophobia, religious intolerance, etc., all stem from a fundamental forgetfulness of our Unity in God (as I would put it) It seems odd, for someone who cites

Re: problem with interface of operator.itemgetter

2009-08-16 Thread Simon Forman
On Thu, Aug 13, 2009 at 11:16 PM, dou dounirvana...@gmail.com wrote: I have a function to do some thing like LEFT JOIN in SQL, the function use the itemgetter to get the ON and SELECT parameters of the two table(list of list), the problem is that itemgetter may return a value or a tuple of

Re: Splitting a string into substrings of equal size

2009-08-16 Thread Simon Forman
On Aug 14, 8:22 pm, candide cand...@free.invalid wrote: Suppose you need to split a string into substrings of a given size (except possibly the last substring). I make the hypothesis the first slice is at the end of the string. A typical example is provided by formatting a decimal string with

Re: Need cleanup advice for multiline string

2009-08-12 Thread Simon Forman
On Aug 12, 10:41 am, Robert Dailey rcdai...@gmail.com wrote: On Aug 12, 9:09 am, exar...@twistedmatrix.com wrote: On 01:27 pm, jeanmic...@sequans.com wrote: Simon Brunning wrote: 2009/8/11 Robert Dailey rcdai...@gmail.com: On Aug 11, 3:40 pm, Bearophile bearophileh...@lycos.com wrote:

Re: Search and write to .txt file

2009-08-11 Thread Simon Forman
On Aug 11, 7:22 am, Helvin helvin...@gmail.com wrote: Hi everyone, I am writing some python script that should find a line which contains '1' in the data.txt file, then be able to move a certain number of lines down, before replacing a line. At the moment, I am able to find the line '1', but

Re: dictionary help

2009-08-11 Thread Simon Forman
On Aug 11, 11:51 am, MRAB pyt...@mrabarnett.plus.com wrote: Krishna Pacifici wrote: Thanks for the help. Actually this is part of a much larger project, but I have unfortunately pigeon-holed myself into needing to do these things without a whole lot of flexibility. To give a specific

Re: unique-ifying a list

2009-08-09 Thread Simon Forman
On Aug 7, 4:53 pm, kj no.em...@please.post wrote: Suppose that x is some list.  To produce a version of the list with duplicate elements removed one could, I suppose, do this:     x = list(set(x)) but I expect that this will not preserve the original order of elements. I suppose that I

Re: Very Strange Problem

2009-07-30 Thread Simon Forman
On Wed, Jul 29, 2009 at 3:10 PM, Omer Khalidomer.kha...@cern.ch wrote: Hi Dave, Thanks for your reply. I actually didn't cut and paste my code as it was dispersed in different places, i typed the logic behind my code in the email (and obiviously made some typos, indentations is some thing

Re: invoke method on many instances

2009-07-21 Thread Simon Forman
On Jul 20, 3:29 am, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Sat, 18 Jul 2009 12:31:46 -0300, Alan G Isaac alan.is...@gmail.com   escribió: On Fri, 17 Jul 2009 05:19:50 +, Alan G Isaac wrote: def apply2(itr, methodname, *args, **kwargs):     f =

Re: tough-to-explain Python

2009-07-21 Thread Simon Forman
On Mon, Jul 20, 2009 at 9:54 PM, Paul Rubinhttp://phr...@nospam.invalid wrote: Simon Forman sajmik...@gmail.com writes: But I'm glad it's there to study, these are wheels I don't have to invent for myself. http://dwheeler.com/essays/high-assurance-floss.html might be an interesting place

Re: Help understanding the decisions *behind* python?

2009-07-21 Thread Simon Forman
On Jul 20, 12:27 pm, Phillip B Oldham phillip.old...@gmail.com wrote: My colleagues and I have been working with python for around 6 months now, and while we love a lot of what python has done for us and what it enables us to do some of the decisions behind such certain data-types and their

Re: time.strftime('%m-%d-%Y %H:%m:%S') to log is out of order

2009-07-21 Thread Simon Forman
On Jul 21, 5:00 pm, davidj411 davidj...@gmail.com wrote: I am using a recursive function to print the time and a few other things on each pass. ( the function calculates size of file that is being transferred and if not 100 % copied, it waits 20 secs and checks again). i would expect the

Re: time.strftime('%m-%d-%Y %H:%m:%S') to log is out of order

2009-07-21 Thread Simon Forman
On Jul 21, 5:53 pm, davidj411 davidj...@gmail.com wrote: On Jul 21, 5:29 pm, Simon Forman sajmik...@gmail.com wrote: On Jul 21, 5:00 pm, davidj411 davidj...@gmail.com wrote: I am using a recursive function to print the time and a few other things on each pass. ( the function

Re: tough-to-explain Python

2009-07-20 Thread Simon Forman
On Jul 19, 2:51 pm, Paul Rubin http://phr...@nospam.invalid wrote: Calroc forman.si...@gmail.com writes: I'm engaged presently in starting a school to teach programming from the ground up, based roughly on the curriculum outlined in the article I mentioned. ... I'm excited about formal

  1   2   3   4   5   >