Re: Python programming

2014-02-13 Thread Larry Martell
On Wed, Feb 12, 2014 at 10:56 PM, William Ray Wing wrote: > OK, and how many of you remember the original version of the tongue-in-cheek > essay "Real Programmers Don't Use Pascal" from the back page of Datamation? I do remember it. http://www.webcitation.org/659yh1oSh -- https://mail.python.o

Re: singleton ... again

2014-02-13 Thread Piet van Oostrum
Ben Finney writes: > Gregory Ewing writes: > >> Roy Smith wrote: >> > It looks to me like he's trying to implement a classic Gang of Four >> > singleton pattern. >> >> Which I've never really seen the point of in Python, or any other >> language for that matter. Just create one instance of the c

AttributeError: 'Or' object has no attribute 'as_independent'

2014-02-13 Thread wilsonmonde
Traceback (most recent call last): File "testcsv.py", line 17, in print(sy.solve([x^2+x+1-t, x^3+x^2-t], x)) File "C:\Python27\lib\site-packages\sympy\solvers\solvers.py", line 902, in so lve solution = _solve_system(f, symbols, **flags) File "C:\Python27\lib\site-packages\sympy\solv

AttributeError: '' object has no attribute 'SeriesCollection'

2014-02-13 Thread Jaydeep Patil
I have created chart object. But unable to add series into chart. Look at below collection Code: chartObj = addNewChart(newws,-4169,350,600) >>> print chartObj; >>> chartObj.SeriesCollection().NewSeries() Traceback (most recent call last): File "", line 1, in chartObj.SeriesCollection(

Re: AttributeError: '' object has no attribute 'SeriesCollection'

2014-02-13 Thread Ben Finney
Jaydeep Patil writes: > I have created chart object. But unable to add series into chart. Your code isn't self-contained (we are not able to run it as you presented it). Are you relying on some specific third-party library? If so, you need to be explicit. You may also get better response if you

querry to get status code in selinium webdriver , unable to find it , requesting to please help me

2014-02-13 Thread Jaiprakash Singh
hello all, i am searching how to get status code in selinium (with python), but unable to find it . can anyone help me in this matter actually my aim is to scroll a page and after each scroll i want to find the status so that on bad status i can exit my code. here ismy code in python

Re: PyWart: More surpises via "implict conversion to boolean" (and other steaming piles!)

2014-02-13 Thread Tim Chase
On 2014-02-13 04:11, Steven D'Aprano wrote: > give_me_an_even_number() > => returns 42 > give_me_an_even_number() > => returns 23 > > Hmmm. There's a bug in give_me_an_even_number(). How do I reproduce > that bug? What arguments do I pass? Oh, the same no-arguments as > for the working call. > >

Re: querry to get status code in selinium webdriver , unable to find it , requesting to please help me

2014-02-13 Thread Nagy László Zsolt
here ismy code in python for i in range(0,60): driver.execute_script("window.scrollTo(0, document.body.scrollHeight);") # i want status code here" time.sleep(1) Status of what? Are you asking the HTTP status of the page downloaded? That has nothing to do with you

Re: PyWart: More surpises via "implict conversion to boolean" (and other steaming piles!)

2014-02-13 Thread Tim Chase
On 2014-02-13 05:39, Tim Chase wrote: > def age(self, as_of=None): > if as_of is None: > as_of = datetime.date.today() > return as_of = self.dob and of course I mean return as_of - self.dob which is what I get for typing in the dark and the "-" and "=" keys are adjacent. :-/ -

Re: singleton ... again

2014-02-13 Thread Ned Batchelder
On 2/13/14 4:00 AM, Piet van Oostrum wrote: Ben Finney writes: Gregory Ewing writes: Roy Smith wrote: It looks to me like he's trying to implement a classic Gang of Four singleton pattern. Which I've never really seen the point of in Python, or any other language for that matter. Just cr

Install python 2 and 3 in the "wrong" order

2014-02-13 Thread Nagy László Zsolt
I have Python 3.3 installed on my Windows 7 x64 box. Today I had to install Python 2.7 for an older app of mine. Here is my problem: although "#!/usr/bin/env python3" is given in the file and "py -3" program works fine, apparently the installation of python 2 simply has overwritten my settings

Re: singleton ... again

2014-02-13 Thread Chris Angelico
On Thu, Feb 13, 2014 at 10:50 PM, Ned Batchelder wrote: > I still don't see it. To convince me that a singleton class makes sense, > you'd have to explain why by virtue of the class's very nature, it never > makes sense for there ever to be more than one of them. There's a huge difference, btw,

Re: Install python 2 and 3 in the "wrong" order

2014-02-13 Thread Tim Golden
On 13/02/2014 11:53, Nagy László Zsolt wrote: > I have Python 3.3 installed on my Windows 7 x64 box. Today I had to > install Python 2.7 for an older app of mine. > > Here is my problem: although "#!/usr/bin/env python3" is given in the > file and "py -3" program works fine, apparently the install

Re: AttributeError: '' object has no attribute 'SeriesCollection'

2014-02-13 Thread Jaydeep Patil
On Thursday, 13 February 2014 16:41:48 UTC+5:30, Ben Finney wrote: > Jaydeep Patil writes: > > > > > I have created chart object. But unable to add series into chart. > > > > Your code isn't self-contained (we are not able to run it as you > > presented it). > > > > Are you relying on s

Re: Install python 2 and 3 in the "wrong" order

2014-02-13 Thread Nagy László Zsolt
From a cmd window: ftype python.file="C:\Windows\py.exe" "%1" %* ftype python.noconfile="C:\Windows\pyw.exe" "%1" %* TJG Thank you. It worked. Although I must note that it only works if you start the cmd.exe as administrator (under Windows 7). Is it the only thing that was possibly overw

Re: AttributeError: '' object has no attribute 'SeriesCollection'

2014-02-13 Thread Tim Golden
On 13/02/2014 11:58, Jaydeep Patil wrote: > Just consider that you have chart object & you need to add data series for > that chart. How you can add this? Jaydeep: you're writing to a general Python list. Few of the people here run on Windows; fewer still will use Python to automate Excel via COM

Re: Install python 2 and 3 in the "wrong" order

2014-02-13 Thread Tim Golden
On 13/02/2014 12:03, Nagy László Zsolt wrote: > >> From a cmd window: >> >> ftype python.file="C:\Windows\py.exe" "%1" %* >> >> ftype python.noconfile="C:\Windows\pyw.exe" "%1" %* >> >> TJG > Thank you. It worked. Although I must note that it only works if you > start the cmd.exe as administrator

Re: AttributeError: 'Or' object has no attribute 'as_independent'

2014-02-13 Thread Terry Reedy
On 2/13/2014 4:03 AM, [email protected] wrote: Traceback (most recent call last): File "testcsv.py", line 17, in print(sy.solve([x^2+x+1-t, x^3+x^2-t], x)) File "C:\Python27\lib\site-packages\sympy\solvers\solvers.py", line 902, in so lve solution = _solve_system(f, symbols,

Re: Working with the set of real numbers

2014-02-13 Thread Oscar Benjamin
On 12 February 2014 10:07, Ben Finney wrote: > Chris Angelico writes: > >> On Wed, Feb 12, 2014 at 7:56 PM, Ben Finney >> wrote: >> > So, if I understand you right, you want to say that you've not found >> > a computer that works with the *complete* set of real numbers. Yes? >> >> Correct. [...

How to begin

2014-02-13 Thread weixixiao
http://www.codecademy.com I have learned the basic rules of Python in this website. What should I do next?where to go? I download the Pycharm the free version and I think I dunno how to use it except a "Hello world" -- https://mail.python.org/mailman/listinfo/python-list

Re: Working with the set of real numbers

2014-02-13 Thread Marko Rauhamaa
Oscar Benjamin : > This isn't even a question of resource constraints: a digital computer > with infinite memory and computing power would still be limited to > working with countable sets, and the real numbers are just not > countable. The fundamentally discrete nature of digital computers > prev

ANN: Wing IDE 5.0.3 released

2014-02-13 Thread Wingware
Hi, Wingware has released version 5.0.3 of Wing IDE, our cross-platform integrated development environment for the Python programming language. Wing IDE includes a professional quality code editor with vi, emacs, visual studio, and other key bindings, auto-completion, call tips, goto-definiti

RE: AttributeError: '' object has no attribute 'SeriesCollection'

2014-02-13 Thread Stefan Schukat
Hello, the "chartObj" is not a Chart object it is a shape see >> from win32com.client import Dispatch >>> Excel = Dispatch("Excel.Application") >>> WB = Excel.Workbooks.Add() >>> Shape = WB.Sheets[0].Shapes.AddChart() >>> Shape.Chart.SeriesCollection >> Regards Stefan Schukat -

Re: How to begin

2014-02-13 Thread pete suchsland
On Thursday, February 13, 2014 6:18:26 AM UTC-7, weixixiao wrote: > http://www.codecademy.com > > > > I have learned the basic rules of Python in this website. > > > > What should I do next?where to go? > > > > I download the Pycharm the free version and I think I dunno how to use it > e

Re: Python programming

2014-02-13 Thread Grant Edwards
On 2014-02-13, Chris Angelico wrote: > On Thu, Feb 13, 2014 at 2:04 PM, Roy Smith wrote: >> You know you're working with a Real Computer (tm) when the +5V power >> supply can deliver as much current as an arc welder. > > That'd run a reasonable number of devices. That depends. Back in the d

Re: PyWart: More surpises via "implict conversion to boolean" (and other steaming piles!)

2014-02-13 Thread Roy Smith
In article , Chris Angelico wrote: > Whether it's a module-level function, a bound method, a closure, or a > callable object, a zero-arg function in Python always has some kind of > implicit state. Sometimes, it has a *lot* of implicit state: os.fork() -- https://mail.python.org/mailman/listi

Re: Newcomer Help

2014-02-13 Thread Walter Hughey
- Original Message - From: "Chris Angelico" Cc: "Python-List" Sent: Wednesday, February 12, 2014 3:22:57 PM Subject: Re: Newcomer Help On Thu, Feb 13, 2014 at 8:07 AM, Tim Delaney wrote: > On 13 February 2014 02:17, Grant Edwards wrote: >> I've always worked in corporations w

Re: singleton ... again

2014-02-13 Thread Roy Smith
In article , Chris Angelico wrote: > On Thu, Feb 13, 2014 at 10:50 PM, Ned Batchelder > wrote: > > I still don't see it. To convince me that a singleton class makes sense, > > you'd have to explain why by virtue of the class's very nature, it never > > makes sense for there ever to be more th

Re: Python programming

2014-02-13 Thread Neil Cerutti
On 2014-02-12, Tim Delaney wrote: > OK - it's degenerated into one of these threads - I'm going to > participate. Me, too! I wrote lots of programs, strictly for fun, on every personal computer I got my hands on. Toward the end of the 80's personal computer's stopped coming equipped with program

RE: imperative mood in docstrings

2014-02-13 Thread bagrat lazaryan
thank you all! bagratte -- https://mail.python.org/mailman/listinfo/python-list

Using a subclass for __dict__

2014-02-13 Thread Demian Brecht
Hey all, Using bases in a metaclass, I've been able to easily figure out when an attribute is being added to an instance of a class. However, what I'm /actually/ looking to do is to intercept when attributes are being added to a class (not an instance of). I thought that I'd be able to do so by pa

Re: Newcomer Help

2014-02-13 Thread Rustom Mody
On Thursday, February 13, 2014 8:52:51 PM UTC+5:30, Walter Hughey wrote: > I am addressing this to the entire site - I thinks. And this will be my final > answer on this subject. > It remains to be seen if I remain on this site or tell all good bye. > For the most part, the few people who resp

Re: Newcomer Help

2014-02-13 Thread Larry Martell
On Thu, Feb 13, 2014 at 11:22 AM, Rustom Mody wrote: > > This is Usenet. You'll learn much here and you'll find a bunch of rude people. > > No you are not going to crash your plane but you will likely crash your > python-learning attempts if you give an occasional asshole more importance > than is

Re: Working with the set of real numbers

2014-02-13 Thread Ben Finney
Oscar Benjamin writes: > I think Chris' statement above is pretty clear. I disagree, as explained. > Also I didn't find the original statement confusing I'm happy for you. > and it is a reasonable point to make. Yes, and I was not addressing that. -- \ “It is well to remember tha

Community standards of behaviour (was: Newcomer Help)

2014-02-13 Thread Ben Finney
Larry Martell writes: > On Thu, Feb 13, 2014 at 11:22 AM, Rustom Mody wrote: […] > > I suggest > > 1. You focus on your goal -- learning python or whatever is the larger > > personal goal of which learning python is a part > > 2. A bullet-proof vest > > This reminds me of post that was circula

Re: How to begin

2014-02-13 Thread John Ladasky
On Thursday, February 13, 2014 7:06:03 AM UTC-8, pete suchsland wrote: > if x = 99: Surely, Pete, you meant to write "if x == 99:" ? -- https://mail.python.org/mailman/listinfo/python-list

Re: singleton ... again

2014-02-13 Thread Ethan Furman
On 02/13/2014 03:50 AM, Ned Batchelder wrote: On 2/13/14 4:00 AM, Piet van Oostrum wrote: Ben Finney writes: Gregory Ewing writes: Roy Smith wrote: It looks to me like he's trying to implement a classic Gang of Four singleton pattern. Which I've never really seen the point of in Python,

Welcome to the Internet. No one here likes you. (was: Newcomer Help)

2014-02-13 Thread John Ladasky
On Thursday, February 13, 2014 8:32:46 AM UTC-8, [email protected] wrote: > This reminds me of post that was circulating in the early 90's: > > Welcome to the Internet. > > No one here likes you. > > We're going to offend, insult, abuse, and belittle the living hell out > of you. And when you

Re: Wait... WHAT?

2014-02-13 Thread eneskristo
Can we please revert back to the original problem? def save(): target = open ("save.swroc", 'w') target.write([counter, loop, number_of_competitors, competitors]) def load(): the_array = list(open("save.swroc", 'r')) the_array = target counter = the_a

Re: singleton ... again

2014-02-13 Thread Roy Smith
In article , Ethan Furman wrote: > Say you have a class that represents serial ports or your computer. You > should get the same object every time you ask > for SerialPort(2). Why? Certainly, you should get objects which refer to the same physical port. So: port_a = SerialPort(2) port_b

Re: Newcomer Help

2014-02-13 Thread Grant Edwards
On 2014-02-13, Larry Martell wrote: > 9) Don't ever use the term "cyberspace" (only William Gibson gets to > say that, and even he hasn't really used it for two or three books > now). Likewise, you prove yourself a marketing-hype victim if you ever > use the term "surfing". 9b) And don't use an

