Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Mark Lawrence
On 11/02/2013 07:24, Chris Angelico wrote: On Mon, Feb 11, 2013 at 6:19 PM, Mark Lawrence wrote: On 11/02/2013 02:05, alex23 wrote: I highly recommend not reading up on any modern physics as there'll be plenty there that just makes you angry. Spoil sport. Fancy not wanting rr's views on

Re: Import redirects

2013-02-10 Thread Chris Angelico
On Mon, Feb 11, 2013 at 6:28 PM, Mark Lawrence wrote: > On 11/02/2013 06:50, Isaac To wrote: >> >> I have a package (say "foo") that I want to rename (say, to "bar"), and >> for compatibility reasons I want to be able to use the old package name >> to refer to the new package. > > > My apologies f

Re: Import redirects

2013-02-10 Thread Mark Lawrence
On 11/02/2013 06:50, Isaac To wrote: I have a package (say "foo") that I want to rename (say, to "bar"), and for compatibility reasons I want to be able to use the old package name to refer to the new package. My apologies for the over engineering, but this is the best I could come up with.

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Chris Angelico
On Mon, Feb 11, 2013 at 6:19 PM, Mark Lawrence wrote: > On 11/02/2013 02:05, alex23 wrote: >> >> >> I highly recommend not reading up on any >> modern physics as there'll be plenty there that just makes you angry. >> > > Spoil sport. Fancy not wanting rr's views on string theory :) Is that Unico

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Mark Lawrence
On 11/02/2013 02:05, alex23 wrote: I highly recommend not reading up on any modern physics as there'll be plenty there that just makes you angry. Spoil sport. Fancy not wanting rr's views on string theory :) -- Cheers. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list

Import redirects

2013-02-10 Thread Isaac To
I have a package (say "foo") that I want to rename (say, to "bar"), and for compatibility reasons I want to be able to use the old package name to refer to the new package. Copying files or using filesystem symlinks is probably not the way to go, since that means any object in the modules of the p

Re: cafebabe python macosx easter egg?

2013-02-10 Thread Chris Rebert
On Sun, Feb 10, 2013 at 10:10 PM, Rodrick Brown wrote: > Subject: cafebabe python macosx easter egg? > > $ hexdump -n4 -C $(which python) | awk '{print $2 $3 $4 $5 }' cafebabe ~ $ # Huh. Let's google... http://en.wikipedia.org/wiki/Hexspeak : "0xCAFEBABE ("cafe babe") is used by Mach-O to identif

Re: cafebabe python macosx easter egg?

2013-02-10 Thread Chris Angelico
On Mon, Feb 11, 2013 at 5:10 PM, Rodrick Brown wrote: > $ hexdump -n4 -C $(which python) | awk '{print $2 $3 $4 $5 }' I believe that's used as a file signature. All you're doing is looking at the first four bytes of the file; 0xCAFEBABE is used as a signature by Java class files, and some others.

Re: threads and timeout -> running a shell command / want to guard against infinite loops

2013-02-10 Thread marcus . liddle
On Tuesday, 19 August 2003 15:01:01 UTC+12, Marcus Liddle wrote: > > > Hi > > I'm trying to get a really simple python program to > run a bash testing script and kill itself if its > been running to long (ie infinite loop) > > create the thread object - test = TestThread() > run the comman

Re: PyWart: Namespace asinitiy and the folly of the global statement

2013-02-10 Thread Chris Angelico
On Mon, Feb 11, 2013 at 1:42 PM, alex23 wrote: > On Feb 9, 2:25 pm, Michael Torrie wrote: >> Rick seems to know his stuff >> about Tk programming, but his knowledge of programming language theory >> and formal computing seems quite informal. > > Not informal, "intuited". If he doesn't already kno

cafebabe python macosx easter egg?

2013-02-10 Thread Rodrick Brown
$ hexdump -n4 -C $(which python) | awk '{print $2 $3 $4 $5 }' -- http://mail.python.org/mailman/listinfo/python-list

Re: PyWart: Namespace asinitiy and the folly of the global statement

