Re: try... except with unknown error types

2011-08-23 Thread Paul Rubin
Chris Angelico writes: > Ehh, granted. Definitely a case of "should". But certainly, there > won't be an infinite number of new exceptions invented; Right, the number is finite, but the issue is that it's unknown. It's like never knowing whether you've fixed the last bug in a program. -- http:

Re: Adding modified methods from another class without subclassing

2011-08-23 Thread Steven D'Aprano
On Mon, 22 Aug 2011 11:08 pm John O'Hagan wrote: > On Mon, 22 Aug 2011 15:27:36 +1000 > Steven D'Aprano wrote: [...] >> # Untested >> class MySeq(object): >> methods_to_delegate = ('__getitem__', '__len__', ...) >> pitches = ... # make sure pitches is defined >> def __getattr__(self,

Re: CGI input: Filter dict.update() unwanted variables

2011-08-23 Thread Chris Angelico
On Mon, Aug 22, 2011 at 4:39 PM, Miki Tebeka wrote: > You can check if there is a "non-allowed variable" and then return HTTP error. > if set(form) - set(allowedVariables): >    print('Status: 406\n\n') >    raise SystemExit() > I'd be disinclined to do this; ignore unrecognized query variables,

Re: try... except with unknown error types

2011-08-23 Thread Chris Angelico
On Tue, Aug 23, 2011 at 8:21 AM, Paul Rubin wrote: > Chris Angelico writes: >> Ehh, granted. Definitely a case of "should". But certainly, there >> won't be an infinite number of new exceptions invented; > > Right, the number is finite, but the issue is that it's unknown.  It's > like never knowi

Re: Setting the time in Win7

2011-08-23 Thread Tim Golden
On 22/08/2011 20:42, Bob Greschke wrote: Several people have been hacking away on this computer we are testing on, so I'm not sure what settings -- other than all of them -- have been messed with, but popen("time ...") seems to work, but system("time ...") does not. I'm going to restore the machi

Re: try... except with unknown error types

2011-08-23 Thread Steven D'Aprano
On Mon, 22 Aug 2011 04:26 am Paul Rubin wrote: > The Erlang approach is tempting. Don't catch the exception at all--just > let the process crash, and restart it. But that's a more heavyweight > operation in Python. You might be interested in this paper: http://usenix.org/events/hotos03/tech/fu

Re: try... except with unknown error types

2011-08-23 Thread gene heskett
On Tuesday, August 23, 2011 04:42:04 AM Chris Angelico did opine: > On Tue, Aug 23, 2011 at 8:21 AM, Paul Rubin wrote: > > Chris Angelico writes: > >> Ehh, granted. Definitely a case of "should". But certainly, there > >> won't be an infinite number of new exceptions invented; > > > > Right, t

Re: try... except with unknown error types

2011-08-23 Thread Chris Angelico
On Tue, Aug 23, 2011 at 9:43 AM, gene heskett wrote: > OTOH, ChrisA, I have it on good authority that no program is ever finished, > until someone shoots the programmer.  :) > Correct, although I've had projects that were killed by changes to requirements - such as my fantastic system for writing

Why __slots__ slows down attribute access?

2011-08-23 Thread Jack
People have illusion that it is faster to visit the attribute defined by __slots__ . http://groups.google.com/group/comp.lang.python/msg/c4e413c3d86d80be That is wrong. The following tests show it is slower. __slots__ are implemented at the class level by creating descriptors (Implementing Descrip

Re: Why __slots__ slows down attribute access?

2011-08-23 Thread Peter Otten
Jack wrote: > People have illusion that it is faster to visit the attribute defined > by __slots__ . > http://groups.google.com/group/comp.lang.python/msg/c4e413c3d86d80be > > That is wrong. The following tests show it is slower. Not so fast. Here's what I get (python2.6.4, 64 bit): $ python -

Re: Why __slots__ slows down attribute access?

