unittest2 0.5.0: setuptools compatible test collector and Python 2.3 distribution

2010-07-12 Thread Michael Foord
unittest2 0.5.0 has just been released. This version of unittest2 has feature parity with the version of unittest in Python 2.7: * unittest2 on PyPI http://pypi.python.org/pypi/unittest2 If you want to ensure that your tests run identically under unittest2 and unittest in Python 2.7 you

tox, a new generic virtualenv/test management tool

2010-07-12 Thread holger krekel
I have been talking about it with various people lately and am now happy announce the first release of tox. tox aims to automate tedious Python related test activities driven from a simple ``tox.ini`` file, including: * creation and management of virtualenv environments * installing your Python

Re: [py-dev] tox, a new generic virtualenv/test management tool

2010-07-12 Thread holger krekel
note: it might be that there are crucial issues with tox-0.5 on OSX - Michael reported one which i am investigating. It could break your environment so please use things with care on OSX for now. holger On Mon, Jul 12, 2010 at 13:31 +0200, holger krekel wrote: I have been talking about

tox-0.6: virtualenv-creation fixes on OSX

2010-07-12 Thread holger krekel
Hi all, thanks to Michael Foord's help i just released a tox-0.6 to PYPI which should fix some crucial issues wrt to virtualenv creation on OSX. best, holger On Mon, Jul 12, 2010 at 13:31 +0200, holger krekel wrote: I have been talking about it with various people lately and am now happy

[ANNOUNCE] PyGObject 2.21.5 - unstable

2010-07-12 Thread Tomeu Vizoso
Hi, I am pleased to announce version 2.21.5 of the Python bindings for GObject. The new release is available from ftp.gnome.org as and its mirrors as soon as its synced correctly: http://download.gnome.org/sources/pygobject/2.21/ What's new since PyGObject 2.21.4? - Shut up some

Re: Easy questions from a python beginner

2010-07-12 Thread Stephen Hansen
On 7/11/10 7:25 PM, Alf P. Steinbach /Usenet wrote: The alleged facts etc. you're referring are just that, alleged, by you. Two people come together and have a debate. Both present arguments. Both present cases. In the end, they are still in disagreement. You declare us, religious, and

Re: Easy questions from a python beginner

2010-07-12 Thread Alf P. Steinbach /Usenet
* sturlamolden, on 12.07.2010 06:52: On 11 Jul, 21:37, Alf P. Steinbach /Usenetalf.p.steinbach +use...@gmail.com wrote: Oh, I wouldn't give that advice. It's meaningless mumbo-jumbo. Python works like Java in this respect, that's all; neither Java nor Python support 'swap'. x,y = y,x

Re: Learn Python the Hard Way (online tutorial)

2010-07-12 Thread Chris Rebert
On Sun, Jul 11, 2010 at 10:03 PM, Paul Rubin no.em...@nospam.invalid wrote: I just came across this, a python tutorial purportedly intended for beginning programmers.  I only read the first few pages and I'm not crazy about the approach, but I haven't seen it mentioned here, and some folks

Re: Easy questions from a python beginner

2010-07-12 Thread Steven D'Aprano
On Sun, 11 Jul 2010 21:52:17 -0700, sturlamolden wrote: On 11 Jul, 21:37, Alf P. Steinbach /Usenet alf.p.steinbach +use...@gmail.com wrote: Oh, I wouldn't give that advice. It's meaningless mumbo-jumbo. Python works like Java in this respect, that's all; neither Java nor Python support

Re: Easy questions from a python beginner

2010-07-12 Thread Terry Reedy
On 7/11/2010 1:48 PM, wheres pythonmonks wrote: 2. How can I write a function, def swap(x,y):... so that x = 3; y = 7; swap(x,y); given x=7,y=3?? (I want to use Perl's Ref \ operator, or C's). (And if I cannot do this [other than creating an Int class], is this behavior limited to strings,

Re: Learn Python the Hard Way (online tutorial)

2010-07-12 Thread Stephen Hansen
On 7/11/10 10:59 PM, Chris Rebert wrote: On Sun, Jul 11, 2010 at 10:03 PM, Paul Rubin no.em...@nospam.invalid wrote: I just came across this, a python tutorial purportedly intended for beginning programmers. I only read the first few pages and I'm not crazy about the approach, but I haven't

Re: Naming Conventions, Where's the Convention Waldo?

2010-07-12 Thread Terry Reedy
On 7/11/2010 3:26 AM, rantingrick wrote: Another source of asininity seems to be the naming conventions of the Python language proper! True/False start with an upper case and i applaud this. However str, list, tuple, int, float --need i go on...?-- start with lowercase. This is an anomaly,

Re: Possible to create a read-only complex object?

2010-07-12 Thread Terry Reedy
On 7/11/2010 12:51 PM, pyt...@bdurham.com wrote: I have a complex object with attributes that contain lists, sets, dictionaries, and other objects. The lists and dictionaries may themselves contain complex objects. I would like to provide a read-only version of this type of object for other

Re: Possible to create a read-only complex object?

2010-07-12 Thread Steven D'Aprano
On Mon, 12 Jul 2010 02:56:34 -0400, Terry Reedy wrote: On 7/11/2010 12:51 PM, pyt...@bdurham.com wrote: I have a complex object with attributes that contain lists, sets, dictionaries, and other objects. The lists and dictionaries may themselves contain complex objects. I would like to

Re: Netbeans plugin and Python 3

2010-07-12 Thread Nitin Pawar
Hi, I never tried python3.0 with netbeans but I use python 2.6.5 with netbean 6.7.1 Here is how I managed to change from python 2.5 (netbeans default) to 2.6.5 1) From the tools- plugins section install python plugin 2) Once plugin is installed just restart netbeans so that plugin is activated