2013-02-10 Thread alex23
On Feb 9, 2:25 pm, Michael Torrie wrote: > Rick seems to know his stuff > about Tk programming, but his knowledge of programming language theory > and formal computing seems quite informal. Not informal, "intuited". If he doesn't already know something, it's apparently not important. -- http://

Re: Implicit conversion to boolean in if and while statements

2013-02-10 Thread alex23
On Feb 8, 4:29 pm, Rick Johnson wrote: > That's a strange thing to say when you go on to provide an example that tests > the validity of the object "each and every time": Here's a tip: context is important. I was referring to not having to *explicitly* test if a label *is defined* in order to be

Re: Python recv loop

2013-02-10 Thread Roy Smith
In article , Ihsan Junaidi Ibrahim wrote: > I'm implementing a python client connecting to a C-backend server and am > currently stuck to as to how to proceed with receiving variable-length byte > stream coming in from the server. > > I have coded the first 4 bytes (in hexadecimal) of message

Re: Statistics...help with numpy/scipy install

2013-02-10 Thread David Robinow
On Sun, Feb 10, 2013 at 5:14 PM, Rex Macey wrote: > I should have added that the setup gives an error window "Cannot install" > "Python version 3.3 required, which was not found in the registry." I'm guessing that you installed a 64-bit python and are using a 32-bit numpy. -- http://mail.python

Re: Implicit conversion to boolean in if and while statements

2013-02-10 Thread Rick Johnson
On Saturday, February 9, 2013 10:50:25 PM UTC-6, Chris Angelico wrote: > [...] > I don't understand. Wouldn't freezing an array (list) result in a > tuple? And, why should there be no literal syntax for them? > > Having a convenient literal notation for every basic type is extremely > handy. Act

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread alex23
On Feb 11, 9:59 am, Rick Johnson wrote: > We don't add features because of logic, or because of consistency, > or even because of good sense, we simply add them to appease the masses. When "logic" or "good sense" are writing programs, maybe then we'll listen more to what they want in a language.

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread MRAB
On 2013-02-11 00:36, Steven D'Aprano wrote: Rick Johnson wrote: On Sunday, February 10, 2013 5:29:54 AM UTC-6, Steven D'Aprano wrote: Rick wrote: And you have missed my point, which is that reversed(), and sorted(), were not added to the language on a whim, but because they were requested, ove

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread alex23
On Feb 9, 2:51 pm, Chris Angelico wrote: >> Rick Johnson wrote: >> I really don't like to read docs when learning a language, >> especially a "so-called" high level language. I prefer to learn >> the language by interactive sessions and object introspection. Then, >> when i have exhausted all abi

Re: Python recv loop

2013-02-10 Thread MRAB
On 2013-02-11 00:48, Ihsan Junaidi Ibrahim wrote: Hi, I'm implementing a python client connecting to a C-backend server and am currently stuck to as to how to proceed with receiving variable-length byte stream coming in from the server. I have coded the first 4 bytes (in hexadecimal) of messa

Re: Statistics...help with numpy/scipy install

2013-02-10 Thread Oscar Benjamin
On 10 February 2013 22:14, Rex Macey wrote: > I should have added that the setup gives an error window "Cannot install" > "Python version 3.3 required, which was not found in the registry." Yes, you should have added this information. Are you sure that Python 3.3 is installed? Have you tried run

Logging within a class

2013-02-10 Thread Joseph L. Casale
Within __init__ I setup a log with self.log = logging.getLogger('foo') then add a console and filehandler which requires the formatting to be specified. There a few methods I setup a local log object by calling getChild against the global log object. This works fine until I need to adjust the 

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Rick Johnson
On Sunday, February 10, 2013 6:12:57 PM UTC-6, Tim Chase wrote: > What should you get if you flatten > > [[[1,2],[3,4]],[[5,6],[7,8]]] > > Should the result be > > [[1,2],[3,4],[5,6],[7,8]] > > or > > [1,2,3,4,5,6,7,8] > > I've needed both cases, depending on the situation. Well provid

Re: Python recv loop