2011-08-23 Thread John-John Tedro
On Tue, Aug 23, 2011 at 12:26 PM, Peter Otten <__pete...@web.de> wrote: > Jack wrote: > > > People have illusion that it is faster to visit the attribute defined > > by __slots__ . > > http://groups.google.com/group/comp.lang.python/msg/c4e413c3d86d80be > > > > That is wrong. The following tests s

Re: Why __slots__ slows down attribute access?

2011-08-23 Thread Adam Skutt
On Aug 23, 5:48 am, Jack wrote: > People have illusion that it is faster to visit the attribute defined > by __slots__ > .http://groups.google.com/group/comp.lang.python/msg/c4e413c3d86d80be > > That is wrong. The following tests show it is slower. No, they don't really show anything. The defau

is there any principle when writing python function

2011-08-23 Thread smith jack
i have heard that function invocation in python is expensive, but make lots of functions are a good design habit in many other languages, so is there any principle when writing python function? for example, how many lines should form a function? -- http://mail.python.org/mailman/listinfo/python-li

Re: is there any principle when writing python function

2011-08-23 Thread Peter Otten
smith jack wrote: > i have heard that function invocation in python is expensive, but make > lots of functions are a good design habit in many other languages, so > is there any principle when writing python function? > for example, how many lines should form a function? Five ;) -- http://mail.p

Re: is there any principle when writing python function

2011-08-23 Thread Mel
smith jack wrote: > i have heard that function invocation in python is expensive, but make > lots of functions are a good design habit in many other languages, so > is there any principle when writing python function? It's hard to discuss in the abstract. A function should perform a recognizabl

Re: is there any principle when writing python function

2011-08-23 Thread Roy Smith
In article , smith jack wrote: > i have heard that function invocation in python is expensive, but make > lots of functions are a good design habit in many other languages, so > is there any principle when writing python function? > for example, how many lines should form a function? Enough lin

Re: is there any principle when writing python function

2011-08-23 Thread Roy Smith
In article , Peter Otten <__pete...@web.de> wrote: > smith jack wrote: > > > i have heard that function invocation in python is expensive, but make > > lots of functions are a good design habit in many other languages, so > > is there any principle when writing python function? > > for example,

Re: is there any principle when writing python function

2011-08-23 Thread Ulrich Eckhardt
smith jack wrote: > i have heard that function invocation in python is expensive, but make > lots of functions are a good design habit in many other languages, so > is there any principle when writing python function? > for example, how many lines should form a function? Don't compromise the desig

Fwd: is there any principle when writing python function

2011-08-23 Thread Yaşar Arabacı
I accidentally sent below mail only to roy. Resending to groups. -- Yönlendirilmiş ileti -- Kimden: Yaşar Arabacı Tarih: 23 Ağustos 2011 16:19 Konu: Re: is there any principle when writing python function Kime: Roy Smith I don't see myself a good python programmer or anything,

Hiding token information from users

2011-08-23 Thread Tobiah
I am making QR codes that cell phone users scan in order to make use of an application. Part of the information is a token that needs to be passed on to the server, but I'd rather not allow a person examining the QR code to be able to see that plain bit of information. I'd like to scramble up th

PyDev 2.2.2 Released

2011-08-23 Thread Fabio Zadrozny
Hi All, PyDev 2.2.2 has been released Details on PyDev: http://pydev.org Details on its development: http://pydev.blogspot.com Release Highlights: --- **IPython / Interactive console** * IPython (0.10 or 0.11) is now used as the interactive console backend if Py

Re: Python Windows Extensions for Mac

2011-08-23 Thread Christian Heimes
Am 22.08.2011 15:07, schrieb johnny.venter: > Chris, thank you for the information. Focusing on Active Directory, I > reviewed the info at the following site: > http://technet.microsoft.com/en-us/library/cc961766.aspx > > Based on this, I need to find a module that implements the LDAP APIs. By

Directly executing from an egg

