On Sat, 14 May 2011 19:41:32 -0700, rusi wrote:
> The python entities: {True, False} are not an exact (isomorphic) model
> for the semantic boolean domain {true, false} (which is needed for
> example to explicate the semantics of if while etc) Which is to say the
> boolean type in python is not f
On Sat, 14 May 2011 00:45:29 -0700, rusi wrote:
> On May 14, 12:39 pm, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote:
>> On Thu, 12 May 2011 23:46:12 -0700, rusi wrote:
>> > Mathematics has existed for millenia. Hindu-arabic numerals (base-10
>> > numbers) have been known for about one m
On May 15, 2:19 am, Ian Kelly wrote:
> On Sat, May 14, 2011 at 11:24 AM, rusi wrote:
> > def fib(n):
> > if n==1 or n==2:
> > return 1
> > elif even(n):
> > return sq(fib (n//2)) + 2 * fib(n//2) * fib(n//2 - 1)
> > else:
> > return sq(fib (n//2 + 1)) + sq(fib(n // 2)
On Sat, May 14, 2011 at 7:17 PM, Chris Angelico wrote:
> You're right. It needs a while loop instead of the if (and some slight
> reordering):
>
> def ints():
> i=0
> queue=[]
> while True:
> if queue: # see other thread, this IS legal and pythonic and
> quite sensible
> sen
Jon,
Looks very promising. Seems to be an issue with interactive mode. The
following code behaves as thus:
testvar=raw_input("enter value: ")
print testvar
When run, the prompt from raw_input does print to the output screen as:
enter value:
But when you tap in the lower window to enter the
On May 15, 4:26 am, Ben Finney wrote:
> rusi writes:
> > [Steven quote]
> > In Python, [1, 2, 3] is another way of writing true, and [] is another
> > way of writing false. Similarly with any other arbitrary objects. The
> > only things that bools True and False are good for are:
> >
> > [end St
In article <871v00j2bh@benfinney.id.au>
Ben Finney wrote:
>As pointed out: you already know how to create a set from an object;
>creating a list from an object is very similar:
>
>list(set(aa))
>
>But why are you doing that? What are you trying to achieve?
I have no idea why someone *els
Chris Angelico wrote:
> For what you're doing, there's a little complexity. If I understand,
> you want send() to be like an ungetc call... you could do that like
> this:
>
>
> def ints():
>i=0
>while True:
>sent=(yield i)
>if sent is not None:
> yield None #
On Sun, May 15, 2011 at 11:05 AM, Ian Kelly wrote:
> Actually, this won't work, because the value of the "yield None" gets
> ignored. Thus if you try to call send() twice in a row, the generator
> the treats second send() as if it were a next(), and it is not
> possible to have more than one item
On Sat, May 14, 2011 at 6:47 PM, Chris Angelico wrote:
> def ints():
> i=0
> queue=[]
> while True:
> if queue: # see other thread, this IS legal and pythonic and
> quite sensible
> sent=(yield queue.pop(0))
> else:
> sent=(yield i)
> i+=1
>
On Sat, May 14, 2011 at 6:08 PM, Victor Eijkhout wrote:
> I thought the send call would push the value "2" at the front of the
> queue. Instead it coughs up the 2, which seems senseless to me.
>
> 1/ How should I view the send call? I'm reading the manual and dont' get
> it
There is no queue unle
On Sat, May 14, 2011 at 5:08 PM, Victor Eijkhout wrote:
> #! /usr/bin/env python
>
> def ints():
> i=0
> while True:
> yield i
> i += 1
>
> gen = ints()
> while True:
> i = gen.next()
> print i
> if i==5:
> r = gen.send(2)
> print "return:",r
> if i>10
On Sun, May 15, 2011 at 10:08 AM, Victor Eijkhout wrote:
> yield i
> r = gen.send(2)
When you send() something to a generator, it becomes the return value
of the yield expression. See the example here:
http://docs.python.org/whatsnew/2.5.html#pep-342-new-generator-features
For wha
Victor Eijkhout wrote:
> #! /usr/bin/env python
>
> def ints():
> i=0
> while True:
> yield i
> i += 1
>
> gen = ints()
> while True:
> i = gen.next()
> print i
> if i==5:
> r = gen.send(2)
> print "return:",r
> if i>10:
> break
>
Terry Reedy wrote:
The computer cannot turn off the monitor.
... this was my point ;-)
--
http://mail.python.org/mailman/listinfo/python-list
#! /usr/bin/env python
def ints():
i=0
while True:
yield i
i += 1
gen = ints()
while True:
i = gen.next()
print i
if i==5:
r = gen.send(2)
print "return:",r
if i>10:
break
I thought the send call would push the value "2" at the fron
Terry Reedy writes:
> You need what is called, at least with Windows, an IME -- Input Method
> Editor.
For a GNOME or KDE environment you want an input method framework; I
recommend IBus http://code.google.com/p/ibus/> which comes with the
major GNU+Linux operating systems http://oswatershed.org
rusi writes:
> [Steven quote]
> In Python, [1, 2, 3] is another way of writing true, and [] is another
> way of writing false. Similarly with any other arbitrary objects. The
> only things that bools True and False are good for are:
>
> [end Steven quote]
>
>
> So since
TheSaint writes:
> The example was to show that after having made a set
>
> set(aa)
>
> the need to get that set converted into a list.
As pointed out: you already know how to create a set from an object;
creating a list from an object is very similar:
list(set(aa))
But why are you doing t
Is there any Python library for interactive drawing? I've done
some googling but most searches for "drawing" lead me to libraries for
programmatic creation of shapes on some GUI canvas. I'm looking for GUI
widgets that allow the user to draw with the mouse, like a paint
program, and l
On 5/14/2011 1:43 PM, rusi wrote:
But it seems you did not get the moral? Spelt out: "Beware of lossy
compression!"
[Which is also the moral of my 'proof']
I get it now. As I suggested in response to Stephen, [] and [1] spell
False and True only in boolean contexts (if/while headers) where th
On Sat, May 14, 2011 at 11:24 AM, rusi wrote:
> def fib(n):
> if n==1 or n==2:
> return 1
> elif even(n):
> return sq(fib (n//2)) + 2 * fib(n//2) * fib(n//2 - 1)
> else:
> return sq(fib (n//2 + 1)) + sq(fib(n // 2))
>
> This is a strange algo -- logarithmic because i
On 5/14/2011 3:45 AM, rusi wrote:
(True = True) is False
is a syntax error ;-)
and 'True = True' is a (useless) statement,
and statements do not have boolean values,
and 'True == True' *is* True, which is to say,
((True == True) is False) is False.
--
Terry Jan Reedy
--
http://mail.python.o
On 5/14/2011 3:39 AM, Steven D'Aprano wrote:
Th money-quote as regards using arbitrary objects in truth tests:
[quote]
All this changed with the introduction of the two-element
boolean domain {true, false} which provides the vocabulary
needed to assign values to boolean expr
On 5/14/2011 11:11 AM, cesium5...@yahoo.ca wrote:
I would like to build a database of all the MS-Excel file on a LAN. I
would like to get the files metadata : filename, summary, location,
size, etc.
You subject line is about a non-specific as can be, which means that the
person who can answer
On 5/14/2011 3:41 AM, harrismh777 wrote:
Terry Reedy wrote:
Easy, practical use of unicode is still a work in progress.
Apparently... the good news for me is that SBL provides their unicode
font here:
http://www.sbl-site.org/educational/biblicalfonts.aspx
I'm getting much closer here, but
On 5/14/2011 4:41 AM, Nobody wrote:
On Fri, 13 May 2011 10:15:29 -0700, noydb wrote:
I want some code to take the items in a semi-colon-delimted string "list"
and places each in a python list. I came up with below. In the name of
learning how to do things properly, do you experts have a bette
On 5/14/2011 3:20 AM, harrismh777 wrote:
harrismh777 wrote:
def turnOnMonitor():
SC_MONITORPOWER = 0xF170
win32gui.SendMessage(win32con.HWND_BROADCAST,
win32con.WM_SYSCOMMAND, SC_MONITORPOWER, -1)
I've never tried turning my monitor on/off without using my finger...
The computer cannot tur
On 14/05/11 14:12, Andy Baxter wrote:
Hi,
I'm working on adding a Gtk GUI to a python program. Its main function
is to read raw data from an arduino board over USB, and convert it to
MIDI note/controller events to be sent to another program. I've had it
working fine with just a command line i
On 14/05/11 14:12, Andy Baxter wrote:
Hi,
I'm working on adding a Gtk GUI to a python program. Its main function
is to read raw data from an arduino board over USB, and convert it to
MIDI note/controller events to be sent to another program. I've had it
working fine with just a command line i
On Sat, May 14, 2011 at 11:30 AM, Doug Evans wrote:
> Note that --exec-prefix is the runtime location of python.
> GCC uses this to tell libpython where to find its support files.
> [grep for Py_SetProgramName in gdb/python/python.c]
Oops. s/GCC/GDB/
--
http://mail.python.org/mailman/listinfo/p
On Sat, May 14, 2011 at 2:29 AM, Eli Zaretskii wrote:
>> Date: Sat, 14 May 2011 11:09:13 +0200
>> From: Ruben Van Boxem
>> Cc: g...@sourceware.org, python-list@python.org
>>
>> 1. Check hardcoded path; my suggestion would be "> executable>/../lib/python27"
>> 2. If this fails to find the necessar
On Sat, May 14, 2011 at 2:09 AM, Ruben Van Boxem
wrote:
> 2011/5/14 Doug Evans :
>> On Thu, May 12, 2011 at 9:19 AM, Ruben Van Boxem
>> wrote:
>>> (now in plain-text as required by gdb mailing list)
>>>
>>> Hi,
>>>
>>> I am currently trying to integrate Python support into my toolchain
>>> build
On Sun, May 15, 2011 at 12:14 AM, TheSaint wrote:
> newset= set(myset1) & set(myset2)
> list= [newset]
>
> << [{'bla', 'alb', 'lab'}]
>
> Probably list(set) is not like [set].
list(set) creates a list out of the set. [set] creates a list with one
element, the set itself. It's not a copy of the se
On May 14, 8:55 pm, Chris Angelico wrote:
> On Sun, May 15, 2011 at 1:47 AM, rusi wrote:
> > So since
> > [1,2,3] is one way of writing True (lets call it True3)
> > and [1,2] is another (call it True2)
> > then we have True3 == True2 is False
>
> > But since according to Steven (according to Pyt
On May 14, 2:48 am, Mark Dickinson wrote:
> I don't see this (or Hans' version) as cheating at all.
Yeah sure -- cheating is a strong word :-)
> This really *is* the power algorithm, just in a different number system from
> the
> usual one.
Yes that was my point. If we take the standard log
Thanks, is there any other way without using external command?
On Fri, May 13, 2011 at 10:41 PM, Ishwor Gurung wrote:
> Hi.
>
> On 14 May 2011 14:46, Far.Runner wrote:
> > Hi Python Experts:
> > There are two network interfaces on my laptop, one is
> > 100M Ethernet interface, the other is wifi
Hello,
first of all, I'm a dummy in programming. My methods are just do-it-and-try-
it.
For more convinience I commonly using and go with step-into
and breakpoints.
Lately I was setting a class, but it's incomplete and just calling it at the
pdb prompt line I can't use breakpoints or stop it to
On Sun, May 15, 2011 at 1:47 AM, rusi wrote:
> So since
> [1,2,3] is one way of writing True (lets call it True3)
> and [1,2] is another (call it True2)
> then we have True3 == True2 is False
>
> But since according to Steven (according to Python?) True3 *is the
> same* as True2
> we get
> False
On May 14, 6:42 pm, Chris Angelico wrote:
> On Sat, May 14, 2011 at 5:45 PM, rusi wrote:
> > And then we get the interesting result that
> > (True = True) is False
>
> How does this work? In Python, the = sign is illegal there, and if you
> mean True == True, then it's True (obviously), which is
Hello,
I would like to build a database of all the MS-Excel file on a LAN. I
would like to get the files metadata : filename, summary, location,
size, etc.
Is there a dedicated python lib for the task? Is pywin32 one of the
possible lib available?
I would prefer to not building everything
In article ,
David Robinow wrote:
> On Fri, May 13, 2011 at 10:34 PM, Gregory Ewing
> wrote:
> > rusi wrote:
> >
> >> Dijkstra's problem (paraphrased) is that python, by choosing the
> >> FORTRAN alternative of having a non-first-class boolean type, hinders
> >> scientific/mathematical thinking
Ben Finney wrote:
> Another method to do what?
>
Sorry, some time we expect to have said it as we thought it.
The example was to show that after having made a set
set(aa)
the need to get that set converted into a list.
My knowledge drove me to use a comprehension list as a converter.
In anothe
On Fri, May 13, 2011 at 10:34 PM, Gregory Ewing
wrote:
> rusi wrote:
>
>> Dijkstra's problem (paraphrased) is that python, by choosing the
>> FORTRAN alternative of having a non-first-class boolean type, hinders
>> scientific/mathematical thinking/progress.
>
> Python doesn't have the flaw that Di
Peter Otten wrote:
> mylist = list(myset)
> Do you notice the similarity to converting a list to a set?
>
There was something confusing me yesterday in doing that, but (for me
strangely) I got cleared out.
The point was that after a result from:
newset= set(myset1) & set(myset2)
list= [newset]
TheSaint writes:
> Hello
>
> I've stumble to find a solution to get a list from a set
>
>
>
> >>> aa= ['a','b','c','f']
Creates a new list object. Binds the name ‘aa’ to that object.
> >>> aa
> ['a', 'b', 'c', 'f']
Evaluates the object referenced by the name ‘aa’.
> >>> set(aa)
> {'a', 'c',
On Sat, May 14, 2011 at 5:45 PM, rusi wrote:
> And then we get the interesting result that
> (True = True) is False
How does this work? In Python, the = sign is illegal there, and if you
mean True == True, then it's True (obviously), which is not False.
Chris Angelico
--
http://mail.python.org/
Hi,
I'm working on adding a Gtk GUI to a python program. Its main function
is to read raw data from an arduino board over USB, and convert it to
MIDI note/controller events to be sent to another program. I've had it
working fine with just a command line interface, but when I replaced the
comm
Hey all,
Not sure if this is the right place to put this (forgive me for my ignorance,
I'm looking everywhere!). I'm having a problem getting IDLE working. I'm
working off Mac OSX 10.6.7 with Python 3.2 installed and I installed Activetcl
8.5.9 as recommended. IDLE is still crashing at random m
On 14 mai, 09:41, harrismh777 wrote:
> ...
> I'm getting much closer here,
> ...
You should really understand, that Unicode is a domain per
se. It is independent from any os's, programming languages
or applications. It is up to these tools to be "unicode"
compliant.
Working in a full unicode mo
On Sat, May 14, 2011 at 7:41 PM, Nobody wrote:
> to use a regular expression to match everything up to the next delimiter,
> and do this in a loop to extract the individual items.
re.findall() should let you match all items at once, without loop.
--
With best regards,
Daniel Kluev
--
http://ma
2011/5/14 Eli Zaretskii :
>> Date: Sat, 14 May 2011 11:09:13 +0200
>> From: Ruben Van Boxem
>> Cc: g...@sourceware.org, python-list@python.org
>>
>> 1. Check hardcoded path; my suggestion would be "> executable>/../lib/python27"
>> 2. If this fails to find the necessary files/scripts, find it like
TheSaint wrote:
> I've stumble to find a solution to get a list from a set
>
>
>
aa= ['a','b','c','f']
aa
> ['a', 'b', 'c', 'f']
set(aa)
To clarify: this creates a new object, so aa is still a list.
> {'a', 'c', 'b', 'f'}
[k for k in aa]
> ['a', 'b', 'c', 'f']
So you are
> Date: Sat, 14 May 2011 11:09:13 +0200
> From: Ruben Van Boxem
> Cc: g...@sourceware.org, python-list@python.org
>
> 1. Check hardcoded path; my suggestion would be " executable>/../lib/python27"
> 2. If this fails to find the necessary files/scripts, find it like you
> described above in Linux,
2011/5/14 Doug Evans :
> On Thu, May 12, 2011 at 9:19 AM, Ruben Van Boxem
> wrote:
>> (now in plain-text as required by gdb mailing list)
>>
>> Hi,
>>
>> I am currently trying to integrate Python support into my toolchain
>> build (including GDB of course). It is a sysrooted
>> binutils+GCC+GDB+mi
Hello
I've stumble to find a solution to get a list from a set
>>> aa= ['a','b','c','f']
>>> aa
['a', 'b', 'c', 'f']
>>> set(aa)
{'a', 'c', 'b', 'f'}
>>> [k for k in aa]
['a', 'b', 'c', 'f']
I repute the comprehension list too expensive, is there another method?
--
goto /dev/null
--
http:/
On 07/05/2011 02:43, Jon Clements wrote:
On May 7, 12:51 am, Ian Kelly wrote:
On Fri, May 6, 2011 at 4:21 PM, Philip Semanchuk wrote:
What if it's not a list but a tuple or a numpy array? Often I just want to
iterate through an element's items and I don't care if it's a list, set, etc.
For
rusi wrote:
> tried to install easy_install (This is on windows)
> I downloaded the executable and ran it. It claimed to have done its
> job.
Perhaps, the abit to just click is disordering some easy steps like copy the
script files into the normal place.
Only when there's a particular copy then
On May 13, 11:19 pm, Bastian Ballmann wrote:
> Hi python lovers out there,
>
> I am searching for a library to parse data from a graph in an image file
> something likehttp://pytseries.sourceforge.net/_images/yahoo.png
> Any suggestions, hints, links?
>
> TIA && have a nice day! :)
>
> Basti
>
>
On Fri, 13 May 2011 10:15:29 -0700, noydb wrote:
> I want some code to take the items in a semi-colon-delimted string "list"
> and places each in a python list. I came up with below. In the name of
> learning how to do things properly, do you experts have a better way of
> doing it?
> x = "red;
On Fri, 13 May 2011 14:53:50 -0500, harrismh777 wrote:
> The unicode consortium is very careful to make sure that thousands
> of symbols have a unique code point (that's great !) but how do these
> thousands of symbols actually get displayed if there is no font
> consortium? Are there collec
Steven D'Aprano wrote:
I've never tried turning my monitor on/off without using my finger...
You've never had your PC turn your monitor off after X minutes of
inactivity?
I know you're being funny, but actually, no-- I don't.
That's a back-in-the-day thing... all of my monitors (and I on
On 14.05.2011 09:29, harrismh777 wrote:
harrismh777 wrote:
def turnOnMonitor():
SC_MONITORPOWER = 0xF170
win32gui.SendMessage(win32con.HWND_BROADCAST,
win32con.WM_SYSCOMMAND, SC_MONITORPOWER, -1)
Wonder what the equivalent of this is in Linux... ?
Probably xset dpms force {on,off,...}
--
h
On May 14, 12:39 pm, Steven D'Aprano wrote:
> On Thu, 12 May 2011 23:46:12 -0700, rusi wrote:
> > Mathematics has existed for millenia. Hindu-arabic numerals (base-10
> > numbers) have been known for about one millennium
> > The boolean domain is only a 100 years old. Unsurprisingly it is not
> >
On Sat, 14 May 2011 02:20:55 -0500, harrismh777 wrote:
> harrismh777 wrote:
>>
>> def turnOnMonitor():
>> SC_MONITORPOWER = 0xF170
>> win32gui.SendMessage(win32con.HWND_BROADCAST,
>> win32con.WM_SYSCOMMAND, SC_MONITORPOWER, -1)
>
>
> I've never tried turning my monitor on/off without usi
Terry Reedy wrote:
Is there a unix linux package that can be installed that
drops at least 'one' default standard font that will be able to render
all or 'most' (whatever I mean by that) code points in unicode? Is this
a Python issue at all?
Easy, practical use of unicode is still a work in pro
On Thu, 12 May 2011 23:46:12 -0700, rusi wrote:
> Mathematics has existed for millenia. Hindu-arabic numerals (base-10
> numbers) have been known for about one millennium
> The boolean domain is only a 100 years old. Unsurprisingly it is not
> quite 'first-class' yet: See
> http://www.cs.utexas.ed
harrismh777 wrote:
def turnOnMonitor():
SC_MONITORPOWER = 0xF170
win32gui.SendMessage(win32con.HWND_BROADCAST,
win32con.WM_SYSCOMMAND, SC_MONITORPOWER, -1)
Wonder what the equivalent of this is in Linux... ?
--
http://mail.python.org/mailman/listinfo/python-list
On May 13, 11:29 pm, Ian Kelly wrote:
> On Fri, May 13, 2011 at 11:40 AM, rusi wrote:
> > I tried to install easy_install (This is on windows)
> > I downloaded the executable and ran it. It claimed to have done its
> > job.
>
> > But now when I type easy_install at a cmd prompt I get
> > easy_ins
harrismh777 wrote:
def turnOnMonitor():
SC_MONITORPOWER = 0xF170
win32gui.SendMessage(win32con.HWND_BROADCAST,
win32con.WM_SYSCOMMAND, SC_MONITORPOWER, -1)
I've never tried turning my monitor on/off without using my finger...
gonna have to play with this... wouldn't that be a great
Astan Chee wrote:
import time
import win32gui
import win32con
import win32api
def turnOffMonitor():
SC_MONITORPOWER = 0xF170
win32gui.SendMessage(win32con.HWND_BROADCAST,
win32con.WM_SYSCOMMAND, SC_MONITORPOWER, 2)
def turnOnMonitor():
SC_MONITORPOWER = 0xF170
win32gui.SendMessage(w
71 matches
Mail list logo