2013-02-10 Thread Dave Angel
On 02/10/2013 07:48 PM, Ihsan Junaidi Ibrahim wrote: Hi, I'm implementing a python client connecting to a C-backend server and am currently stuck to as to how to proceed with receiving variable-length byte stream coming in from the server. I have coded the first 4 bytes (in hexadecimal) of me

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Mark Janssen
On Sun, Feb 10, 2013 at 4:10 PM, Steven D'Aprano wrote: > Mark Janssen wrote: > >> A unified data model as I define it, specifies a canonical atomic unit >> (like the unit integer) and an abstract grouping construct in which >> these atomic units can be arranged. By themselves, these two can >> c

Python recv loop

2013-02-10 Thread Ihsan Junaidi Ibrahim
Hi, I'm implementing a python client connecting to a C-backend server and am currently stuck to as to how to proceed with receiving variable-length byte stream coming in from the server. I have coded the first 4 bytes (in hexadecimal) of message coming in from the server to specify the length

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Steven D'Aprano
Rick Johnson wrote: > On Sunday, February 10, 2013 7:30:00 AM UTC-6, Oscar Benjamin wrote: >> On 10 February 2013 04:53, Mark Janssen wrote: >> > [...] >> > I have to agree with Rick, I think requiring the user to explicitly >> > create a new object, which is already a good and widely-used practic

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Steven D'Aprano
Rick Johnson wrote: > On Sunday, February 10, 2013 5:29:54 AM UTC-6, Steven D'Aprano wrote: >> Rick wrote: >> And you have missed my point, which is that reversed(), and sorted(), >> were not added to the language on a whim, but because they were >> requested, over and over and over again. > > We

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Rick Johnson
On Sunday, February 10, 2013 7:30:00 AM UTC-6, Oscar Benjamin wrote: > On 10 February 2013 04:53, Mark Janssen wrote: > > [...] > > I have to agree with Rick, I think requiring the user to explicitly > > create a new object, which is already a good and widely-used practice, > > should be the Only O

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Steven D'Aprano
Rick Johnson wrote: > we can get the iterator for free. If however you want to control the > iteration /without/ being locked into a loop, you can explicitly call: > > py> iter(seq) > Or, if python employed /true/ OOP paradigm: > > py> Iterator(seq) Today I learned that the difference between

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Steven D'Aprano
Dennis Lee Bieber wrote: > On Mon, 11 Feb 2013 01:29:30 +1100, Steven D'Aprano > declaimed the following in > gmane.comp.python.general: > >> >> Oh dear. Chris was being sarcastic. I thought that, even if the sarcasm >> wasn't obvious, his "Ook. Ook!" at the end should have given it away: >> >

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Steven D'Aprano
Mark Janssen wrote: > A unified data model as I define it, specifies a canonical atomic unit > (like the unit integer) and an abstract grouping construct in which > these atomic units can be arranged. By themselves, these two can > construct arbitrary levels of data structure complexity. Add the

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Tim Chase
> > > flatten, flattened > > > > flatten is another often requested, hard to implement correctly, > > function. The only reason that Python doesn't have a flatten is > > that nobody can agree on precisely what it should do. > > Steven, the definition of flatten (as relates to sequences) is > ver

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Rick Johnson
On Sunday, February 10, 2013 5:29:54 AM UTC-6, Steven D'Aprano wrote: > Rick wrote: > And you have missed my point, which is that reversed(), and sorted(), were > not added to the language on a whim, but because they were requested, over > and over and over again. Well, well, this explains everyth

Re: Multiple ways to access attributes

2013-02-10 Thread Mitya Sirenef
On 02/10/2013 05:44 PM, ISE Development wrote: Is it considered acceptable practice (e.g. not confusing, not > surprising or not Pythonic) to allow multiple ways to access > the same attributes? > > For example, supposing I am providing access to external > devices, that these parameters may va

Re: Multiple ways to access attributes

2013-02-10 Thread MRAB
On 2013-02-10 22:44, ISE Development wrote: Is it considered acceptable practice (e.g. not confusing, not surprising or not Pythonic) to allow multiple ways to access the same attributes? For example, supposing I am providing access to external devices, that these parameters may vary slightly be

Multiple ways to access attributes