2011-08-23 Thread RVince
I have created an egg file with one source file in it, hello.py (I just want to go through the entire uild/install/execute cycle using egg files). I create it fine, and now I want to execute the eg file directly (i.e. run it without unpacking or easy_install'ing it). So when I invoke it from the di

why i cannot invoke python script using command line?

2011-08-23 Thread smith jack
but i can invoke it in eclipse, what's wrong? the script refered to another python script in eclipse project. f:\project\src\a.py f:\project\src\lib\b.py there is such lines in a.py from lib import b i can invoke a.py very well in eclipse but failed when using python f:\project\src\a.py, what's

Methods on file-like objects can only used once on one object?

2011-08-23 Thread Yingjie Lin
Hi Python users, I just realize that my post yesterday shouldn't be specifically for mechanize. It should be a general question for file-like objects. >>> f = open('my_file.txt') >>> print f.readlines() ( prints a list of strings >>> print f.readlines() [] There are quite a few methods

Re: why i cannot invoke python script using command line?

2011-08-23 Thread John Gordon
In smith jack writes: > but i can invoke it in eclipse, what's wrong? > the script refered to another python script in eclipse project. > f:\project\src\a.py > f:\project\src\lib\b.py > there is such lines in a.py > from lib import b > i can invoke a.py very well in eclipse > but failed whe

Re: why i cannot invoke python script using command line?

2011-08-23 Thread Chris Angelico
On Tue, Aug 23, 2011 at 3:03 PM, smith jack wrote: > but failed when using python f:\project\src\a.py, what's wrong? > (the error msg shows a.py cannot find b.py) , what should i do in > order to run a.py using command line? > >From the sound of things, your working directory is not f:\project\sr

Re: Hiding token information from users

2011-08-23 Thread Ian Kelly
How many of these codes do you need, and do they only need to be decrypted at a central server? You might be able to just create random strings of whatever form you want and associate them with the tokens in a database. Then they will be completely opaque. -- http://mail.python.org/mailman/listinf

incorporate png/ico to exe and use it in application

2011-08-23 Thread Peter Irbizon
hello, I am zsing py2exe to compile exe files. I would like to incorporate png and icon file into exe and then use it during program run (to show it in about dialog and system tray). How can I do it? For example now I use self.staticon.set_from_file(os.path.join(module_path(), "icon.ico")) but I

Re: is there any principle when writing python function

2011-08-23 Thread Steven D'Aprano
smith jack wrote: > i have heard that function invocation in python is expensive, It's expensive, but not *that* expensive. Compare: [steve@sylar ~]$ python3.2 -m timeit 'x = "abc".upper()' 100 loops, best of 3: 0.31 usec per loop [steve@sylar ~]$ python3.2 -m timeit -s 'def f(): return "ab

Re: Methods on file-like objects can only used once on one object?

2011-08-23 Thread darnold
On Aug 23, 9:21 am, Yingjie Lin wrote: > Hi Python users, > > I just realize that my post yesterday shouldn't be specifically for > mechanize. It should be a general question for file-like objects. > > >>> f = open('my_file.txt') > >>> print f.readlines() > >         ( prints a list of strings>>>

Re: Hiding token information from users

2011-08-23 Thread Tobiah
On 08/23/2011 08:08 AM, Ian Kelly wrote: How many of these codes do you need, and do they only need to be decrypted at a central server? You might be able to just create random strings of whatever form you want and associate them with the tokens in a database. Then they will be completely opaque.

Re: Methods on file-like objects can only used once on one object?

2011-08-23 Thread Paul Kölle
Am 23.08.2011 16:21, schrieb Yingjie Lin: Hi Python users, [snip] There are quite a few methods for file-like objects that can only be used once on one object. If I prefer to use some of these methods on one object, one after another, like: f.readlines() f.read() ... What should I do? Than

Re: Methods on file-like objects can only used once on one object?

2011-08-23 Thread Steven D'Aprano
Yingjie Lin wrote: > Hi Python users, > > I just realize that my post yesterday shouldn't be specifically for > mechanize. It should be a general question for file-like objects. > f = open('my_file.txt') print f.readlines() > ( prints a list of strings print f.readlines() > [] On

Windows No-Install Distribution?

2011-08-23 Thread Eric Lemings
Hi, I would like to create/find a Python 3.x distribution that can be redeployed simply by copying a directory of required files; i.e. without the need for actually "installing" an MSI, modifying Windows registry entries, etc. First of all, will Python even work on Windows simply by copying files

Re: Windows No-Install Distribution?

2011-08-23 Thread Redcat
I haven't tried it myself yet, but might http://www.portablepython.com/ be what you're looking for? -- http://mail.python.org/mailman/listinfo/python-list

aboutdialog space between program name/version and logo

2011-08-23 Thread Peter Irbizon
Hello, please how can i set space between program name/version and logo in this code? thanks about = gtk.AboutDialog() about.set_program_name("name") about.set_version("0.0.1") about.set_logo(gtk.gdk.pixbuf_new_from_file("file.png")) -- http://mail.python.org/mailman/listinfo/python-list

Re: why i cannot invoke python script using command line?

2011-08-23 Thread Steven D'Aprano
smith jack wrote: > but i can invoke it in eclipse, what's wrong? > the script refered to another python script in eclipse project. > > f:\project\src\a.py > f:\project\src\lib\b.py > > there is such lines in a.py > from lib import b > > i can invoke a.py very well in eclipse > > but failed wh

Re: Setting the time in Win7

2011-08-23 Thread Bob Greschke
On 2011-08-23 02:26:38 -0600, Tim Golden said: On 22/08/2011 20:42, Bob Greschke wrote: Several people have been hacking away on this computer we are testing on, so I'm not sure what settings -- other than all of them -- have been messed with, but popen("time ...") seems to work, but system("t

Re: Methods on file-like objects can only used once on one object?

2011-08-23 Thread Grant Edwards
On 2011-08-23, Steven D'Aprano wrote: > Yingjie Lin wrote: > >> Hi Python users, >> >> I just realize that my post yesterday shouldn't be specifically for >> mechanize. It should be a general question for file-like objects. >> > f = open('my_file.txt') > print f.readlines() >> ( prints a

Re: Windows No-Install Distribution?

2011-08-23 Thread Andrew Berg
On 2011.08.23 10:29 AM, Eric Lemings wrote: > Hi, > > I would like to create/find a Python 3.x distribution that can be > redeployed simply by copying a directory of required files; i.e. > without the need for actually "installing" an MSI, modifying Windows > registry entries, etc. First of all,

truncating strings

2011-08-23 Thread Roy Smith
I want to log a string but only the first bunch of it, and add "..." to the end if it got truncated. This certainly works: log_message = message if len(log_message) >= 50: log_message = log_message[:50] + '...' logger.error("FAILED: '%s', '%s', %s, %s" %

Re: Windows No-Install Distribution?

2011-08-23 Thread Eric Lemings
On Aug 23, 9:31 am, Redcat wrote: > I haven't tried it myself yet, but mighthttp://www.portablepython.com/ > be what you're looking for? Almost except it contains additional Python packages that I'm not interested in. -- http://mail.python.org/mailman/listinfo/python-list

Re: Hiding token information from users

2011-08-23 Thread Steven D'Aprano
Tobiah wrote: > I really need some sort of > algorithm that will let me take an unknown string and generate > the encrypted bit on the fly. Google broken for you? *wink* Seriously, there are about a bazillion algorithms for encrypting and obfuscating strings. Depending on your security requireme

Re: Hiding token information from users

2011-08-23 Thread Tobiah
On 08/23/2011 09:55 AM, Steven D'Aprano wrote: Tobiah wrote: I really need some sort of algorithm that will let me take an unknown string and generate the encrypted bit on the fly. Google broken for you? *wink* I had some requirements in the OP that I could not find a solution for. Seriou

Re: is there any principle when writing python function

2011-08-23 Thread Seebs
On 2011-08-23, smith jack wrote: > i have heard that function invocation in python is expensive, but make > lots of functions are a good design habit in many other languages, so > is there any principle when writing python function? Lots of them. None of them have to do with performance. > for

Re: is there any principle when writing python function

2011-08-23 Thread rantingrick
On Aug 23, 6:59 am, smith jack wrote: > i have heard that function invocation in python is expensive, but make > lots of functions are a good design habit in many other languages, so > is there any principle when writing python function? > for example, how many lines should form a function? Every

Re: truncating strings

2011-08-23 Thread Chris Rebert
On Tue, Aug 23, 2011 at 9:29 AM, Roy Smith wrote: > I want to log a string but only the first bunch of it, and add "..." > to the end if it got truncated.  This certainly works: > >          log_message = message >          if len(log_message) >= 50: >            log_message = log_message[:50] + '

Re: try... except with unknown error types

2011-08-23 Thread Paul Rubin
gene heskett writes: > OTOH, ChrisA, I have it on good authority that no program is ever finished, > until someone shoots the programmer. :) The way I heard it was "software is never finished until the last user is dead". -- http://mail.python.org/mailman/listinfo/python-list

Re: extended slicing and negative stop value problem

2011-08-23 Thread Ian Kelly
On Aug 21, 2011 1:34 PM, "Max" wrote: > > a[0:11][::-1] > > # Instead of a[10:-1:-1], which looks like it should work, but doesn't. > > It works nicely, but it is 1.3 times slower in my code (I am surprised > the interpreter doesn't optimize this). Have you tried reverse()? I haven't timed it, bu

Re: is there any principle when writing python function

2011-08-23 Thread Terry Reedy
On 8/23/2011 7:59 AM, smith jack wrote: i have heard that function invocation in python is expensive, That comes into play when chosing between list2 = map(lambda x: 2*x, list1) # versus list2 = [2*x for x in list1] It also comes into play when choosing between looping with recursion (functi

Re: is there any principle when writing python function

2011-08-23 Thread Terry Reedy
On 8/23/2011 11:22 AM, Steven D'Aprano wrote: Even 7±2 is probably excessive: I find that I'm most comfortable with functions that perform 4±1 chunks of work. An example from one of my classes: def find(self, prefix): """Find the item that matches prefix.""" prefix = pref

reading and writing files

2011-08-23 Thread Adrián Monkas
Hi. I`ve been trying to copy a long text from one file to another but it always copied me just a small part. I would be glad if you can help me or explain which is my error. Thanks -- def runMenu(): print "\nMENU"

Re: Windows No-Install Distribution?

2011-08-23 Thread Stephen Hansen
On 8/23/11 8:29 AM, Eric Lemings wrote: > I would like to create/find a Python 3.x distribution that can be > redeployed simply by copying a directory of required files; i.e. Just take the default installer, install it, and then check the Python directory: does it have the python DLL? If not, go l

Looking for python/pyramid developers for a project

2011-08-23 Thread Mathew
Hello, My company an ISP is looking to build an administrative webapp dashboard for our underlying systems. We are looking to hire a developer(s) immediately. We would prefer the application be built on python with a popular framework such as pyramid. This position is a contract position paid hour

Re: is there any principle when writing python function

2011-08-23 Thread rantingrick
On Aug 23, 1:29 pm, Terry Reedy wrote: > In terms of different functions performed (see my previous post), I see >    attribute lookup >    assignment >    enumerate >    sequence unpacking >    for-looping >    if-conditioning >    lower >    startswith >    return > That is 9,  which is enough.

Re: questions (& answers) about object, type, builtin types, class, metaclass and __getattribute__

2011-08-23 Thread Amirouche B.
On Aug 22, 1:57 pm, Steven D'Aprano wrote: > The relationship between type and object is somewhat special, and needs to > be bootstrapped by the CPython virtual machine. Since you are talking about CPython, I'm wondering how it is bootstraped since you can easly reference PyType in PyObject tha

Re: truncating strings

2011-08-23 Thread Seebs
On 2011-08-23, Roy Smith wrote: > I want to log a string but only the first bunch of it, and add "..." > to the end if it got truncated. This certainly works: > logger.error("FAILED: '%s{50}', '%s', %s, %s" % (message, > route, params, e.code)) > does anything like this exist? %.50s

Re: questions (& answers) about object, type, builtin types, class, metaclass and __getattribute__

2011-08-23 Thread Amirouche B.
On Aug 22, 5:41 pm, Stephen Hansen wrote: > > 3) object's type is type : object.__class__ is type > > 4) type parent object is object : type.__bases__ == (object,) > > Saying "type" and "parent" and the like for new-style classes is > something of a misnomer. For "type" and "object", these things

Re: truncating strings

2011-08-23 Thread Ethan Furman
Seebs wrote: On 2011-08-23, Roy Smith wrote: I want to log a string but only the first bunch of it, and add "..." to the end if it got truncated. This certainly works: logger.error("FAILED: '%s{50}', '%s', %s, %s" % (message, route, params, e.code)) does anything like this exis

Re: Windows No-Install Distribution?

2011-08-23 Thread Eric Lemings
On Aug 23, 1:52 pm, Stephen Hansen wrote: > On 8/23/11 8:29 AM, Eric Lemings wrote: > > > I would like to create/find a Python 3.x distribution that can be > > redeployed simply by copying a directory of required files; i.e. > > Just take the default installer, install it, and then check the Pytho

Re: truncating strings

2011-08-23 Thread Seebs
On 2011-08-23, Ethan Furman wrote: > Seebs wrote: >> On 2011-08-23, Roy Smith wrote: >>> logger.error("FAILED: '%s{50}', '%s', %s, %s" % (message, >>> route, params, e.code)) >>> does anything like this exist? >> %.50s > That's not working in 2.7 or 3.2. Huh. Python 2.6.1 (

upgrade python

2011-08-23 Thread Ronald Reynolds
What is recommended for upgrading python for windows? Do I just install the new versionDo I edit my system path? Should I uninstall the old version.  Right now I have 2.7 and3.1  and 3.2  and I keep editing my system path when I install a new version but I'm notsure that's the right way to go.  

Re: Looking for python/pyramid developers for a project

2011-08-23 Thread Ben Finney
Mathew writes: > We are looking to hire a developer(s) immediately. Please don't use this Python discussion for recruitment. Instead, please use the Python Jobs Board for that purpose http://www.python.org/community/jobs/>. -- \ “It's a good thing we have gravity or else when birds

Re: upgrade python

2011-08-23 Thread Terry Reedy
On 8/23/2011 6:09 PM, Ronald Reynolds wrote: What is recommended for upgrading python for windows? Do I just install the new version I put each version in its own Pythonxy directory, as the installer wants. x.y.z bug fix releases replace the previous x.y release. Do I edit my system path?

Re: truncating strings

2011-08-23 Thread Ethan Furman
Seebs wrote: On 2011-08-23, Ethan Furman wrote: Seebs wrote: On 2011-08-23, Roy Smith wrote: logger.error("FAILED: '%s{50}', '%s', %s, %s" % (message, route, params, e.code)) does anything like this exist? %.50s That's not working in 2.7 or 3.2. Huh. Python 2.6.

Re: Windows No-Install Distribution?

2011-08-23 Thread Terry Reedy
On 8/23/2011 5:56 PM, Eric Lemings wrote: On Aug 23, 1:52 pm, Stephen Hansen wrote: On 8/23/11 8:29 AM, Eric Lemings wrote: I would like to create/find a Python 3.x distribution that can be redeployed simply by copying a directory of required files; i.e. Just take the default installer, ins

Re: truncating strings

2011-08-23 Thread Steven D'Aprano
Seebs wrote: > Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) > [GCC 4.2.1 (Apple Inc. build 5646)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> print "%.5s" % ("hello there, truncate me!") > hello Well, whadda you know, I learned something new :)

Re: is there any principle when writing python function

2011-08-23 Thread Steven D'Aprano
Terry Reedy wrote: > On 8/23/2011 11:22 AM, Steven D'Aprano wrote: > >> Even 7±2 is probably excessive: I find that I'm most comfortable with >> functions that perform 4±1 chunks of work. An example from one of my >> classes: >> >> def find(self, prefix): >> """Find the item that ma

Learning Python

2011-08-23 Thread User
Hello all, Does anyone have any good resources for learning Python? I know basic Java and basic Python (loops, data types, if-then statements, etc), but I want to delve into Python further. If anyone knows of any good books, video tutorials, etc it would be greatly appreciated. Thanks, User --

Re: is there any principle when writing python function

2011-08-23 Thread alex23
rantingrick wrote: > Everyone here who is suggesting that function bodies should be > confined to ANY length is an idiot. Or, more likely, is the sort of coder who has worked with other coders in the past and understands the value of readable code. > Don't worry if it too small or too big. It's

Re: is there any principle when writing python function

2011-08-23 Thread alex23
rantingrick wrote: > https://sites.google.com/site/thefutureofpython/ "Very soon I will be hashing out a specification for python 4000." AHAHAHAHAhahahahahahahAHAHAHAHahahahahaaa. So rich. Anyone willing to bet serious money we won't see this before 4000AD? "Heck even our leader seems as a

Re: reading and writing files

2011-08-23 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Adrián Monkas wrote: Hi. I`ve been trying to copy a long text from one file to another but it always copied me just a small part. I would be glad if you can help me or explain which is my error. Thanks ---

Re: Learning Python

2011-08-23 Thread Steven D'Aprano
On Wed, 24 Aug 2011 12:46 pm User wrote: > Hello all, > Does anyone have any good resources for learning Python? http://duckduckgo.com/?q=python+tutorial -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Announcing a new podcast: Radio Free Python

2011-08-23 Thread Larry Hastings
Radio Free Python is a new monthly podcast focused on Python and its community. Episode 1 has just been released! It features a panel discussion with the PythonLabs team: * Barry Warsaw, * Fred Drake, * Guido van Rossum, * Roger Masse, * and Tim Peters. You can find it at

Re: reading and writing files

2011-08-23 Thread Chris Rebert
On Tue, Aug 23, 2011 at 9:05 PM, Dave Angel wrote: > On 01/-10/-28163 02:59 PM, Adrián Monkas wrote: >>             print "Abro Archivo Origen" >>             archivo=open("D:\Boot.txt","r") > Your filenames are incorrect, since you use the backslash without escaping > it.  So the source file ha

Re: truncating strings

2011-08-23 Thread Seebs
On 2011-08-23, Ethan Furman wrote: > Ah -- that's only part of it -- the OP wants '...' to print as well. :) O. Hmm. That's harder. I can't think of a pretty way, so I think I'd probably write a "prettytrunc(string, len)" or something similar. -s -- Copyright 2011, all wrongs reversed.

Re: reading and writing files

2011-08-23 Thread Muresan Alexandru Mihai
If you need an int isn't better to use input() instead of raw_input() ? On Tue, Aug 23, 2011 at 10:00 PM, Adrián Monkas wrote: > Hi. > I`ve been trying to copy a long text from one file to another but it always > copied me just a small part. > I would be glad if you can help me or explain which i

Re: reading and writing files

2011-08-23 Thread Chris Rebert
On Tue, Aug 23, 2011 at 11:29 PM, Muresan Alexandru Mihai wrote: > If you need an int isn't better to use input() instead of raw_input() ? Absolutely not! input() does an eval(), which is very dangerous security-wise and can also lead to rather strange behavior. input() is so bad that it was remo

Re: Learning Python

2011-08-23 Thread Johnny Venter
http://greenteapress.com/thinkpython/ On Aug 23, 2011, at 10:46 PM, User wrote: > Hello all, > Does anyone have any good resources for learning Python? I know basic Java > and basic Python (loops, data types, if-then statements, etc), but I want to > delve into Python further. If anyone knows o