On Tue, Jun 21, 2011 at 11:58 PM, Chris Torek wrote:
> I was curious about implementing prime factorization as a generator,
> using a prime-number generator to come up with the factors, and
> doing memoization of the generated primes to produce a program that
> does what "factor" does, e.g.:
This
On Tue, Jun 21, 2011 at 03:02:57PM -0400, Terry Reedy wrote:
> On 6/21/2011 9:43 AM, Antoon Pardon wrote:
>
> > matcher = SequenceMatcher(ls1, ls2)
> ...
> >What am I doing wrong?
>
> Read the doc, in particular, the really stupid signature of the class:
>
> "class difflib.SequenceMatcher(isju
2011/6/22 Saul Spatz :
> Hi,
>
> I'm just starting to learn a bit about Unicode. I want to be able to read a
> utf-8 encoded file, and print out the codepoints it encodes. After many
> false starts, here's a script that seems to work, but it strikes me as
> awfully awkward and unpythonic. Have
Hi,
I just used coverage.py for the first time, and like it very much.
Is it possible to display how many times a line was executed?
I want to see lines which are executed very often red and
lines which are executed not often green.
I know there are other tools like hotshot, but AFAIK they
don'
Saul Spatz wrote:
> Hi,
>
> I'm just starting to learn a bit about Unicode. I want to be able to read
> a utf-8 encoded file, and print out the codepoints it encodes. After many
> false starts, here's a script that seems to work, but it strikes me as
> awfully awkward and unpythonic. Have you a
En Sun, 19 Jun 2011 12:35:38 -0300, escribió:
The version info comes from the DLL - I wonder if the DLL being found
is somehow old?
Make sure:
>>> import sys
>>> win32api.GetModuleFileName(sys.dllhandle)
Is the DLL you expect.
After uninstalling and reinstalling for the current user only
That seems to me correct.
>>> '\\u{:04x}'.format(ord(u'é'))
\u00e9
>>> '\\U{:08x}'.format(ord(u'é'))
\U00e9
>>>
because
>>> u'\U00e9'
File "", line 1
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes
in position 0-5: end of string in escape sequence
>>> u'\U00e9'
é
On Jun 22, 2:21 am, News123 wrote:
> Out of curiousity: Do you know whether the imports would be executed for
> each potential command as soon as I call manage.py or only
> 'on demand'?
Why would you care ? Just importing the module shouldn't have any side
effect.
--
http://mail.python.org/mailm
Michael Hrivnak wrote:
> Do you have a special reason for wanting to implement
> your own email storage?
Learning python :)
It seems very easy to get my mails with the poplib help.
Usually I work with Kmail which imports mbox files.
I'm not prone to set up a SMTP server on my PC.
--
goto /dev/
Chris Torek wrote:
> Now that the exercise has been solved...
>
> Instead of "really short code to solve the problem", how about
> some "really long code"? :-)
>
> I was curious about implementing prime factorization as a generator,
> using a prime-number generator to come up with the factors, a
Saul Spatz wrote:
>
> You need to do the update_idletasks to force the canvas to be mapped
> before you figure out the bounding box. Until the canvas is mapped to the
> screen, the bounding box is (0,0,1,1) so there no scrolling possible.
> (You can call update_ideltasks through any widget.)
On Wed, Jun 22, 2011 at 10:01 PM, Anny Mous wrote:
> prime = table[i]
> del table[i]
>
I don't fully understand your algorithm, but I think these two lines
can be rewritten as:
prime=table.pop(i)
Interesting algo. A recursive generator, not sure I've seen one of those befor
Denodev eBook - Blog PDF eBook. Free download eBook. Newest eBooks
updated everyday. All eBooks are completely free. Come and stay here.
subscribe for newsletters. subscribe for rss. www.denodev.com
--
http://mail.python.org/mailman/listinfo/python-list
Hi All,
I am working on application which needs to do a authentication against
LDAP, if LDAP not installed then local system account (administrator
user in windows and root user in Linux). This should work on both
Windows and Linux.
Which library I should use for that.
Regards,
Anurag
--
http:/
Thanks. I agree with you about the generator. Using your first suggestion,
code points above U+ get separated into two "surrogate pair" characters
fron UTF-16. So instead of U=10 I get U+DBFF and U+DFFF.
--
http://mail.python.org/mailman/listinfo/python-list
On 22/06/2011 14:34, Anurag wrote:
Hi All,
I am working on application which needs to do a authentication against
LDAP, if LDAP not installed then local system account (administrator
user in windows and root user in Linux). This should work on both
Windows and Linux.
Which library I should use
On Wed, 2011-06-22 at 06:34 -0700, Anurag wrote:
> Hi All,
>
> I am working on application which needs to do a authentication against
> LDAP, if LDAP not installed then local system account (administrator
> user in windows and root user in Linux). This should work on both
> Windows and Linux.
See
Hi,
I am hoping someone here can help me with a problem I'd like to
resolve with Python. I have used it before for some other projects but
have never needed to use Regular Expressions before. It's quite
possible I am following completley the wrong tack for this task (so
any advice appreciated).
I
Thanks very much. This is the elegant kind of solution I was looking for. I
had hoped there was a way to do it without even addressing the matter of
surrogates, but apparently not. The reason I don't like this is that it
depends on knowing that python internally stores strings in UTF-16. I e
to expand. I have parsed one of the lines manually to try and break
the process I'm trying to automate down.
source:
Theurgic Lore, Lore, n/a, 105, 70, 30, Distil Mana
output:
TheurgicLore [label="{ Theurgic Lore |{Lore|n/a}|{105|70|30}}"];
DistilMana -> TheurgicLore;
This is the steps I would t
On 2011-06-22, Andy Barnes wrote:
> to expand. I have parsed one of the lines manually to try and break
> the process I'm trying to automate down.
>
> source:
> Theurgic Lore, Lore, n/a, 105, 70, 30, Distil Mana
>
> output:
> TheurgicLore [label="{ Theurgic Lore |{Lore|n/a}|{105|70|30}}"];
> Disti
Andy Barnes wrote:
> Hi,
>
> I am hoping someone here can help me with a problem I'd like to
> resolve with Python. I have used it before for some other projects but
> have never needed to use Regular Expressions before. It's quite
> possible I am following completley the wrong tack for this task
On 22/06/2011 06:58, Chris Torek wrote:
Now that the exercise has been solved...
Instead of "really short code to solve the problem", how about
some "really long code"? :-)
I was curious about implementing prime factorization as a generator,
using a prime-number generator to come up with the fa
why tuples are immutable whereas list are mutable?
why when we do x=y where y is a list and then change a element in x, y
changes too( but the same is not the case when we change the whole value in
x ), whereas, in tuples when we change x, y is not affected and also we cant
change each individual e
On 2011.06.22 10:45 AM, Chetan Harjani wrote:
> why tuples are immutable whereas list are mutable?
Tuples are more efficient and more appropriate for a list of items that
doesn't need to change.
> why when we do x=y where y is a list and then change a element in x, y
> changes too( but the same is
On Wed, Jun 22, 2011 at 6:01 AM, Anny Mous wrote:
> def sieve():
> """Yield prime integers efficiently.
>
> This uses the Sieve of Eratosthenes, modified to generate the primes
> lazily rather than the traditional version which operates on a fixed
> size array of integers.
> """
>
On Jun 21, 9:12 pm, Adam Chapman
wrote:
> On Jun 21, 8:00 pm, Ethan Furman wrote:
>
>
>
>
>
>
>
>
>
> > Adam Chapman wrote:
> > > Thanks Ethan
>
> > > No way could I have worked that out in my state of stress!
>
> > > For your second idea, would I need to type that into the python command
> > > l
On Wed, Jun 22, 2011 at 4:45 PM, Chetan Harjani
wrote:
> why tuples are immutable whereas list are mutable?
Because an immutable data type was needed, and a mutable type was also needed ;)
> why when we do x=y where y is a list and then change a element in x, y
> changes too( but the same is not
On 22 June 2011 16:53, Andrew Berg wrote:
> On 2011.06.22 10:45 AM, Chetan Harjani wrote:
>> why tuples are immutable whereas list are mutable?
> Tuples are more efficient and more appropriate for a list of items that
> doesn't need to change.
And also it sometimes useful to be sure that somethin
On Wed, Jun 22, 2011 at 8:54 AM, Adam Chapman
wrote:
> I've added the python directories to the environment variable "path"
> in my computer (http://showmedo.com/videotutorials/video?
> name=96&fromSeriesID=96), which means I can now call python from
> the windows DOS-style command prompt.
>
Adam Chapman wrote:
On Jun 21, 9:12 pm, Adam Chapman
wrote:
On Jun 21, 8:00 pm, Ethan Furman wrote:
Adam Chapman wrote:
Thanks Ethan
No way could I have worked that out in my state of stress!
For your second idea, would I need to type that into the python command
line interface (the
On Jun 22, 4:54 pm, Adam Chapman
wrote:
> On Jun 21, 9:12 pm, Adam Chapman
> wrote:
>
>
>
>
>
>
>
>
>
> > On Jun 21, 8:00 pm, Ethan Furman wrote:
>
> > > Adam Chapman wrote:
> > > > Thanks Ethan
>
> > > > No way could I have worked that out in my state of stress!
>
> > > > For your second idea,
Adam Chapman wrote:
On Jun 22, 4:54 pm, Adam Chapman
wrote:
On Jun 21, 9:12 pm, Adam Chapman
wrote:
On Jun 21, 8:00 pm, Ethan Furman wrote:
Adam Chapman wrote:
Thanks Ethan
No way could I have worked that out in my state of stress!
For your second idea, would I need to type that i
[I am biting only because this is my field of expertise, and I am really
getting tired reading from people not having a shadow of a trace of a
minimum clue what these languages that I like can and can't do.]
Chris Angelico wrote:
> Random rant and not very on-topic. Feel free to hit Delete and
On Jun 22, 5:51 pm, Ethan Furman wrote:
> Adam Chapman wrote:
> > On Jun 22, 4:54 pm, Adam Chapman
> > wrote:
> >> On Jun 21, 9:12 pm, Adam Chapman
> >> wrote:
>
> >>> On Jun 21, 8:00 pm, Ethan Furman wrote:
> Adam Chapman wrote:
> > Thanks Ethan
> > No way could I have worked that
On Jun 22, 5:51 pm, Adam Chapman
wrote:
> On Jun 22, 5:51 pm, Ethan Furman wrote:
>
>
>
>
>
>
>
>
>
> > Adam Chapman wrote:
> > > On Jun 22, 4:54 pm, Adam Chapman
> > > wrote:
> > >> On Jun 21, 9:12 pm, Adam Chapman
> > >> wrote:
>
> > >>> On Jun 21, 8:00 pm, Ethan Furman wrote:
> > Adam
On 22 juin, 16:07, Saul Spatz wrote:
> Thanks very much. This is the elegant kind of solution I was looking for. I
> had hoped there was a way to do it without even addressing the matter of
> surrogates, but apparently not. The reason I don't like this is that it
> depends on knowing that py
Adam Chapman wrote:
Thanks a lot, must be getting close now...
I changed the indentation one lines 136-168, and put in the command
window:
nfold.py --booster=Adaboost --folds=5 --data=spambase.data --
spec=spambase.spec --rounds=500 --tree=ADD_ALL --generate
no syntax errors this time, it just
On 22-6-2011 4:44, Chris Angelico wrote:
> Followup: The test box has been administratively taken offline after
> about an hour of testing. Thank you to everyone who participated; it
> seems we have a lot of changes to make!
>
> Monty failed the test. But it was an incredibly successful test. And
Thanks for your responses to my student question about using OS paths in
Python.
For the more general case, I am a Linux user interested in making my scripts
platform neutral, which would include Linux, Unix (including Mac), and
Windows. I have looked at the python.org os segment and didn't ge
On 22-6-2011 5:02, John Salerno wrote:
> Thanks. So far they are helping me with Python too, but definitely not
> as much as more general exercises would, I'm sure. The part about
> writing the code is fun, but once that's done, I seem to end up stuck
> with an inefficient implementation because I
In Tim Hanson
writes:
> For the more general case, I am a Linux user interested in making my scripts
> platform neutral, which would include Linux, Unix (including Mac), and
> Windows. I have looked at the python.org os segment and didn't get an answer.
> Is there a library (bonus would be
On Jun 22, 6:13 pm, Adam Chapman
wrote:
> On Jun 22, 5:51 pm, Adam Chapman
> wrote:
>
>
>
>
>
>
>
>
>
> > On Jun 22, 5:51 pm, Ethan Furman wrote:
>
> > > Adam Chapman wrote:
> > > > On Jun 22, 4:54 pm, Adam Chapman
> > > > wrote:
> > > >> On Jun 21, 9:12 pm, Adam Chapman
> > > >> wrote:
>
> >
Adam Chapman wrote:
Thanks again Ethan, It did begin to run nfold.py this time, after I
added the environment variable "CLASSPATH" to my system. It threw back
a java error, but I guess this isn;t the right place to be asking
about that
C:\Users\Adam\Desktop\JBOOST\jboost-2.2\jboost-2.2\scripts>n
I want to be able to connect to a windows share via python. My end goal is
to be able to recursively search through windows shares. I want to do this
in Linux as well. So given a share such as \\computer\test I would like to
search through the test directory and any sub directories for any file
How to declare a constant in python 3?
--
http://mail.python.org/mailman/listinfo/python-list
On 22/06/2011 19:38, Travis Altman wrote:
I want to be able to connect to a windows share via python. My end goal
is to be able to recursively search through windows shares. I want to
do this in Linux as well. So given a share such as \\computer\test I
would like to search through the test dir
AFAICT, the python iterator concept only supports readable iterators, not
write.
Is this true?
for example:
for e in sequence:
do something that reads e
e = blah # will do nothing
I believe this is not a limitation on the for loop, but a limitation on the
python iterator concept. Is thi
Neal Becker wrote:
AFAICT, the python iterator concept only supports readable iterators, not write.
Is this true?
for example:
for e in sequence:
do something that reads e
e = blah # will do nothing
I believe this is not a limitation on the for loop, but a limitation on the
python itera
On Jun 22, 2011 12:31 PM, "Neal Becker" wrote:
>
> AFAICT, the python iterator concept only supports readable iterators, not
write.
> Is this true?
>
> for example:
>
> for e in sequence:
> do something that reads e
> e = blah # will do nothing
>
> I believe this is not a limitation on the for l
On Jun 22, 2011 11:44 AM, "Travis Altman" wrote:
>
> I want to be able to connect to a windows share via python. My end goal
is to be able to recursively search through windows shares. I want to do
this in Linux as well. So given a share such as \\computer\test I would
like to search through th
On Jun 22, 2011 12:03 PM, "sidRo" wrote:
>
> How to declare a constant in python 3?
> --
You don't. Python doesn't have declarations (other than global and
nonlocal). Convention is that anything in all caps should be considered a
constant but there's no language-level enforcement of it.
--
http
On Wed, Jun 22, 2011 at 7:54 PM, sidRo wrote:
> How to declare a constant in python 3?
There aren't true constants in Python, but instead we use a standard
defined by PEP 8, which states constants are in all caps, for example,
PI = 3.14, as opposed to pi = 3.14 which could change (according to
PE
On Wed, 22 Jun 2011 15:28:23 -0400, Neal Becker wrote:
> AFAICT, the python iterator concept only supports readable iterators,
> not write. Is this true?
>
> for example:
>
> for e in sequence:
> do something that reads e
> e = blah # will do nothing
>
> I believe this is not a limitation o
Steven D'Aprano wrote:
> On Wed, 22 Jun 2011 15:28:23 -0400, Neal Becker wrote:
>
>> AFAICT, the python iterator concept only supports readable iterators,
>> not write. Is this true?
>>
>> for example:
>>
>> for e in sequence:
>> do something that reads e
>> e = blah # will do nothing
>>
>
2011/6/22 Saul Spatz :
> Thanks. I agree with you about the generator. Using your first suggestion,
> code points above U+ get separated into two "surrogate pair" characters
> fron UTF-16. So instead of U=10 I get U+DBFF and U+DFFF.
> --
> http://mail.python.org/mailman/listinfo/python
Hi All,
I'm pleased to announce that PyPad 2.7.1 (Update 4), a simple python
environment for the iPad / iPhone, is now available in the iTunes
store. It can be found at:
http://itunes.apple.com/au/app/pypad/id428928902?mt=8
Update 4 adds the ability to create multiple modules and import them
On 6/22/2011 1:32 AM, Paul Rubin wrote:
Terry Reedy writes:
If the best C program for a problem takes 10 seconds or more, then
applying the same 1 minute limit to Python is insane, and contrary to
the promotion of good algorithm thinking.
The Euler problems
are not the only algorithm probl
On 6/22/2011 11:45 AM, Chetan Harjani wrote:
why tuples are immutable whereas list are mutable?
Because tuples do not have mutation methods, which lists do.
Tuple and lists both have .__getitem__ but tuples do not have
.__setitem__ or .__delitem__ (or .append, .extend, .sort, or .reverse).
Steven D'Aprano wrote:
> On Wed, 22 Jun 2011 15:28:23 -0400, Neal Becker wrote:
>
>> AFAICT, the python iterator concept only supports readable iterators,
>> not write. Is this true?
>>
>> for example:
>>
>> for e in sequence:
>> do something that reads e
>> e = blah # will do nothing
>>
>
You could probably implement something like this using generators and the
send method (note the example is untested and intended for 2.6: I lack
Python on this machine):
def gen(list_):
for i, v in enumerate(list_):
list_[i] = yield v
def execute():
data = range(10)
iterator = gen(data)
Mel wrote:
> Steven D'Aprano wrote:
>> I *guess* that what you mean by "writable iterators" is that rebinding e
>> should change seq in place, i.e. you would expect that seq should now
>> equal [42, 42]. Is that what you mean? It's not clear.
>>
>> Fortunately, that's not how it works, and far fr
On 23/06/2011 00:10, Neal Becker wrote:
Steven D'Aprano wrote:
On Wed, 22 Jun 2011 15:28:23 -0400, Neal Becker wrote:
AFAICT, the python iterator concept only supports readable iterators,
not write. Is this true?
for example:
for e in sequence:
do something that reads e
e = blah # wil
Hello Everyone,
So I figured out the last problem about why I couldn't load my UI files but
now I've got something that has be totally stumped. I've worked on it most
of the day yesterday, Google'd it, and fought with it today and I'm
admitting defeat and coming to the group with hat in hand askin
On Thu, 23 Jun 2011 09:10 am Neal Becker wrote:
> Steven D'Aprano wrote:
>
>> On Wed, 22 Jun 2011 15:28:23 -0400, Neal Becker wrote:
>>
>>> AFAICT, the python iterator concept only supports readable iterators,
>>> not write. Is this true?
>>>
>>> for example:
>>>
>>> for e in sequence:
>>> d
On Thu, 23 Jun 2011 09:30 am Thomas 'PointedEars' Lahn wrote:
> Mel wrote:
>
>> Steven D'Aprano wrote:
>>> I *guess* that what you mean by "writable iterators" is that rebinding e
>>> should change seq in place, i.e. you would expect that seq should now
>>> equal [42, 42]. Is that what you mean?
I did not think about using a global variable, and the top-level
try...except solution is interesting. After further thinking, I have
to reformulate my initial question:
How do I manage to run code before my imports?
For example, I want to make sure that I can use the logging module in
the case a
I have a program: decrypt2.py which contains this function:
def scramble2Decrypt(cipherText):
halfLength = len(cipherText) // 2
oddChars = cipherText[:halfLength]
evenChars = cipherText[halfLength:]
plainText = ""
for i in range(halfLength):
plainText = plainText + ev
On 23/06/2011 03:19, bill lawhorn wrote:
I have a program: decrypt2.py which contains this function:
def scramble2Decrypt(cipherText):
halfLength = len(cipherText) // 2
oddChars = cipherText[:halfLength]
evenChars = cipherText[halfLength:]
plainText = ""
for i in range
On Wednesday, June 22, 2011 4:10:39 PM UTC-7, Neal Becker wrote:
> AFAIK, the above is the only python idiom that allows iteration over a
> sequence
> such that you can write to the sequence. And THAT is the problem. In many
> cases, indexing is much less efficient than iteration.
Well, if yo
Not tried SPE. But in PyScripter, as simple as that.
import sys
def scramble2Decrypt(cipherText):
halfLength = len(cipherText) // 2
oddChars = cipherText[:halfLength]
evenChars = cipherText[halfLength:]
plainText = ""
for i in range(halfLength):
plainText = plainText +
Ben Finney wrote:
>Tim Roberts writes:
>
>> Right, because strptime doesn't support %Z.
>
>Au contraire:
>
>Support for the %Z directive is based on the values contained in
>tzname and whether daylight is true. Because of this, it is
>platform-specific except for recognizing UTC and
Don't relate it anyhow to foreach of perl I would say, although the behaviour
may be same in some aspect
--
http://mail.python.org/mailman/listinfo/python-list
On Jun 22, 7:01 pm, Adam Tauno Williams
wrote:
> On Wed, 2011-06-22 at 06:34 -0700, Anurag wrote:
> > Hi All,
>
> > I am working on application which needs to do a authentication against
> > LDAP, if LDAP not installed then local system account (administrator
> > user in windows and root user in L
Do the same thing with an interconversion of tuple and list and you will be off
to the older way:
a=(1,2,3)
b=list(a)
b[0]=11
print a
print b
Output:
(1, 2, 3)
[11, 2, 3]
--
http://mail.python.org/mailman/listinfo/python-list
On my cygwin system I just do the following for my network drive 'q'
import commands
print commands.getoutput('ls /cygdrive/q')
Run it as - python fileList.py
Here is the output:
DataTables
Functions
Object_Repositories
Recovery_Scenarios
Scripts
--
http://mail.python.org/mailman/listinfo/pyth
Mel wrote:
>
>It certainly can be done faster. I ran it against the factor finder that I
>wrote, and it popped up the answer
>
>mwilson@tecumseth:~$ bin/factors.py 600851475143
>71 839 1471 ...
>
>before I could glance at my watch. factors.py works, as does yours, by
>testing for small factors
Hi!
(sorry for my bad english...)
On Win 7 64 bits:
Command-Line
CD \Python27
dir C:\Windows\System32\SoundRecorder.exe:==> OK
Python.exe
>>> import os
>>> os.system("dir C:\\Windows\\System32\\SoundRecorder.exe")
==> Do not found the file !!!
and os.system("cmd /k") then "dir
Dnia Wed, 22 Jun 2011 22:17:49 +0100, Noah Hall napisał(a):
> On Wed, Jun 22, 2011 at 7:54 PM, sidRo wrote:
>> How to declare a constant in python 3?
>
> There aren't true constants in Python, but instead we use a standard
> defined by PEP 8, which states constants are in all caps, for example,
Hi i am new for this version and could please help me .
--
http://mail.python.org/mailman/listinfo/python-list
80 matches
Mail list logo