Re: Wait... WHAT?

2014-02-13 Thread MRAB
On 2014-02-13 17:46, [email protected] wrote: Can we please revert back to the original problem? def save(): > target = open ("save.swroc", 'w') This opens the file for writing text (assuming you're using Python 3). > target.write([counter, loop, number_of_competitors

A curious bit of code...

2014-02-13 Thread forman . simon
I ran across this and I thought there must be a better way of doing it, but then after further consideration I wasn't so sure. if key[:1] + key[-1:] == '<>': ... Some possibilities that occurred to me: if key.startswith('<') and key.endswith('>'): ... and: if (key[:1], key[-1:]) == ('<

Re: singleton ... again

2014-02-13 Thread Ethan Furman
On 02/13/2014 09:57 AM, Roy Smith wrote: In article , Ethan Furman wrote: Say you have a class that represents serial ports or your computer. You should get the same object every time you ask for SerialPort(2). Why? Certainly, you should get objects which refer to the same physical port.

Re: A curious bit of code...

2014-02-13 Thread Roy Smith
In article <[email protected]>, [email protected] wrote: > I ran across this and I thought there must be a better way of doing it, but > then after further consideration I wasn't so sure. > > if key[:1] + key[-1:] == '<>': ... > > > Some possibilitie

Re: singleton ... again

2014-02-13 Thread Roy Smith
In article , Ethan Furman wrote: > On 02/13/2014 09:57 AM, Roy Smith wrote: > > In article , > > Ethan Furman wrote: > > > >> Say you have a class that represents serial ports or your computer. You > >> should get the same object every time you ask > >> for SerialPort(2). > > > > Why? Certa

Re: A curious bit of code...

2014-02-13 Thread Ethan Furman
On 02/13/2014 10:37 AM, [email protected] wrote: I ran across this and I thought there must be a better way of doing it, but then after further consideration I wasn't so sure. if key[:1] + key[-1:] == '<>': ... Some possibilities that occurred to me: if key.startswith('<') and key

Re: A curious bit of code...

2014-02-13 Thread Mark Lawrence
On 13/02/2014 18:37, [email protected] wrote: I ran across this and I thought there must be a better way of doing it, but then after further consideration I wasn't so sure. if key[:1] + key[-1:] == '<>': ... Some possibilities that occurred to me: if key.startswith('<') and key.en

Re: Using a subclass for __dict__

2014-02-13 Thread Peter Otten
Demian Brecht wrote: > Using bases in a metaclass, I've been able to easily figure out when > an attribute is being added to an instance of a class. However, what > I'm /actually/ looking to do is to intercept when attributes are being > added to a class (not an instance of). I thought that I'd be

Re: singleton ... again

2014-02-13 Thread Tim Delaney
On 13 February 2014 20:00, Piet van Oostrum wrote: > Ben Finney writes: > > Make that “somewhere” a module namespace, and you effectively have a > > Singleton for all practical purposes. So yes, I see the point of it; but > > we already have it built in :-) > > There is a use case for a singleto