PIL Query

2010-07-12 Thread Ankit Jhalaria
Hi I was using the PIL. I found it pretty useful. I was wondering if you could please let me know, whether I could change the image size. What I mean is if suppose I have 100 points having the same latitude and longitude, the point on the map appears (for instance as a red circle). My question to

Re: Naming Conventions, Where's the Convention Waldo?

2010-07-12 Thread Cameron Simpson
On 12Jul2010 02:43, Steven D'Aprano steve-remove-t...@cybersource.com.au wrote: | On Mon, 12 Jul 2010 02:40:07 +, Steven D'Aprano wrote: | On Mon, 12 Jul 2010 01:31:14 +0100, Mark Lawrence wrote: | Well said Steven, or is it Stephen, or Stephan, or Stefen, or what? | | For some reason,

Numpy now supports Python3, Scipy to follow soon

2010-07-12 Thread Steven D'Aprano
Pardon me if this has already been mentioned, but I didn't see it, and this is big big news. The latest release of numpy now supports Python 2.x and 3.x out of a single code base, and Scipy is predicted to follow soon. http://www.mail-archive.com/numpy-discuss...@scipy.org/msg26524.html If I

Design questions for C++ support for Python extensions (cppy)

2010-07-12 Thread Alf P. Steinbach /Usenet
Hi. With the current cppy code the Python 3.1.1 doc's spam example extension module looks like this (actual working code): code #include progrock/cppx/devsupport/better_experience.h #include progrock/cppy/Module.h using namespace progrock; namespace { class Spam:

Re: Possible to create a read-only complex object?

2010-07-12 Thread Chris Rebert
On Mon, Jul 12, 2010 at 12:45 AM, Steven D'Aprano steve-remove-t...@cybersource.com.au wrote: On Mon, 12 Jul 2010 02:56:34 -0400, Terry Reedy wrote: On 7/11/2010 12:51 PM, pyt...@bdurham.com wrote: I have a complex object with attributes that contain lists, sets, dictionaries, and other

Re: Netbeans plugin and Python 3

2010-07-12 Thread Chris Rebert
On Fri, Jul 9, 2010 at 9:27 AM, Nitin Pawar nitinpawar...@gmail.com wrote: Hi, I never tried python3.0 with netbeans but I use python 2.6.5 with netbean 6.7.1 Here is how I managed to change from python 2.5 (netbeans default) to 2.6.5 1) From the tools- plugins section install python plugin

Re: Numpy now supports Python3, Scipy to follow soon

2010-07-12 Thread Almar Klein
On 12 July 2010 10:05, Steven D'Aprano steve-remove-t...@cybersource.com.au wrote: Pardon me if this has already been mentioned, but I didn't see it, and this is big big news. I haven't heard it yet, this is great news! Almar -- http://mail.python.org/mailman/listinfo/python-list

Re: Possible to create a read-only complex object?

2010-07-12 Thread Steven D'Aprano
On Mon, 12 Jul 2010 01:11:53 -0700, Chris Rebert wrote: On Mon, Jul 12, 2010 at 12:45 AM, Steven D'Aprano steve-remove-t...@cybersource.com.au wrote: On Mon, 12 Jul 2010 02:56:34 -0400, Terry Reedy wrote: On 7/11/2010 12:51 PM, pyt...@bdurham.com wrote: I have a complex object with

Re: Easy questions from a python beginner

2010-07-12 Thread bart.c
MRAB pyt...@mrabarnett.plus.com wrote in message news:mailman.591.1278900548.1673.python-l...@python.org... Alf P. Steinbach /Usenet wrote: def foo(): print( blah ) blah = this is both an assignment and a declaration causing it to exist foo() Clearly when the exception is

