Re: looking for IDE advice or workflow tips
On 4 Aug, 19:08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I'm a novice developer at best and often work with the R statistical programming language. I use an editor called TINN-R which allows me to write a script, then highlight a few lines and send them to the interpreter. I am using pythonwin and it lacks this funtionality (that I can tell) and when I copy and paste lines into the interpreter only the first line is evaluated and the rest appears as returned text. Is there an editor that allows me to send a few lines out of many lines of code at a time? Jumping over your specific problem and going to a bigger one: you need to learn a major editor. This means either vi or emacs, preferably both, but learn at least one of them really well. As a developer, your editor is your main tool. It is worth spending time learning your editor very well, and you need to make sure it is an editor that will exist in 5 years. Also, someday you will find yourself staring at a console with nothing available but ed, and you will be glad of the time you spent learning vi. -- http://mail.python.org/mailman/listinfo/python-list
Re: What Python looks like
On 5 Aug, 16:08, Brett Ritter [EMAIL PROTECTED] wrote: On Aug 4, 3:43 pm, Gary Herron [EMAIL PROTECTED] wrote: A page of Python code looks *clean*, with not a lot of punctuation/special symbols and (in particular) no useless lines My first impression of Python was that it was visually hard to parse. snip Put another way, imagine math went from: 2 + 2 = 4 to: two plus two equals four and then someone decided to abbreviate: two pl two eq four That looks more like tcl than python to me. My first reaction to python was a strong dislike of indentation as a block delimeter and the convention of using '__*__' names. I got over my issue with indentation fairly quickly, but still don't care for the excessive underscores. However, overall I thought it was extremely clean and easy to write. By the time I saw Python, I had already essentially given up on Perl, but it only took 20 minutes going through the tutorial to completely nail down the lid on the coffin of my Perl self. To summarize the first impression: clean, simple, powerful, and a lot of potential. -- http://mail.python.org/mailman/listinfo/python-list
Re: Looking for a Python Program/Tool That Will Add Line Numbers to a txt File
On Feb 14, 6:54 am, W. Watson [EMAIL PROTECTED] wrote: See Subject. It's a simple txt file, each line is a Python stmt, but I need up to four digits added to each line with a space between the number field and the text. Perhaps someone has already done this or there's a source on the web for it. I'm not yet into files with Python. A sudden need has burst upon me. I'm using Win XP. Not sure if Python program/tool means a tool or a program in Python, but if awk is okay, that's the tool I would use: awk '{printf( %4d %s\n, NR % 1, $0 )}' -- http://mail.python.org/mailman/listinfo/python-list
Re: object vs class oriented -- xotcl
On Jan 24, 9:16 pm, Guilherme Polo [EMAIL PROTECTED] wrote: 2008/1/24, William Pursell [EMAIL PROTECTED]: referring to changing an objects class Can I do it in Python? class A(object): pass class B(object): pass a = A() a.__class__ = B That ? Maybe you meant something else. That is what I was referring to, but it isn't the core functionality that I'm after. (My bad for a poor description.) I'm fairly excited at the idea of being able to do per-object mixins in xotcl. I guess it would look like this in python: BROKEN CODE: a = object() a.__class__.append( foo ) a.__class__.append( bar ) In python, if you want an object to me a member of 2 classes, it seems that you have no choice but to declare a new class that inherits from both. eg: class foobar( foo, bar): pass a = foobar() Is it possible to make an object be a member of 2 classes without defining such a class? I believe per object mixin is the correct term for such an animal. The first several google hits on that phrase all reference xotcl, so I'm not sure if that is an xotcl inspired vocabulary that isn't really standard. -- http://mail.python.org/mailman/listinfo/python-list
object vs class oriented -- xotcl
I've been away from Python for at least a year, and in the interim have spent a little time looking at the XOTcl object framework for Tcl. One of the interesting features of XOTcl is the ability for an object to change class dynamically. The XOtcl documentation makes the claim that this makes it object oriented, while most other languages are class oriented. Here's a snippet from the wiki, from a post to the mailing list by Gustaf Neumann: (http://wiki.tcl.tk/1297) Class-oriented means: look at the class and you know exactly how all of the instances look alike. The class is the first and primary language construct; the class is well the place where you specify the instance variables (there are no instance variables except those specified in the class). The only kind of individualism left in the objects is to let them differ by their state (the values of their instance variables). Changing classes (class migration) is conceptually quite hard for this setup. Object-oriented (in this distinction) means that the primary elements are objects, which keep all instance variables. classes my be used to specify the behavior of objects, they are container for methods and they control the life-cycle of objects. Objects are like the facts, and classes are like rules, that determine the behavior of the objects. Since the connection between objects and classes is rather loose, it is sufficient to define their relation through an association. Therefore it is quite easy to change the relation between objects and classes (and between classes and classes) dynamically. Objects have arbitrary individualism, they may have variables never used in any class, they may have private procs etc. I'm not sure that describes the method well. Basically, you can instantiate an object A of class Foo, and later change A to be an object of class Bar. Does Python support this type of flexibility? As I stated above, I've been away from Python for awhile now, and am a bit rusty, but it seems that slots or new style objects might provide this type of behavior. The ability to have an object change class is certainly (to me) a novel idea. Can I do it in Python? -- http://mail.python.org/mailman/listinfo/python-list