Re: A curious bit of code...

2014-02-13 Thread Ethan Furman
On 02/13/2014 11:09 AM, Mark Lawrence wrote: All I can say is that if you're worried about the speed of a single line of code like the above then you've got problems. Having said that, I suspect that using an index to extract a single character has to be faster than using a slice, but I haven

Re: PyWart: More surpises via "implict conversion to boolean" (and other steaming piles!)

2014-02-13 Thread Chris Angelico
On Fri, Feb 14, 2014 at 1:58 AM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> Whether it's a module-level function, a bound method, a closure, or a >> callable object, a zero-arg function in Python always has some kind of >> implicit state. > > Sometimes, it has a *lot* of implic

Re: A curious bit of code...

2014-02-13 Thread Alain Ketterlin
[email protected] writes: > I ran across this and I thought there must be a better way of doing > it, but then after further consideration I wasn't so sure. > > if key[:1] + key[-1:] == '<>': ... > > Some possibilities that occurred to me: > > if key.startswith('<') and key.endswith('>'):

Re: Working with the set of real numbers

2014-02-13 Thread Chris Angelico
On Fri, Feb 14, 2014 at 1:00 AM, Marko Rauhamaa wrote: > Well, if your idealized, infinite, digital computer had ℵ₁ bytes of RAM > and ran at ℵ₁ hertz and Python supported transfinite iteration, you > could easily do reals: > > def real_sqrt(y): > for x in continuum(0, max(1, y)): >