Re: Possible to create a read-only complex object?

2010-07-12 Thread geremy condra
On Mon, Jul 12, 2010 at 3:45 AM, Steven D'Aprano steve-remove-t...@cybersource.com.au wrote: On Mon, 12 Jul 2010 02:56:34 -0400, Terry Reedy wrote: On 7/11/2010 12:51 PM, pyt...@bdurham.com wrote: I have a complex object with attributes that contain lists, sets, dictionaries, and other

Re: 'reload M' doesn't update 'from M inport *'

2010-07-12 Thread Jean-Michel Pichavant
Aahz wrote: In article mailman.488.1278697107.1673.python-l...@python.org, Jean-Michel Pichavant jeanmic...@sequans.com wrote: PS : You're misusing the del statement. It does not remove any object from mmory, however, it removes the reference to it, the object is still in memory.

Re: 'reload M' doesn't update 'from M inport *'

2010-07-12 Thread Jean-Michel Pichavant
Hi, Don't use reload, this is nothing but a trap, espacially if your using it to update your objects with the code you are writting. JM I've found reload very usable for development in IDLE. IDLE memorizes my input, and the variables I assign output to. If restart IDLE I lose it all

round issue

2010-07-12 Thread Robin Becker
A client wants to know why his db number -9.85 gets displayed by some simple code as -9.8 I looked at the number and see that -9.85 -9.8496 ie I expect simple rounding to produce the observed result and indeed '%.1f' % -9.85 '-9.8' however, when I use round I get an unexpected

Python conference and user group statistics

2010-07-12 Thread M.-A. Lemburg
Hello, I am currently working on a Python Software Foundation (PSF) project to create marketing material for Python with the aim of providing this to Python conferences and user groups. In order to come up with reasonable figures for the number of brochures and flyers to print, I'd like to get a

Re: Easy questions from a python beginner

2010-07-12 Thread Duncan Booth
Alf P. Steinbach /Usenet alf.p.steinbach+use...@gmail.com wrote: * sturlamolden, on 12.07.2010 06:52: On 11 Jul, 21:37, Alf P. Steinbach /Usenetalf.p.steinbach +use...@gmail.com wrote: Oh, I wouldn't give that advice. It's meaningless mumbo-jumbo. Python works like Java in this respect,

Re: Why doesn't python's list append() method return the list itself?

2010-07-12 Thread dhruvbird
On Jul 12, 5:30 am, News123 news1...@free.fr wrote: dhruvbird wrote: On a side note, is there any other way to append to a list using slices (apart from the one below): x[len(x):len(x)] = [item to append] dy you mean x.extend([1,2,3]) No, I meant x.append(4) Except that I want to

Re: Easy questions from a python beginner

