Re: [Tutor] Python oddity

2008-02-28 Thread Tiger12506
> i'd like to know, too. my take so far is > > * don't make any copies if you can avoid doing so, > * make shallow copies if need be, > * make deep copies only if you can't think of any > other way to accomplish what you're up to. Yep. That's pretty much it, for space reasons, mostly. Imagine a li

Re: [Tutor] Python oddity

2008-02-28 Thread jim stockford
i'd like to know, too. my take so far is * don't make any copies if you can avoid doing so, * make shallow copies if need be, * make deep copies only if you can't think of any other way to accomplish what you're up to. what's the truth? I'm hoping there's an OTW answer (OTW ~> "One True Way").

Re: [Tutor] Python oddity

2008-02-28 Thread Jeff Younker
4) The typical knee-jerk reaction to this 'oddity' is "what a pain, how stupid" etc, but I'm sure there is a good explanation. Can someone explain why python acts this way? faster processing? preserve memory? etc? This comes down (largely) to a philosophical choice. Does the language

Re: [Tutor] Python oddity

2008-02-28 Thread Keith Suda-Cederquist
Hey all, thanks for all the responses. I think I get the gist of just about everything. One thing to mention though is that I'm mainly working with scipy so most of what I'm working with in numpy.ndarrays. I think most of what was mentioned with respect to lists applies equally to numpy.ndarr

[Tutor] [Off-Topic] 'vimrc' for Python...

2008-02-28 Thread زياد بن عبدالعزيز الباتلي
(Sorry for hijacking the thread. This is the second time in the same day... sigh!) On Thu, 2008-02-28 at 08:04 -0500, bhaaluu wrote: > I also run Python on Linux. I've tried several of the Python IDEs > (Integrated Development Environments), such as IDLE, Eric, and > so forth, but the best (fo

[Tutor] [Off-Topic] 'ex' vs. 'sed'...

2008-02-28 Thread زياد بن عبدالعزيز الباتلي
(sorry for hijacking the thread like this!) On Wed, 2008-02-27 at 15:02 -0800, Bill Campbell wrote: > Another way on *nix systems that might be better wouldn't use > python at all. Edit the file in place with ed or ex: > > #!/bin/sh > ex - filename < 1d > w > q > DONE > E, how about: "se

Re: [Tutor] rss feed reader, but having trouble with unicode

2008-02-28 Thread Tom
Yeah I was considering using that. Thanks for the tip. On 28/02/2008, Michael Langford <[EMAIL PROTECTED]> wrote: > feedparser.org also works really well for this sort of thing. Does a > lot of the unicode automagically for you. > >--michael > > > On Wed, Feb 27, 2008 at 8:58 AM, Tom <[E

Re: [Tutor] rss feed reader, but having trouble with unicode

2008-02-28 Thread Michael Langford
feedparser.org also works really well for this sort of thing. Does a lot of the unicode automagically for you. --michael On Wed, Feb 27, 2008 at 8:58 AM, Tom <[EMAIL PROTECTED]> wrote: > Finally got it working. I used your suggestion Rui, but I also had to > change the charset encoding th

Re: [Tutor] Errno 9

2008-02-28 Thread imonthejazz
I think my problem was naming of the files, changed them and its fine now. Man, i feel stupid. When I have finished my project i'll share it with you guys! On 28/02/2008, Kent Johnson <[EMAIL PROTECTED]> wrote: > > imonthejazz wrote: > > Hi All, > > > > I am trying to read a line in a file then

Re: [Tutor] Errno 9

2008-02-28 Thread Kent Johnson
imonthejazz wrote: > Hi All, > > I am trying to read a line in a file then split the words in the line up. > > This is what i thought would work: > > # filearray.py > > import string > > # THE FOLLOWING FOUR LINE ARE THE CORRECT START TO THE PROGRAM, > # THE SIXTH AND SEVENTH LINES ARE ONLY FO

[Tutor] Errno 9

2008-02-28 Thread imonthejazz
Hi All, I am trying to read a line in a file then split the words in the line up. This is what i thought would work: # filearray.py import string # THE FOLLOWING FOUR LINE ARE THE CORRECT START TO THE PROGRAM, # THE SIXTH AND SEVENTH LINES ARE ONLY FOR QUICK TEST PURPOSE!!! infilename = raw_in

Re: [Tutor] new on the list

2008-02-28 Thread bhaaluu
On Thu, Feb 28, 2008 at 4:51 AM, Alan Gauld <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> wrote > > > (I wrote these using a simple text editor that I made with Tcl, > > too, http://www.linguasos.org/tcltext.html ) > > Fine but it will be easier to use a syntax aware full featured > editor

Re: [Tutor] new on the list

2008-02-28 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Hi, > > I'm Tony. I'm a translator. > This is my first post to this list. Welcome! > tcl.tk makes > it easy to build a gui, as easy as writing html, really). Python has a version of tk also, called Tkinter. You might want to learn about it: http://docs.python.org/l

Re: [Tutor] Python oddity

2008-02-28 Thread Brett Wilkins
Cheers, I actually forgot about the whole shallow-copy thing, and deepcopy(). I'm only new to the language myself, I just remembered about the slice copy and thought to mention it. Luke Paireepinart wrote: > Brett Wilkins wrote: >> As everybody else has told you, assigning bb = aa just gives bb

Re: [Tutor] Python oddity

2008-02-28 Thread Luke Paireepinart
Brett Wilkins wrote: > As everybody else has told you, assigning bb = aa just gives bb the > reference to the same object that aa has. Unless I missed something, > then nobody's actually mentioned how to make this not happen... and it's > actually rather easy... instead of bb = aa, do this: > bb

Re: [Tutor] new on the list

2008-02-28 Thread Alan Gauld
<[EMAIL PROTECTED]> wrote > This is my first post to this list. Welcome Tony. > I started learning to write bash scripts in November, first, > and started learning Tcl in January Good starts, although Python is a little different to Tcl its generally easier to read. But their capabilities are

Re: [Tutor] Truncate First Line of File

2008-02-28 Thread Alan Gauld
"Alex Ezell" <[EMAIL PROTECTED]> wrote > Thanks to everyone for the help. My coworker seems to really prefer > doing it via some system call. > > She seems to think it's possible quickly with csplit, which I've > never > used. I'll be investigating it in the morning, because she's really > good

Re: [Tutor] Python oddity

2008-02-28 Thread Brett Wilkins
As everybody else has told you, assigning bb = aa just gives bb the reference to the same object that aa has. Unless I missed something, then nobody's actually mentioned how to make this not happen... and it's actually rather easy... instead of bb = aa, do this: bb = aa[:] Looks like a splice, a

Re: [Tutor] user-given variable names for objects

2008-02-28 Thread Andreas Kostyrka
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Perhaps even nicer: [key for key, evtime in eventData.iteritems() if evtime < time.time()] This way the dictionary iterates over key, value tuples. Andreas Tiger12506 wrote: | I may sound like a know-it-all, but dictionaries *are* iterators. | | [a