Re: A curious bit of code...

2014-02-13 Thread Ethan Furman
On 02/13/2014 11:20 AM, Ethan Furman wrote: On 02/13/2014 11:09 AM, Mark Lawrence wrote: All I can say is that if you're worried about the speed of a single line of code like the above then you've got problems. Having said that, I suspect that using an index to extract a single character has

Re: A curious bit of code...

2014-02-13 Thread Neil Cerutti
On 2014-02-13, Ethan Furman wrote: > On 02/13/2014 11:09 AM, Mark Lawrence wrote: >> All I can say is that if you're worried about the speed of a >> single line of code like the above then you've got problems. >> Having said that, I suspect that using an index to extract a >> single character has

Re: A curious bit of code...

2014-02-13 Thread Neil Cerutti
On 2014-02-13, [email protected] wrote: > I ran across this and I thought there must be a better way of > doing it, but then after further consideration I wasn't so > sure. > > if key[:1] + key[-1:] == '<>': ... > > Some possibilities that occurred to me: > > if key.startswith('<') and ke

XML parsing ExpatError with xml.dom.minidom at line 1, column 0

2014-02-13 Thread ming
Hi, i've a Python script which stopped working about a month ago. But until then, it worked flawlessly for months (if not years). A tiny self-contained 7-line script is provided below. i ran into an XML parsing problem with xml.dom.minidom and the error message is included below. The weird