2013-02-10 Thread ISE Development
Is it considered acceptable practice (e.g. not confusing, not surprising or not Pythonic) to allow multiple ways to access the same attributes? For example, supposing I am providing access to external devices, that these parameters may vary slightly between devices (e.g. different models, etc.

Re: Statistics...help with numpy/scipy install

2013-02-10 Thread Rex Macey
I should have added that the setup gives an error window "Cannot install" "Python version 3.3 required, which was not found in the registry." On Sunday, February 10, 2013 5:11:20 PM UTC-5, Rex Macey wrote: > The setup of numpy-1.7.0 leads to a Setup window with a message: "Python 3.3 > is require

Re: Statistics...help with numpy/scipy install

2013-02-10 Thread Rex Macey
The setup of numpy-1.7.0 leads to a Setup window with a message: "Python 3.3 is required for this package. Select installation to use:". Below that is an empty list box. Below that is an edit box for the Python Directory. I have Python 3.3 installed on c:\Python33. On Sunday, February 10,

Re: Python3 curses behavior

2013-02-10 Thread Vlasov Vitaly
суббота, 9 февраля 2013 г., 23:22:47 UTC+4 пользователь Terry Reedy написал: > On 2/9/2013 6:23 AM, Vlasov Vitaly wrote: > > > Hello. > > > > > > I found strange behavior of curses module, that i can't understand. I > > > initialize screen with curses.initscr(), then i create subwin of > > > s

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Mark Janssen
On Sun, Feb 10, 2013 at 1:51 PM, Chris Angelico wrote: > On Mon, Feb 11, 2013 at 8:28 AM, Mark Janssen > wrote: >> Yes, I was aware of his sarcasm. But I was actually wanting to agree >> with the fundamental idea: that one could reduce all data types to 1 >> atomic unit and 1 grouping construc

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Neil Hodgson
Rick Johnson: Really? Yes. >> a = [1,2] => [1, 2] >> a.push(3) => [1, 2, 3] >> a => [1, 2, 3] This could be called "mutation without exclamation". >> require 'WEBrick' => true >> vowels = "[aeiou]+" => "[aeiou]+" >> vowels.object_id => 2234951380 >> WEBrick::HTTPUtils._make_regex!(vow

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Chris Angelico
On Mon, Feb 11, 2013 at 8:28 AM, Mark Janssen wrote: > Yes, I was aware of his sarcasm. But I was actually wanting to agree > with the fundamental idea: that one could reduce all data types to 1 > atomic unit and 1 grouping construct, and like set theory in > mathematics, derive everything else.

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Terry Reedy
On 2/10/2013 1:45 PM, Rick Johnson wrote: On Sunday, February 10, 2013 2:39:21 AM UTC-6, Terry Reedy wrote: While it is true that sorted(iterable) is essentially def sorted(iterable): tem = list(iterable) tem.sort return tem the body is not an expression and cannot be substituted i

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Mark Janssen
On Sun, Feb 10, 2013 at 6:29 AM, Steven D'Aprano wrote: > Mark Janssen wrote: >> I have to agree with Rick, I think requiring the user to explicitly >> create a new object, which is already a good and widely-used practice, > > Perhaps so, but consider how you creates new objects in Python. Very ra

matplotlib: Help! I need to plot colored regions based on a set of boundaries

2013-02-10 Thread John Crockett
I am attempting to plot the relative sky positions of several Astronomy images I'm studying. I want a set of axes that represent a 2-d projection of the sky (don't want to use polar projection), so my x-axis would be from 0 to 360 (right ascension) and the y-axis from about -35 to 90 (declinati

Re: Statistics...help with numpy/scipy install

2013-02-10 Thread Oscar Benjamin
On 10 February 2013 18:14, Michael Torrie wrote: > On 02/10/2013 10:35 AM, Rex Macey wrote: >> I'm new to Python with a new windows 8 machine (64-bit OS). Learning >> programming mainly for fun. Naturally I downloaded Python 3.3 (who >> doesn't want the latest and greatest). What I want involve

Re: Statistics...help with numpy/scipy install

2013-02-10 Thread David Robinow
On Sun, Feb 10, 2013 at 1:14 PM, Michael Torrie wrote: > On 02/10/2013 10:35 AM, Rex Macey wrote: > A casual google search seems to indicate that for now, SciPy and NumPy > are for Python 2.x (2.7 is the latest). I could be wrong though and > often am. I know a number of popular and useful packa

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Rick Johnson
On Sunday, February 10, 2013 3:53:57 AM UTC-6, Neil Hodgson wrote: > Ruby does not use '!' to indicate in-place modification: Really? rb> a = [1,2,3] [1, 2, 3] rb> a.reverse [3, 2, 1] rb> a [1, 2, 3] rb> a.reverse! [3, 2, 1] rb> a [3, 2, 1] And now we will verify that a.reverse! has not assigned

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Rick Johnson
On Sunday, February 10, 2013 2:39:21 AM UTC-6, Terry Reedy wrote: > While it is true that sorted(iterable) is essentially > > def sorted(iterable): >tem = list(iterable) >tem.sort >return tem > > the body is not an expression and cannot be substituted in an > expression. Yes but th

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Mark Janssen
On Sun, Feb 10, 2013 at 5:30 AM, Oscar Benjamin wrote: > On 10 February 2013 04:53, Mark Janssen wrote: >> I have to agree with Rick, I think requiring the user to explicitly >> create a new object, which is already a good and widely-used practice, >> should be the Only One Way to Do It. > > Why

Re: Statistics...help with numpy/scipy install

2013-02-10 Thread Colin J. Williams
On 10/02/2013 12:35 PM, Rex Macey wrote: I'm new to Python with a new windows 8 machine (64-bit OS). Learning programming mainly for fun. Naturally I downloaded Python 3.3 (who doesn't want the latest and greatest). What I want involves functions related to the normal distribution. Based on