2010-07-12 Thread Steven D'Aprano
On Mon, 12 Jul 2010 09:48:04 +0100, bart.c wrote: That's interesting. So in Python, you can't tell what local variables a function has just by looking at it's code: In the presence of exec, you can't really tell *anything*. def f(s): ... exec s ... print locals() ... f(x = 2;y =

Re: integer = 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-12 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: My complaint (an oddly enough the title of this thread!) concerns the fact that Python treats 0 as False and every integer above and below 0 as True. Which is another example of how *some* aspects of Python support bad coding styles. Yes, Python does support bad

Re: Naming Conventions, Where's the Convention Waldo?

2010-07-12 Thread Jean-Michel Pichavant
rantingrick wrote: On Jul 11, 3:03 am, Günther Dietrich gd.use...@spamfence.net wrote: So, it is not a disadvantage that the functions you listed above are named in this way. In the contrary, it is an advantage, as it keeps newcomers from using stupid variable names. int for an

Re: round issue

2010-07-12 Thread Mark Dickinson
On Jul 12, 10:52 am, Robin Becker ro...@reportlab.com wrote: What value should round(-9.85,1) return? Is the result explainable in python (ie without resort to the internal FP representations etc etc)? As you observe, the closest float to -9.85 is actually just a little smaller (i.e., closer

Re: Only one forum app in Python?

2010-07-12 Thread Gilles Ganault
On Sat, 10 Jul 2010 18:37:00 +0200, Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr wrote: There are almost a dozen of Python forum apps for Django alone, and Python is known as the language with more web frameworks than keywords. Thanks for the tip. I'll head that way. --

Re: grailbrowser now running under python 2.5 (probably above too)

2010-07-12 Thread Fuzzyman
On Jul 12, 1:21 am, rantingrick rantingr...@gmail.com wrote: On Jul 11, 5:28 pm,Fuzzymanfuzzy...@gmail.com wrote: But why hijack someone else's announcement to do that? Congratulations alone would have been great. However good your intentions your message came across as but it would really

Re: Only one forum app in Python?

2010-07-12 Thread James Mills
On Mon, Jul 12, 2010 at 8:49 PM, Gilles Ganault nos...@nospam.com wrote: There are almost a dozen of Python forum apps for Django alone, and Python is known as the language with more web frameworks than keywords. Speaking of frameworks and python forums, sahriswiki 91) is not a forum, but it's

Re: Why doesn't python's list append() method return the list itself?

2010-07-12 Thread Hrvoje Niksic
dhruvbird dhruvb...@gmail.com writes: No, I meant x.append(4) Except that I want to accomplish it using slices. (I can do it as x[lex(x):] = [item_to_append] but is there any other way?) It seems that you've found a way to do so, so why do you need another way? Are you after elegance?

Re: Easy questions from a python beginner

2010-07-12 Thread bart.c
Steven D'Aprano st...@remove-this-cybersource.com.au wrote in message news:4c3aedd5$0$28647$c3e8...@news.astraweb.com... On Mon, 12 Jul 2010 09:48:04 +0100, bart.c wrote: That's interesting. So in Python, you can't tell what local variables a function has just by looking at it's code: def

Re: Why doesn't python's list append() method return the list itself?

2010-07-12 Thread Nathan Rice
Stephen: I'm not adverse to being able to do that, but the number of times that I've wanted to do that is greatly outweighed by the number of times I've had to pass a function (somestring,) or call if isinstance(foo, basestring): ... to avoid producing a bug. The more abstract and adaptive the

iptcinfo: Can not import: Newbie not really knowing what he is doing

2010-07-12 Thread mcl
My Code `import os from PIL import Image from iptcinfo import IPTCInfo info = IPTCInfo('test.jpg') print info.keywords, info.supplementalCategories, info.contacts caption = info.data['caption/abstract'] print caption` running Win XP SP3 I get the message No module: iptcinfo I have downloaded

Re: any issues with long running python apps?

2010-07-12 Thread Grant Edwards
On 2010-07-09, Les Schaffer schaf...@optonline.net wrote: i have been asked to guarantee that a proposed Python application will run continuously under MS Windows for two months time. And i am looking ^^ IMO, that's going to be your main problem. -- Grant

Re: Easy questions from a python beginner

2010-07-12 Thread Grant Edwards
On 2010-07-11, Thomas Jollans tho...@jollans.com wrote: On 07/11/2010 08:45 PM, wheres pythonmonks wrote: On #3: Sorry this is confusing, but I was browsing some struct array code from numpy, in which one of the columns contained strings, but the type information, supplied in numpy.array's

ValueError: invalid literal for float(): -1.#IND (pickle.py)

2010-07-12 Thread Alexander Eisenhuth
Hello together, python: 2.5.1 palttform: winXP I'm using pickle.dump and pickle.load with data that is created in a wrapped (boost.python) piece of C++ code. pickle.dump works fine. pickle.load creates the following exception: [...] data = pickle.load(input) File

Re: ValueError: invalid literal for float(): -1.#IND (pickle.py)

2010-07-12 Thread Grant Edwards
On 2010-07-12, Alexander Eisenhuth newsu...@stacom-software.de wrote: python: 2.5.1 palttform: winXP I'm using pickle.dump and pickle.load with data that is created in a wrapped (boost.python) piece of C++ code. pickle.dump works fine. pickle.load creates the following exception: [...]

Re: ValueError: invalid literal for float(): -1.#IND (pickle.py)

2010-07-12 Thread Grant Edwards
On 2010-07-12, Grant Edwards inva...@invalid.invalid wrote: On 2010-07-12, Alexander Eisenhuth newsu...@stacom-software.de wrote: python: 2.5.1 palttform: winXP I'm using pickle.dump and pickle.load with data that is created in a wrapped (boost.python) piece of C++ code. pickle.dump works

Re: Easy questions from a python beginner

2010-07-12 Thread sturlamolden
On 12 Jul, 07:51, Alf P. Steinbach /Usenet alf.p.steinbach +use...@gmail.com wrote: We're talking about defining a 'swap' routine that works on variables. I did not miss the point. One cannot make a swap function that rebinds its arguments in the calling stack frame. But a swap function can

Re: ValueError: invalid literal for float(): -1.#IND (pickle.py)

2010-07-12 Thread Mark Dickinson
Alexander Eisenhuth newsuser at stacom-software.de writes: File C:\Python25\lib\pickle.py, line 954, in load_float self.append(float(self.readline()[:-1])) ValueError: invalid literal for float(): -1.#IND - I'm not sure what -1.#IND means. Can somebody assist? It's the Windows way

Re: iptcinfo: Can not import: Newbie not really knowing what he is doing

2010-07-12 Thread Nick Raptis
Hi Richard! I have downloaded iptcinfo and placed it in python27\Lib\site-packages \iptcinfo I guessed that was the right place, because that is where PIL ended up, but that had a fancy installer with it. You did place it in the right path, but the fancy installer does one more thing, it

Re: round issue

2010-07-12 Thread Gary Herron
On 07/12/2010 02:52 AM, Robin Becker wrote: A client wants to know why his db number -9.85 gets displayed by some simple code as -9.8 I looked at the number and see that -9.85 -9.8496 ie I expect simple rounding to produce the observed result and indeed '%.1f' % -9.85 '-9.8'

Re: grailbrowser now running under python 2.5 (probably above too)

2010-07-12 Thread Thomas Jollans
On 07/12/2010 01:44 AM, rantingrick wrote: On Jul 11, 11:31 am, Thomas Jollans tho...@jollans.com wrote: On 07/11/2010 07:44 AM, rantingrick wrote: Congratulations on this effort Luke. However you know what project i would really like to see the community get around? ...dramatic pause

Re: any issues with long running python apps?

2010-07-12 Thread John Nagle
On 7/12/2010 7:19 AM, Grant Edwards wrote: On 2010-07-09, Les Schafferschaf...@optonline.net wrote: i have been asked to guarantee that a proposed Python application will run continuously under MS Windows for two months time. And i am looking ^^ IMO, that's

Node based architecture

2010-07-12 Thread King
Hi, I am planning to build a generic node based framework using python. I would start with a simple image editing application. I hope that experienced users understands what am I trying to say here. In simple words: LoaderNode : Load Image from disk OperatorNode : Performs a specific task on

Re: Easy questions from a python beginner

2010-07-12 Thread Alf P. Steinbach /Usenet
* sturlamolden, on 12.07.2010 16:59: On 12 Jul, 07:51, Alf P. Steinbach /Usenetalf.p.steinbach +use...@gmail.com wrote: We're talking about defining a 'swap' routine that works on variables. I did not miss the point. One cannot make a swap function that rebinds its arguments in the calling

Re: Problems running VirtualEnv under Windows.

2010-07-12 Thread ashconnor
I've resolved this issue by deleting the *.py file association in Windows. You can do this either by associating *.py with something like textpad, using a utility such as http://defaultprogramseditor.com/ or doing so in the registry. Note that when using the command like you need to issue

Re: round issue

2010-07-12 Thread Emile van Sebille
On 7/12/2010 2:52 AM Robin Becker said... snip What value should round(-9.85,1) return? Per round's definition, -9.9. String interpolation for %n.mf doesn't appear to define it's rounding behavior, so a peek at the source would answer what's being done. It does look inconsistent however,

GUIs (was: grailbrowser now running under python 2.5 (probably above too))

2010-07-12 Thread John Bokma
MRAB pyt...@mrabarnett.plus.com writes: John Bokma wrote: [..] Can't think of why not. Of course not all operations are shared by each OS, but /I/ know that I can't do chmod on Windows. But it doesn't mean that on Windows I can't make a file only readable by me. Just give me the Windows

Re: Easy questions from a python beginner

2010-07-12 Thread Alf P. Steinbach /Usenet
* Steven D'Aprano, on 12.07.2010 04:39: On Mon, 12 Jul 2010 03:12:10 +0200, Alf P. Steinbach /Usenet wrote: * MRAB, on 12.07.2010 00:37: [...] In Java a variable is declared and exists even before the first assignment to it. In Python a 'variable' isn't declared and won't exist until the

Re: any issues with long running python apps?

2010-07-12 Thread CM
On Jul 12, 1:16 pm, John Nagle na...@animats.com wrote: On 7/12/2010 7:19 AM, Grant Edwards wrote: On 2010-07-09, Les Schafferschaf...@optonline.net  wrote: i have been asked to guarantee that a proposed Python application will run continuously under MS Windows for two months time. And i

Re: round issue

2010-07-12 Thread Mark Dickinson
Emile van Sebille emile at fenx.com writes: On 7/12/2010 2:52 AM Robin Becker said... snip What value should round(-9.85,1) return? Per round's definition, -9.9. No. The float that's represented by the literal '-9.85' *isn't* exactly -9.85, for all the usual binary floating-point

Re: Why doesn't python's list append() method return the list itself?

2010-07-12 Thread dhruvbird
On Jul 12, 4:20 pm, Hrvoje Niksic hnik...@xemacs.org wrote: dhruvbird dhruvb...@gmail.com writes: No, I meant x.append(4) Except that I want to accomplish it using slices. (I can do it as x[lex(x):] = [item_to_append] but is there any other way?) It seems that you've found a way to do

Re: Why doesn't python's list append() method return the list itself?

2010-07-12 Thread John Nagle
On 7/11/2010 5:24 PM, Steven D'Aprano wrote: On Sun, 11 Jul 2010 08:59:06 -0700, dhruvbird wrote: Why doesn't python's list append() method return the list itself? For that matter, even the reverse() and sort() methods? I found this link (http://code.google.com/edu/languages/google-python-

Re: iptcinfo: Can not import: Newbie not really knowing what he is doing

2010-07-12 Thread mcl
On Jul 12, 4:11 pm, Nick Raptis airsc...@otenet.gr wrote: Hi Richard! I have downloaded iptcinfo and placed it in python27\Lib\site-packages \iptcinfo I guessed that was the right place, because that is where PIL ended up, but that had a fancy installer with it. You did place it in the

Re: Easy questions from a python beginner

2010-07-12 Thread Rhodri James
On Mon, 12 Jul 2010 13:56:38 +0100, bart.c ba...@freeuk.com wrote: Steven D'Aprano st...@remove-this-cybersource.com.au wrote in message news:4c3aedd5$0$28647$c3e8...@news.astraweb.com... On Mon, 12 Jul 2010 09:48:04 +0100, bart.c wrote: That's interesting. So in Python, you can't tell what

how to delete \n

2010-07-12 Thread Jia Hu
Hi, I just want to delete \n at each line. My operating system is ubuntu 9.1. The code is as follows #!/usr/bin/python import string fileName=open('Direct_Irr.txt', 'r') # read file directIrr = fileName.readlines() fileName.close() for line in directIrr: line.rstrip('\n') print directIrr

Re: any issues with long running python apps?

2010-07-12 Thread John Bokma
John Nagle na...@animats.com writes: Yesterday, I was running a CNC plasma cutter that's controlled by Windows XP. This is a machine that moves around a plasma torch that cuts thick steel plate. A New Java update is available window popped up while I was working. Not good. You can

Re: how to delete \n

2010-07-12 Thread Matteo Landi
I hope this could help: f = open('powersave.sh') map(lambda s: s.strip(), f.readlines()) ['echo 1 /sys/module/snd_hda_intel/parameters/power_save', 'echo min_power /sys/class/scsi_host/host0/link_power_management_policy', 'echo 1 /sys/module/snd_hda_intel/parameters/power_save'] I know for

Re: how to delete \n

2010-07-12 Thread Ian Kelly
On Mon, Jul 12, 2010 at 2:27 PM, Jia Hu huji...@gmail.com wrote: Hi, I just want to delete \n at each line. My operating system is ubuntu 9.1. The code is as follows #!/usr/bin/python import string fileName=open('Direct_Irr.txt', 'r') # read file directIrr = fileName.readlines()

Re: Easy questions from a python beginner

2010-07-12 Thread Alister Ware
On Sun, 11 Jul 2010 18:17:49 +, Duncan Booth wrote: wheres pythonmonks wherespythonmo...@gmail.com wrote: I'm an old Perl-hacker, and am trying to Dive in Python. I have some easy issues (Python 2.6) which probably can be answered in two seconds: without going into details on how to

Re: Easy questions from a python beginner

2010-07-12 Thread Terry Reedy
On 7/12/2010 4:48 AM, bart.c wrote: def foo(): print(Before:, locals()) x = 0 print(After:, locals()) foo() Before: {} After: {'x': 0} That's interesting. So in Python, you can't tell what local variables a function has just by looking at it's code: You are being fooled by the multiple

Re: how to delete \n

2010-07-12 Thread Chris Rebert
On Mon, Jul 12, 2010 at 1:27 PM, Jia Hu huji...@gmail.com wrote: Hi, I just want to delete \n at each line. My operating system is ubuntu 9.1. The code is as follows #!/usr/bin/python import string fileName=open('Direct_Irr.txt', 'r') # read file directIrr = fileName.readlines()

Re: Numpy now supports Python3, Scipy to follow soon

2010-07-12 Thread Terry Reedy
On 7/12/2010 4:05 AM, Steven D'Aprano wrote: Pardon me if this has already been mentioned, but I didn't see it, and this is big big news. The latest release of numpy now supports Python 2.x and 3.x out of a single code base, and Scipy is predicted to follow soon.

Re: Easy questions from a python beginner

2010-07-12 Thread Alf P. Steinbach /Usenet
* Rhodri James, on 12.07.2010 22:19: On Mon, 12 Jul 2010 13:56:38 +0100, bart.c ba...@freeuk.com wrote: Steven D'Aprano st...@remove-this-cybersource.com.au wrote in message news:4c3aedd5$0$28647$c3e8...@news.astraweb.com... On Mon, 12 Jul 2010 09:48:04 +0100, bart.c wrote: That's

multitask http server (single-process multi-connection HTTP server)

2010-07-12 Thread lkcl
for several reasons, i'm doing a cooperative multi-tasking HTTP server: git clone git://pyjs.org/git/multitaskhttpd.git there probably exist perfectly good web frameworks that are capable of doing this sort of thing: i feel certain that twisted is one of them. however, the original author of

Standard distutils package problems with MSVC / lacking functionality?

2010-07-12 Thread Alf P. Steinbach /Usenet
I let the setup.py script talk: code # 03_1__noddy from distutils.core import setup, Extension import distutils.ccompiler compilerName = distutils.ccompiler.get_default_compiler() options = [] if compilerName == msvc: # * distutils sets warning level 3: # Overriding with warning

Re: Lua is faster than Fortran???

2010-07-12 Thread Дамјан Георгиевски
On the positive side, Lua supports tail call optimization and coroutines are built in by default. -- дамјан ((( http://damjan.softver.org.mk/ ))) Education is one of the prices of freedom that some are unwilling to pay. -- http://mail.python.org/mailman/listinfo/python-list

Re: how to delete \n

2010-07-12 Thread python
Jia, print ''.join( open( 'Direct_Irr.txt' ).read().split() ) Broken out: - open(): open file - read(): read its entire contents as one string - split(): split the contents into a list of lines (splits lines at \n; does not include \n in split values) - ''.join(): join list of lines with an

Re: how to delete \n

2010-07-12 Thread Jia Hu
Thank you. It works now. if I use 'print' to print the whole list, 'print' will add newline at the end of the list but not each item in the list. right? For the code: for line in fileName: line = line.rstrip('\n') I think this will affect 'fileName' because it assign the value to 'line' ?

Re: how to delete \n

2010-07-12 Thread Thomas Jollans
On 07/12/2010 11:29 PM, pyt...@bdurham.com wrote: Jia, print ''.join( open( 'Direct_Irr.txt' ).read().split() ) Broken out: - open(): open file - read(): read its entire contents as one string - split(): split the contents into a list of lines (splits lines at \n; does not include

Re: multitask http server (single-process multi-connection HTTP server)

2010-07-12 Thread Gelonida
Hi lkcl, Do you have any documentation or overview for your project? Questions I would be interested in: - List of features already working - list of features under development - list of features being in in the near future lkcl wrote: for several reasons, i'm doing a cooperative

Re: how to delete \n

2010-07-12 Thread python
Thomas, split() also splits at other whitespace. Doh! Corrected version follows: print ''.join( open( 'Direct_Irr.txt' ).read().splitlines() ) Broken out: - open(): open file - read(): read its entire contents as one string - splitlines(): split the contents into a list of lines (splits

Why did I Embrace Islam?

2010-07-12 Thread nais-saudi
Why did I Embrace Islam? This is an extract from Dr. Gronier, a French MP, who embraced Islam. Revealing the reason of embracing Islam he said, I read all of the Ayat (Quranic verses), which have a relation to medical, health, and natural sciences that I studied before and have a wide knowledge

Help choosing license for new projects

2010-07-12 Thread Jake b
I'm starting a new python code project. What license do you suggest? I am searching, but I'm not finding a simple comparison of licenses. So I don't know which to use. Maybe MIT or Apache or LGPL or BSD? Are there certain licenses to avoid using because of interaction problems between libraries

Re: any issues with long running python apps?

2010-07-12 Thread Tim Chase
On 07/12/2010 12:16 PM, John Nagle wrote: On 7/12/2010 7:19 AM, Grant Edwards wrote: On 2010-07-09, Les Schafferschaf...@optonline.net wrote: i have been asked to guarantee that a proposed Python application will run continuously under MS Windows for two months time. And i am looking

Re: Why did I Embrace Islam?

2010-07-12 Thread Alister Ware
On Mon, 12 Jul 2010 14:54:00 -0700, nais-saudi wrote: Why did I Embrace Islam? snip Very interesting good fro you but I cannot find any thing related to python here. -- This place just isn't big enough for all of us. We've got to find a way off this planet. --

Re: Easy questions from a python beginner

2010-07-12 Thread Rami Chowdhury
Perhaps I'm misunderstanding, but ... On Jul 12, 2010, at 13:57 , Alf P. Steinbach /Usenet wrote: Existence of a variable means, among other things, that * You can use the value, with guaranteed effect (either unassigned exception or you get a proper value) Surely by that definition

Re: multitask http server (single-process multi-connection HTTP server)

2010-07-12 Thread geremy condra
On Mon, Jul 12, 2010 at 4:59 PM, lkcl luke.leigh...@gmail.com wrote: for several reasons, i'm doing a cooperative multi-tasking HTTP server:  git clone git://pyjs.org/git/multitaskhttpd.git there probably exist perfectly good web frameworks that are capable of doing this sort of thing: i

Python 3 grammar, function parameters

2010-07-12 Thread Junkman
Greetings to Python users, I'm trying to parse Python code using the grammar supplied with the documentation set, and have a question on the grammar for function parameters: funcdef: 'def' NAME parameters ['-' test] ':' suite parameters: '(' [typedargslist] ')' typedargslist: ((tfpdef ['=' test]

Re: Easy questions from a python beginner

2010-07-12 Thread Alf P. Steinbach /Usenet
* Rami Chowdhury, on 13.07.2010 00:14: Perhaps I'm misunderstanding, but ... On Jul 12, 2010, at 13:57 , Alf P. Steinbach /Usenet wrote: Existence of a variable means, among other things, that * You can use the value, with guaranteed effect (either unassigned exception or you get a

Re: Help choosing license for new projects

2010-07-12 Thread geremy condra
On Mon, Jul 12, 2010 at 6:00 PM, Jake b ninmonk...@gmail.com wrote: I'm starting a new python code project. What license do you suggest? I am searching, but I'm not finding a simple comparison of licenses. So I don't know which to use. Maybe MIT or Apache or LGPL or BSD? Fair warning: I like

Re: multitask http server (single-process multi-connection HTTP server)

2010-07-12 Thread Luke Kenneth Casson Leighton
On Mon, Jul 12, 2010 at 10:13 PM, geremy condra debat...@gmail.com wrote: On Mon, Jul 12, 2010 at 4:59 PM, lkcl luke.leigh...@gmail.com wrote: for several reasons, i'm doing a cooperative multi-tasking HTTP server:  git clone git://pyjs.org/git/multitaskhttpd.git there probably exist

Re: Help choosing license for new projects

2010-07-12 Thread Ben Finney
Jake b ninmonk...@gmail.com writes: I want: 1] Pretty much let anyone use it. Users do not have to include source code, as long as I get credit. (which I think normallly is a textfile with project url + name?) The simplest effective license that requires nothing more that attribution is

Re: Easy questions from a python beginner

2010-07-12 Thread Steven D'Aprano
On Mon, 12 Jul 2010 20:28:49 +0200, Alf P. Steinbach /Usenet wrote: As I see it it doesn't matter whether the implementation is CPython call frame slots or that mechanism called something else or a different mechanism called the same or a different mechanism called something different; what

Re: multitask http server (single-process multi-connection HTTP server)

2010-07-12 Thread lkcl
On Jul 12, 9:52 pm, Gelonida gelon...@gmail.com wrote: Hi lkcl, Do you have any documentation or overview for your project? git clone git://pyjs.org/git/multitaskhttpd.git i only started it today, but yes, there's a README. the primary reason it's being developed is because GNUmed are

Re: Help choosing license for new projects

2010-07-12 Thread Steven D'Aprano
On Mon, 12 Jul 2010 17:00:22 -0500, Jake b wrote: I'm starting a new python code project. What license do you suggest? I am searching, but I'm not finding a simple comparison of licenses. So I don't know which to use. Maybe MIT or Apache or LGPL or BSD?

Re: Easy questions from a python beginner

2010-07-12 Thread Steven D'Aprano
On Mon, 12 Jul 2010 22:57:10 +0200, Alf P. Steinbach /Usenet wrote: Existence of a variable means, among other things, that * You can use the value, with guaranteed effect (either unassigned exception or you get a proper value): in particular, you won't be accessing a

Re: Easy questions from a python beginner

2010-07-12 Thread Alf P. Steinbach /Usenet
* Steven D'Aprano, on 13.07.2010 01:50: On Mon, 12 Jul 2010 22:57:10 +0200, Alf P. Steinbach /Usenet wrote: Existence of a variable means, among other things, that * You can use the value, with guaranteed effect (either unassigned exception or you get a proper value): in

Re: Easy questions from a python beginner

2010-07-12 Thread Alf P. Steinbach /Usenet
* Steven D'Aprano, on 13.07.2010 01:34: On Mon, 12 Jul 2010 20:28:49 +0200, Alf P. Steinbach /Usenet wrote: As I see it it doesn't matter whether the implementation is CPython call frame slots or that mechanism called something else or a different mechanism called the same or a different

Re: integer = 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-12 Thread Steven D'Aprano
On Mon, 12 Jul 2010 12:34:46 +0200, Jean-Michel Pichavant wrote: Well, actually some people might think otherwise. While I disagree with the OP flaming style, one could argue that muting an integer into a boolean makes no sense (I'm one of them). You can still do it, but there is no right way

  1   2   3   >