Re: A curious bit of code...

2014-02-13 Thread Mark Lawrence
On 13/02/2014 19:25, Neil Cerutti wrote: On 2014-02-13, Ethan Furman wrote: On 02/13/2014 11:09 AM, Mark Lawrence wrote: All I can say is that if you're worried about the speed of a single line of code like the above then you've got problems. Having said that, I suspect that using an index to

Re: A curious bit of code...

2014-02-13 Thread Roy Smith
In article , Ethan Furman wrote: > On 02/13/2014 11:09 AM, Mark Lawrence wrote: > > > > All I can say is that if you're worried about the speed of a single line of > > code like the above then you've got > > problems. Having said that, I suspect that using an index to extract a > > single cha

Re: A curious bit of code...

2014-02-13 Thread Peter Otten
[email protected] wrote: > I ran across this and I thought there must be a better way of doing it, > but then after further consideration I wasn't so sure. > > if key[:1] + key[-1:] == '<>': ... > > > Some possibilities that occurred to me: > > if key.startswith('<') and key.endswith(

Re: A curious bit of code...

2014-02-13 Thread Ethan Furman
On 02/13/2014 11:17 AM, Neil Cerutti wrote: On 2014-02-13, [email protected] wrote: I ran across this and I thought there must be a better way of doing it, but then after further consideration I wasn't so sure. if key[:1] + key[-1:] == '<>': ... Some possibilities that occurred to me:

Re: singleton ... again

2014-02-13 Thread Chris Angelico
On Fri, Feb 14, 2014 at 6:03 AM, Roy Smith wrote: > In article , > Ethan Furman wrote: >> >> You mean use the Borg pattern instead of the Singleton pattern? As far as I >> can tell they are two shades of the same >> thing. Are there any drastic differences between the two? Besides one >> havi

Re: Working with the set of real numbers

2014-02-13 Thread Marko Rauhamaa
Chris Angelico : > On Fri, Feb 14, 2014 at 1:00 AM, Marko Rauhamaa wrote: >> Well, if your idealized, infinite, digital computer had ℵ₁ bytes of RAM >> and ran at ℵ₁ hertz and Python supported transfinite iteration, you >> could easily do reals: >> >> for x in continuum(0, max(1, y)): > >