Re: Statistics...help with numpy/scipy install

2013-02-10 Thread Michael Torrie
On 02/10/2013 10:35 AM, Rex Macey wrote: > I'm new to Python with a new windows 8 machine (64-bit OS). Learning > programming mainly for fun. Naturally I downloaded Python 3.3 (who > doesn't want the latest and greatest). What I want involves > functions related to the normal distribution. Based

Re: Statistics...help with numpy/scipy install

2013-02-10 Thread Mark Lawrence
On 10/02/2013 17:35, Rex Macey wrote: I'm new to Python with a new windows 8 machine (64-bit OS). Learning programming mainly for fun. Naturally I downloaded Python 3.3 (who doesn't want the latest and greatest). What I want involves functions related to the normal distribution. Based on my

Re: Pick random choice from variables

2013-02-10 Thread David Hutto
The first one I sent directly to you, but it used randint with a list. The second should be what you're looking for. If not, then ask a little further what you need explained. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pick random choice from variables

2013-02-10 Thread David Hutto
On Sun, Feb 10, 2013 at 12:43 PM, Joel Goldstick wrote: > > > > On Sun, Feb 10, 2013 at 12:01 PM, eli m wrote: >> >> How do i make something with python that will ask the user for input, and >> then use the random.choice function to select a random choice from what the >> user entered. Below is a

Statistics...help with numpy/scipy install

2013-02-10 Thread Rex Macey
I'm new to Python with a new windows 8 machine (64-bit OS). Learning programming mainly for fun. Naturally I downloaded Python 3.3 (who doesn't want the latest and greatest). What I want involves functions related to the normal distribution. Based on my google research, it appears that SCIPY

Re: Implicit conversion to boolean in if and while statements

2013-02-10 Thread Thomas Rachel
Am 10.02.2013 12:37 schrieb Steven D'Aprano: So, in Python 4000, my vote is for set literals { } to create frozensets, and if you want a mutable set, you have to use the set() type directly. 4000 sounds about long future. In the meanwhile, a new syntax element could be introduced fpr frozens

Pick random choice from variables