Re: A curious bit of code...

2014-02-13 Thread Neil Cerutti
On 2014-02-13, Peter Otten <[email protected]> wrote: > [email protected] wrote: > The first is too clever for my taste. > > The second is fast and easy to understand. It might attract > "improvements" replacing the slice with an index, but I trust > you will catch that with your unit tests ;)

Python(x,y) interferes with earlier Numpy installation

2014-02-13 Thread beliavsky
I am running Python 2.7.5 on Windows 7 and installed Numpy, which worked. Then I installed Python(x,y) from a file Python(x,y)-2.7.5.2.exe, and now running the script from numpy import array, size, shape, min, max, sum a = array([1, 2, 3]) print shape(a) gives the error messages Traceback (most

Re: A curious bit of code...

2014-02-13 Thread Ethan Furman
On 02/13/2014 11:43 AM, Peter Otten wrote: [email protected] wrote: I ran across this and I thought there must be a better way of doing it, but then after further consideration I wasn't so sure. if key[:1] + key[-1:] == '<>': ... Some possibilities that occurred to me: if key.sta

Re: A curious bit of code...

2014-02-13 Thread Marko Rauhamaa
Peter Otten <[email protected]>: > Personally, I'm willing to spend the few extra milliseconds and use > the foolproof third. Speaking of foolproof, what is this "key?" Is it an XML start tag, maybe? Then, how does your test fare with, say, which is equivalent to Marko -- https://m

Re: singleton ... again

2014-02-13 Thread Chris Angelico
On Fri, Feb 14, 2014 at 2:24 AM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> On Thu, Feb 13, 2014 at 10:50 PM, Ned Batchelder >> wrote: >> > I still don't see it. To convince me that a singleton class makes sense, >> > you'd have to explain why by virtue of the class's very na

Re: A curious bit of code...

2014-02-13 Thread Zachary Ware
On Thu, Feb 13, 2014 at 12:37 PM, wrote: > I ran across this and I thought there must be a better way of doing it, but > then after further consideration I wasn't so sure. > > if key[:1] + key[-1:] == '<>': ... > > > Some possibilities that occurred to me: > > if key.startswith('<') and key.

Re: Working with the set of real numbers

2014-02-13 Thread Chris Angelico
On Fri, Feb 14, 2014 at 6:47 AM, Marko Rauhamaa wrote: > My assumption was you could execute ℵ₁ statements per second. That > doesn't guarantee a finite finish time but would make it possible. That > is because > >ℵ₁ * ℵ₁ = ℵ₁ = ℵ₁ * 1 Hmm. I never actually covered this stuff in grade school

Re: Using a subclass for __dict__

2014-02-13 Thread Demian Brecht
On Thu, Feb 13, 2014 at 11:10 AM, Peter Otten <[email protected]> wrote: > I don't really understand what you are trying to do in the gist, perhaps you > want > > Even though you've already answered my q

Re: XML parsing ExpatError with xml.dom.minidom at line 1, column 0

2014-02-13 Thread Peter Otten
ming wrote: > Hi, > i've a Python script which stopped working about a month ago. But until > then, it worked flawlessly for months (if not years). A tiny > self-contained 7-line script is provided below. > > i ran into an XML parsing problem with xml.dom.minidom and the error > message is in

Re: XML parsing ExpatError with xml.dom.minidom at line 1, column 0

2014-02-13 Thread MRAB
On 2014-02-13 20:10, Peter Otten wrote: ming wrote: Hi, i've a Python script which stopped working about a month ago. But until then, it worked flawlessly for months (if not years). A tiny self-contained 7-line script is provided below. i ran into an XML parsing problem with xml.dom.minido

Re: A curious bit of code...

2014-02-13 Thread Chris Angelico
On Fri, Feb 14, 2014 at 6:32 AM, Mark Lawrence wrote: >> There will be an exception only if it is zero-length. But good >> point! That's a pretty sneaky way to avoid checking for a >> zero-length string. Is it a popular idiom? >> > > I hope not. The use of slicing rather than indexing to avoid pr

Re: Using a subclass for __dict__

2014-02-13 Thread Chris Angelico
On Fri, Feb 14, 2014 at 7:07 AM, Demian Brecht wrote: > *Throws keyboard across the office* > > FFS. I could have SWORN I tried that (because I /know/ that a class is > an instance of its metaclass :/). An instance of looking at something > far too long without a fresh set of eyes. This is why we

Re: A curious bit of code...

2014-02-13 Thread Tim Chase
On 2014-02-13 10:37, [email protected] wrote: > I ran across this and I thought there must be a better way of doing > it, but then after further consideration I wasn't so sure. > > Some possibilities that occurred to me: > > if key.startswith('<') and key.endswith('>'): ... This is my fav

Re: Using a subclass for __dict__

2014-02-13 Thread Roy Smith
In article , Chris Angelico wrote: > http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=244695 That seems badly specified. What if you kill a cyclops? Or a beholder? -- https://mail.python.org/mailman/listinfo/python-list

Re: How to begin

2014-02-13 Thread Chris Angelico
On Fri, Feb 14, 2014 at 4:34 AM, John Ladasky wrote: > On Thursday, February 13, 2014 7:06:03 AM UTC-8, pete suchsland wrote: > >> if x = 99: > > Surely, Pete, you meant to write "if x == 99:" ? Maybe. Or maybe he wanted the OP to do stuff that would result in exceptions, since exceptions are a w

Re: Using a subclass for __dict__

2014-02-13 Thread Chris Angelico
On Fri, Feb 14, 2014 at 7:44 AM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=244695 > > That seems badly specified. What if you kill a cyclops? Or a beholder? That matter was dealt with by Doug Beyer in response

Re: A curious bit of code...

2014-02-13 Thread Emile van Sebille
On 2/13/2014 11:59 AM, Zachary Ware wrote: In a fit of curiosity, I did some timings: Snip of lots of TMTOWTDT/TIMTOWTDI/whatever... timed examples :) But I didn't see this one: s[::len(s)-1] Emile -- https://mail.python.org/mailman/listinfo/python-list

Re: Python(x,y) interferes with earlier Numpy installation

2014-02-13 Thread beliavsky
I fixed the problem by reinstalling Numpy. -- https://mail.python.org/mailman/listinfo/python-list

Re: A curious bit of code...

2014-02-13 Thread Neil Cerutti
On 2014-02-13, Zachary Ware wrote: > In a fit of curiosity, I did some timings: > > 'and'ed indexing: > > C:\tmp>py -m timeit -s "key = ''" "key[0] == '<' and key[-1] == '>'" > 100 loops, best of 3: 0.35 usec per loop > > C:\tmp>py -m timeit -s "key = ' 100 loops, best of 3: 0.398 usec per

Re: A curious bit of code...

2014-02-13 Thread Chris Angelico
On Fri, Feb 14, 2014 at 7:55 AM, Emile van Sebille wrote: > On 2/13/2014 11:59 AM, Zachary Ware wrote: >> >> In a fit of curiosity, I did some timings: > > > Snip of lots of TMTOWTDT/TIMTOWTDI/whatever... timed examples :) > > But I didn't see this one: > > s[::len(s)-1] AAAR

Re: A curious bit of code...

2014-02-13 Thread Peter Otten
Chris Angelico wrote: > On Fri, Feb 14, 2014 at 7:55 AM, Emile van Sebille wrote: >> On 2/13/2014 11:59 AM, Zachary Ware wrote: >>> >>> In a fit of curiosity, I did some timings: >> >> >> Snip of lots of TMTOWTDT/TIMTOWTDI/whatever... timed examples :) >> >> But I didn't see this one: >> >> s[::l

Re: A curious bit of code...

2014-02-13 Thread Chris Angelico
On Fri, Feb 14, 2014 at 8:06 AM, Peter Otten <[email protected]> wrote: > For the record: > s = "x" s[::len(s)-1] > Traceback (most recent call last): > File "", line 1, in > ValueError: slice step cannot be zero And that, my friends, is a classic example of a Python exception that oug

Re: singleton ... again

2014-02-13 Thread Robert Kern
On 2014-02-13 20:03, Chris Angelico wrote: On Fri, Feb 14, 2014 at 2:24 AM, Roy Smith wrote: In article , Chris Angelico wrote: On Thu, Feb 13, 2014 at 10:50 PM, Ned Batchelder wrote: I still don't see it. To convince me that a singleton class makes sense, you'd have to explain why by v

Re: A curious bit of code...

2014-02-13 Thread Mark Lawrence
On 13/02/2014 21:01, Neil Cerutti wrote: On 2014-02-13, Zachary Ware wrote: In a fit of curiosity, I did some timings: 'and'ed indexing: C:\tmp>py -m timeit -s "key = ''" "key[0] == '<' and key[-1] == '>'" 100 loops, best of 3: 0.35 usec per loop C:\tmp>py -m timeit -s "key = 'py -m time

Re: A curious bit of code...