2013-02-10 Thread eli m
How do i make something with python that will ask the user for input, and then use the random.choice function to select a random choice from what the user entered. -- http://mail.python.org/mailman/listinfo/python-list

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-10 Thread Morten Engvoldsen
Hi Dave, Thanks for your reply with full function :) Great forum.. :) On Sun, Feb 10, 2013 at 5:46 PM, David Hutto wrote: > Here is the full function with an instance using the function: > > def text_wrapper(file_name = None, pre_text = None, text = None, > post_text = None): > f = open(

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-10 Thread David Hutto
On Sun, Feb 10, 2013 at 11:45 AM, Morten Engvoldsen wrote: > Hi Dave, > Thanks again for suggestion No problem. I haven't used my python skills in a while, so I went ahead and went through it fully. -- Best Regards, David Hutto CEO: http://www.hitwebdevelopment.com -- http://mail.pytho

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-10 Thread David Hutto
Here is the full function with an instance using the function: def text_wrapper(file_name = None, pre_text = None, text = None, post_text = None): f = open(file_name, 'a') f.write("%s\n%s\n%s\n" % (pre_text, text, post_text)) f.close() text_wrapper(file_name = r"/home/dav

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-10 Thread Morten Engvoldsen
Hi Dave, Thanks again for suggestion On Sun, Feb 10, 2013 at 5:30 PM, David Hutto wrote: > I haven't looked at text wrapper, but it would probably look > something like this in a function, untested: > > def text_wrapper(file_name = None, pre_text = None, text = None, > post_text = None): >

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-10 Thread David Hutto
Oops, I mean : def text_wrapper(file_name = None, pre_text = None, text = None, post_text = None): f = open(file, 'a') f.write("%s\n%s\n%s\n" % (pre_text, text, post_text) f.close() -- http://mail.python.org/mailman/listinfo/python-list

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-10 Thread David Hutto
I haven't looked at text wrapper, but it would probably look something like this in a function, untested: def text_wrapper(file_name = None, pre_text = None, text = None, post_text = None): f = open(file, 'a') f.write("%s\n%s\n%s\n" % (pre_text = None, text, post_text = None) f.close(

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-10 Thread Morten Engvoldsen
Hi Dave, This is good code, simple but makes the Coding Standard better.. Thanks to all again On Sun, Feb 10, 2013 at 5:01 PM, David Hutto wrote: > Kind of like below: > > david@david-HP-Compaq-dc7600-Convertible-Minitower:~$ python > Python 2.7.3 (default, Aug 1 2012, 05:16:07) > [GCC 4.6.3] o

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-10 Thread inq1ltd
On Saturday, February 09, 2013 03:27:16 PM Morten Engvoldsen wrote: > Hi Team, > I Have saved my output in .doc file and want to format the output with > > *Start the File > > Some data here > > > ***End of File* >

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-10 Thread Morten Engvoldsen
Hi, Thanks for your suggestion. This is a great forum for Python. :) On Sun, Feb 10, 2013 at 4:12 PM, inq1ltd wrote: > ** > > On Saturday, February 09, 2013 03:27:16 PM Morten Engvoldsen wrote: > > > Hi Team, > > > I Have saved my output in .doc file and want to format the output with > > > > >

Re: Implicit conversion to boolean in if and while statements

2013-02-10 Thread Roy Smith
In article <5117868b$0$29998$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Sets are not frozen lists. Right. Tuples are frozen lists (ducking and running). -- http://mail.python.org/mailman/listinfo/python-list

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread 88888 Dihedral
Steven D'Aprano於 2013年2月9日星期六UTC+8上午11時36分52秒寫道: > Rick Johnson wrote: > > > > > The solution is simple. Do not offer the "copy-mutate" methods and force > > > all mutation to happen in-place: > > > > > > py> l = [1,2,3] > > > py> l.reverse > > > py> l > > > [3,2,1] > > > > > > If the

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Steven D'Aprano
Mark Janssen wrote: > On Sat, Feb 9, 2013 at 8:20 PM, Chris Angelico wrote: >> On Sun, Feb 10, 2013 at 2:54 PM, Rick Johnson >> wrote: >>> My point was this: All mutate methods should mutate "in-place", if the >>> programmer wishes to create a mutated copy of the object, then the >>> programmer

Re: __class__ and type() implementation details in CPython

2013-02-10 Thread Steven D'Aprano
Ivan Yurchenko wrote: > Hello. > > I've done the following in CPython 2.7.3 and 3.3.0 (and also in PyPy > 2.0b1): > import weakref x = set() y = weakref.proxy(x) x.__class__, type(x), isinstance(x, set) > (, , True) y.__class__, type(y), isinstance(y, set) > (, , True) >

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Steven D'Aprano
Chris Angelico wrote: > On Sun, Feb 10, 2013 at 10:29 PM, Steven D'Aprano > wrote: >> "inserted" is called addition, together with list slicing when needed. >> >> newlist = [item_to_insert] + oldlist >> newlist = oldlist[0:5] + [item_to_insert] + oldlist[5:] > > Really? Wouldn't it be easier to

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Tim Chase
On Sun, 10 Feb 2013 22:29:54 +1100, Steven D'Aprano wrote: > Rick Johnson wrote: > > map, mapped > > filter, filtered > > reduce, reduced > > Those are nonsense. None of those are in-place mutator methods. > Especially reduce, which reduces a list to a single item. You might > as well have sugg

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Oscar Benjamin
On 10 February 2013 04:53, Mark Janssen wrote: > On Sat, Feb 9, 2013 at 8:20 PM, Chris Angelico wrote: >> On Sun, Feb 10, 2013 at 2:54 PM, Rick Johnson >> wrote: >>> My point was this: All mutate methods should mutate "in-place", if the >>> programmer wishes to create a mutated copy of the obje

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Chris Angelico
On Sun, Feb 10, 2013 at 10:29 PM, Steven D'Aprano wrote: > "inserted" is called addition, together with list slicing when needed. > > newlist = [item_to_insert] + oldlist > newlist = oldlist[0:5] + [item_to_insert] + oldlist[5:] Really? Wouldn't it be easier to use slice assignment on a copy? ne

__class__ and type() implementation details in CPython

2013-02-10 Thread Ivan Yurchenko
Hello. I've done the following in CPython 2.7.3 and 3.3.0 (and also in PyPy 2.0b1): >>> import weakref >>> x = set() >>> y = weakref.proxy(x) >>> x.__class__, type(x), isinstance(x, set) (, , True) >>> y.__class__, type(y), isinstance(y, set) (, , True) So, type doesn't use object's __class__ to

Re: Implicit conversion to boolean in if and while statements

2013-02-10 Thread Steven D'Aprano
Rick Johnson wrote: > IMO "Set Types" should only exists as a concequence of "freezing" an > array, Sets are not frozen lists. > and should have NO literal syntax avaiable. Unfortunately, Python has a minor design flaw. One of the most common use-cases for sets is for membership testing of lit

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Steven D'Aprano
Rick Johnson wrote: > On Friday, February 8, 2013 9:36:52 PM UTC-6, Steven D'Aprano wrote: >> Rick Johnson wrote: >> >> > The solution is simple. Do not offer the "copy-mutate" methods and >> > force all mutation to happen in-place: >> > >> > py> l = [1,2,3] >> > py> l.reverse >> > py> l >> > [3

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Steven D'Aprano
Neil Hodgson wrote: > Rick Johnson: > >> The Ruby language attempted to save the programmer from the scourge of >> obtaining a four year degree in linguistics just to create intuitive >> identifiers "on-the-fly", and they tried to remove this ambiguity by >> employing "post-fix-punctuation" of th

Re: string.replace doesn't removes ":"

2013-02-10 Thread Johannes Bauer
On 09.02.2013 12:04, Joshua Robinson wrote: > Hi *Monte-Pythons*, > > x = "this is a simple : text: that has colon" > s = x.replace(string.punctuation, ""); OR > s = x.replace(string.punctuation, ""); > print x # 'this is a simple : text: that has colon' > # The colon is still in the text

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Neil Hodgson
Rick Johnson: The Ruby language attempted to save the programmer from the scourge of obtaining a four year degree in linguistics just to create intuitive identifiers "on-the-fly", and they tried to remove this ambiguity by employing "post-fix-punctuation" of the exclamation mark as a visual c

Re: LangWart: Method congestion from mutate multiplicty

2013-02-10 Thread Terry Reedy
While it is true that sorted(iterable) is essentially def sorted(iterable): tem = list(iterable) tem.sort return tem the body is not an expression and cannot be substituted in an expression. The need for the short form was thought common enough to be worth, *on balance*, a new builtin na