2014-02-13 Thread Zachary Ware
On Thu, Feb 13, 2014 at 2:55 PM, Emile van Sebille wrote: > On 2/13/2014 11:59 AM, Zachary Ware wrote: >> >> In a fit of curiosity, I did some timings: > > > Snip of lots of TMTOWTDT/TIMTOWTDI/whatever... timed examples :) > > But I didn't see this one: > > s[::len(s)-1] It's not great, around 0.

Re: A curious bit of code...

2014-02-13 Thread Zachary Ware
On Thu, Feb 13, 2014 at 3:01 PM, Neil Cerutti wrote: > On 2014-02-13, Zachary Ware wrote: >> C:\tmp>py -m timeit -s "key = ''" "key[0] == '<' and key[-1] == '>'" >> Traceback (most recent call last): >> File "P:\Python34\lib\timeit.py", line 292, in main >> x = t.timeit(number) >> File "P

Re: A curious bit of code...

2014-02-13 Thread Roy Smith
In article , Emile van Sebille wrote: > On 2/13/2014 11:59 AM, Zachary Ware wrote: > > In a fit of curiosity, I did some timings: > > Snip of lots of TMTOWTDT/TIMTOWTDI/whatever... timed examples :) > > But I didn't see this one: > > s[::len(s)-1] > > Emile I love it. I need to add this to

Re: A curious bit of code...

2014-02-13 Thread Emile van Sebille
On 2/13/2014 1:10 PM, Chris Angelico wrote: On Fri, Feb 14, 2014 at 8:06 AM, Peter Otten <[email protected]> wrote: For the record: s = "x" s[::len(s)-1] Traceback (most recent call last): File "", line 1, in ValueError: slice step cannot be zero And that, my friends, is a classic exampl

Re: singleton ... again

2014-02-13 Thread Chris Angelico
On Fri, Feb 14, 2014 at 8:13 AM, Robert Kern wrote: > We don't use `is None` instead of `== None` for the speed. We use it for > robustness. We don't want arbitrary __eq__()s to interfere with our sentinel > tests. If None weren't a singleton that we could use as such a sentinel, > we'd make one.

Re: better and user friendly IDE recommended?

2014-02-13 Thread Martin Schöön
Den 2013-09-17 skrev rusi : > On Wednesday, September 11, 2013 7:44:04 PM UTC+5:30, > mnishpsyched wrote: >> Hey i am a programmer but new to python. Can anyone guide >> me in knowing which is a better IDE used to develop web >> related apps that connect to DB using python? > > Just saw this > h

Re: Working with the set of real numbers

2014-02-13 Thread Rotwang
What's this? A discussion about angels dancing on a the head of a pin? Great, I'm in. On 13/02/2014 14:00, Marko Rauhamaa wrote: Oscar Benjamin : This isn't even a question of resource constraints: a digital computer with infinite memory and computing power would still be limited to working w

Re: A curious bit of code...

2014-02-13 Thread Chris Angelico
On Fri, Feb 14, 2014 at 8:19 AM, Zachary Ware wrote: > Also, uglier than sin itself. Hey hey, no need to insult our lovely trigonometric functions! ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: Python(x,y) interferes with earlier Numpy installation

2014-02-13 Thread Martin Schöön
Den 2014-02-13 skrev [email protected] : > I fixed the problem by reinstalling Numpy. Good. Just one note since I happened to look into updating Python(x,y) at work today and stumbled on this: The Python(x,y) guys recommend that one removes other Python installations prior to installing Python(x,

Re: A curious bit of code...

2014-02-13 Thread Roy Smith
In article , Chris Angelico wrote: > On Fri, Feb 14, 2014 at 8:19 AM, Zachary Ware > wrote: > > Also, uglier than sin itself. > > Hey hey, no need to insult our lovely trigonometric functions! This newsgroup is taylor made for that kind of abuse. -- https://mail.python.org/mailman/listinfo/p

Re: A curious bit of code...

2014-02-13 Thread Zachary Ware
On Thu, Feb 13, 2014 at 3:31 PM, Chris Angelico wrote: > On Fri, Feb 14, 2014 at 8:19 AM, Zachary Ware > wrote: >> Also, uglier than sin itself. > > Hey hey, no need to insult our lovely trigonometric functions! Here's your sine... -- Zach -- https://mail.python.org/mailman/listinfo/python-li

Re: A curious bit of code...

2014-02-13 Thread Serhiy Storchaka
13.02.14 21:59, Zachary Ware написав(ла): don't use re for simple stuff (because while it may be very fast, it's dominated by attribute lookup and function call overhead), And the time of re variant depends on the size of input. -- https://mail.python.org/mailman/listinfo/python-list

  1   2   >