On Fri, Dec 21, 2012 at 4:23 PM, iMath wrote:
> redirect standard output problem
>
> why the result only print A but leave out 888 ?
No idea, because when I paste your code into the Python 3.3
interpreter or save it to a file and run it, it does exactly what I
would expect. A and 888 get sent to
hi, everyone:
I want to compile python 3.3 with bz2 support on RedHat 5.5 but fail to do
that. Here is how I do it:
1??download bzip2 and compile it(make??make -f Makefile_libbz2_so??make
install)
2??chang to python 3.3 source directory : ./configure
--with-bz2=/usr/local/include
hi, everyone:
I want to compile python 3.3 with bz2 support on RedHat 5.5 but fail to do
that. Here is how I do it:
1. download bzip2 and compile it(make??make -f Makefile_libbz2_so??make
install)
2.chang to python 3.3 source directory : ./configure
--with-bz2=/usr/local/include
On Fri, Dec 21, 2012 at 4:23 PM, iMath wrote:
> Pass and return
> Are these two functions the same ?
>
> def test():
> return
>
> def test():
> pass
They're different statements, but in this case they happen to
accomplish the same thing.
The pass statement means "do nothing". For
On 12/21/2012 12:23 AM, iMath wrote:
Pass and return
Are these two functions the same ?
def test():
return
def test():
pass
From the point of style, of course, the latter is
much better because that's the idiomatic way
to define a no-op function. With a return, it
looks li
On 12/21/2012 12:23 AM, iMath wrote:
Pass and return
Are these two functions the same ?
def test():
return
def test():
pass
I believe they are the same, but these statements have
different meanings in other circumstances, e.g.:
Class A(object): pass
def test():
if x: re
Pass and return
Are these two functions the same ?
def test():
return
def test():
pass
--
http://mail.python.org/mailman/listinfo/python-list
redirect standard output problem
why the result only print A but leave out 888 ?
import sys
class RedirectStdoutTo:
def __init__(self, out_new):
self.out_new = out_new
def __enter__(self):
sys.stdout = self.out_new
def __exit__(self, *args):
sys.stdout = sys._
On Fri, Dec 21, 2012 at 1:05 PM, Steven D'Aprano
wrote:
> On Thu, 20 Dec 2012 18:59:39 -0500, Terry Reedy wrote:
>> What Python does have is 11 versions of the augmented assignment
>> statement: +=, -=, *=, /=, //=, %=, **=, >>=, <<=, &=, ^=, |=. Moreover,
>> these are *intended* to be implemented
In article ,
"larry.mart...@gmail.com" wrote:
> On Thursday, December 20, 2012 5:38:03 PM UTC-7, Chris Angelico wrote:
> > On Fri, Dec 21, 2012 at 11:19 AM, larry.mart...@gmail.com
> >
> > wrote:
> >
> > > This code works, but it takes way too long to run - e.g. when cdata has
> > > 600,000
On 12/20/2012 08:46 PM, larry.mart...@gmail.com wrote:
> On Thursday, December 20, 2012 6:17:04 PM UTC-7, Dave Angel wrote:
>>
> Of course it's a fragment - it's part of a large program and I was just
> showing the relevant parts.
But it seems these are methods in a class, or something, so we're
I maintain a Tkinter application that's a front-end to to a package
manger, and I have never been able to find a way to keep the app from
locking up at some point during the piping in of the package manager's
build output into a text widget. At some point the buffer is overwhelmed
and the app s
On Fri, Dec 21, 2012 at 11:43 AM, larry.mart...@gmail.com
wrote:
> It came from a database. Originally I was getting just the data I wanted
> using SQL, but that was taking too long also. I was selecting just the
> messages I wanted, then for each one of those doing another query to get the
> d
On 12/20/2012 09:39 PM, Mitya Sirenef wrote:
On 12/20/2012 08:46 PM, larry.mart...@gmail.com wrote:
On Thursday, December 20, 2012 6:17:04 PM UTC-7, Dave Angel wrote:
On 12/20/2012 07:19 PM, larry.mart...@gmail.com wrote:
I have a list of tuples that contains a tool_id, a time, and a
message.
On 12/20/2012 08:46 PM, larry.mart...@gmail.com wrote:
On Thursday, December 20, 2012 6:17:04 PM UTC-7, Dave Angel wrote:
On 12/20/2012 07:19 PM, larry.mart...@gmail.com wrote:
I have a list of tuples that contains a tool_id, a time, and a message. I want
to select from this list all the elem
On Thu, 20 Dec 2012 18:59:39 -0500, Terry Reedy wrote:
>> On Thu, Dec 20, 2012 at 8:37 PM, Pierre Quentel
>> wrote:
>>> I'm afraid I am going to disagree. The document is a tree structure,
>>> and today Python doesn't have a syntax for easily manipulating trees.
>
> What Python does have is 11 v
On 2012-12-21 00:19, larry.mart...@gmail.com wrote:
I have a list of tuples that contains a tool_id, a time, and a message. I want
to select from this list all the elements where the message matches some
string, and all the other elements where the time is within some diff of any
matching mess
Short answer: Use the POST method on the form instead of GET. Depending how
you process the form you might need to make a few changes to the script
that answers the request.
--
http://mail.python.org/mailman/listinfo/python-list
On Thursday, December 20, 2012 6:17:04 PM UTC-7, Dave Angel wrote:
> On 12/20/2012 07:19 PM, larry.mart...@gmail.com wrote:
>
> > I have a list of tuples that contains a tool_id, a time, and a message. I
> > want to select from this list all the elements where the message matches
> > some string
On 20/12/12 23:11:45, Jack Silver wrote:
> I have two Linux From Scratch machine.
>
> On the first one (the server), I want to build install python 3.3.0 in a
> shared filesystem and access it from the second one (the client). These
> machines are fairly minimal in term of the number of software i
Hans Mulder wrote:
> What happens if instead of a class you pass a function that
> takes the same arguments as the SocketServer.BaseRequestHandler
> constructor and returns a new instance of your ReqHandler?
> That's not quite what the documentaion clls for, but I'd hope
> it's close enough.
Int
On 12/20/2012 07:19 PM, larry.mart...@gmail.com wrote:
> I have a list of tuples that contains a tool_id, a time, and a message. I
> want to select from this list all the elements where the message matches some
> string, and all the other elements where the time is within some diff of any
> matc
Terry Reedy wrote:
> > server = SocketServer.TCPServer((192.168.1.10, 12345), ReqHandler)
> >
> > where ReqHandler is the name of a class derived from
> > SocketServer.BaseRequestHandler
> You misunderstood the doc. You pass the class, not the name of the class.
> From 21.19.4.1. socketserver.
Hi Everyone,
I'm a linux admin that was tasked by his python programming boss to solve a
problem my boss is having with a web form he wrote on our site. Unfortunately
for me, I lack any experience whatsoever with python and very little with
programming on the web, so my hope is someone can poin
On 20/12/12 23:52:24, Jens Thoms Toerring wrote:
> I'm writing a TCP server, based on SocketServer:
>
> server = SocketServer.TCPServer((192.168.1.10, 12345), ReqHandler)
>
> where ReqHandler is the name of a class derived from
> SocketServer.BaseRequestHandler
>
> class ReqHandler(SocketServe
On 12/20/2012 5:52 PM, Jens Thoms Toerring wrote:
You are rather likely right and I probably should have written:
"I don't see any way to pass that variable to the object that
is supposed to use it". Perhaps you have an idea how it could
be done correctly when I explain the complete picture: I'm
On Thursday, December 20, 2012 5:38:03 PM UTC-7, Chris Angelico wrote:
> On Fri, Dec 21, 2012 at 11:19 AM, larry.mart...@gmail.com
>
> wrote:
>
> > This code works, but it takes way too long to run - e.g. when cdata has
> > 600,000 elements (which is typical for my app) it takes 2 hours for thi
On Thursday, December 20, 2012 2:11:45 PM UTC-8, Jack Silver wrote:
> I have two Linux From Scratch machine.
> Hence, I do not need to install all those libraries on the client machine.
> Right ?
It depends on what the client needs. For example if you use zlib compression in
the protocol, you'll
On Fri, Dec 21, 2012 at 11:19 AM, larry.mart...@gmail.com
wrote:
> This code works, but it takes way too long to run - e.g. when cdata has
> 600,000 elements (which is typical for my app) it takes 2 hours for this to
> run.
>
> Can anyone give me some suggestions on speeding this up?
>
It sound
On Thu, Dec 20, 2012 at 12:19 PM, wrote:
> The first (and it should be quite obvious) consequence is that
> you create bloated, unnecessary and useless code. I simplify
> the flexible string representation (FSR) and will use an "ascii" /
> "non-ascii" model/terminology.
>
> If you are an "ascii"
On Thu, Dec 20, 2012 at 8:37 PM, Pierre Quentel
wrote:
I'm afraid I am going to disagree. The document is a tree
structure, and today Python doesn't have a syntax for easily
manipulating trees.
What Python does have is 11 versions of the augmented assignment
statement: +=, -=, *=, /=, //=,
On 12/20/2012 2:19 PM, wxjmfa...@gmail.com wrote:
My feeling is that most of the people are defending this FSR simply
because it exists, not because of its intrisic quality.
The fact, contrary to your feeling, is that I was initially dubious that
is could be made to work as well as it does. I
Thanks a lot to all three of you: that helped me understand
the errors of my ways! You just saved me a few more hours
of head-scratching;-)
A few replies to the questions and comments by Steven:
Steven D'Aprano wrote:
> On Thu, 20 Dec 2012 20:39:19 +, Jens Thoms Toerring wrote:
> > and my ex
On Thu, 20 Dec 2012 11:40:21 -0800, wxjmfauth wrote:
> I do not care
> about this optimization. I'm not an ascii user. As a non ascii user,
> this optimization is just irrelevant.
WRONG.
Every Python user is an ASCII user. Every Python program has hundreds or
thousands of ASCII strings.
# ===
On 12/20/2012 2:40 PM, wxjmfa...@gmail.com wrote:
What should a Python user think, if he sees his strings
are comsuming more memory just because he uses non ascii
characters
What should a Python user think, if he (or she) sees his (or her)
strings sometimes or often consuming less memory than
On 12/20/2012 2:57 PM, wxjmfa...@gmail.com wrote:
I shew a case where the Py33 works 10 times slower than Py32,
"replace". You the devs spend your time to correct that case.
I discovered that it is the 'find' part of find and replace that is
slower. The comparison is worse on Windows than on
I have two Linux From Scratch machine.
On the first one (the server), I want to build install python 3.3.0 in a
shared filesystem and access it from the second one (the client). These
machines are fairly minimal in term of the number of software installed. I
just want to install python on this fil
On Thu, 20 Dec 2012 20:39:19 +, Jens Thoms Toerring wrote:
> Hi,
>
>I hope that this isn't a stupid question, asked already a
> hundred times, but I haven't found anything definitive on the problem I
> got bitten by. I have two Python files like this:
>
> S1.py --
> import ra
On 12/20/2012 2:19 PM, wxjmfa...@gmail.com wrote:
If you are an "ascii" user, a FSR model has no sense. An
"ascii" user will use, per definition, only "ascii characters".
If you are a "non-ascii" user, the FSR model is also a non
sense, because you are per definition a n"on-ascii" user of
"non
I thought that with python you can specify first layer's attribute table in the
table of contents and then go through the records in arcgis.
--
http://mail.python.org/mailman/listinfo/python-list
On Thursday, December 20, 2012 2:03:52 PM UTC-7, Steven D'Aprano wrote:
> On Thu, 20 Dec 2012 12:39:38 -0800, balparmak wrote: > I am working with the
> python code below in ArcGIS to zoom into a > shapefile's attribute table row
> features without selected until the end > of table one by one. >
On 12/20/2012 01:08 PM, balpar...@gmail.com wrote:
> Thank you for your reply Grant,
>
> I am trying to attach mxd's but no chance. As you said that i dont have much
> experience in python. I used to work with VBA but its not an option anymore
> with new ArcGIS 10.
>
> How can I add mxd's here?
On Fri, Dec 21, 2012 at 7:20 AM, MRAB wrote:
> On 2012-12-20 19:19, wxjmfa...@gmail.com wrote:
>> The rule is to treat every character of a unique set of characters
>> of a coding scheme in, how to say, an "equal way". The problematic
>> can be seen the other way, every coding scheme has been buil
On Thu, 20 Dec 2012 12:39:38 -0800, balparmak wrote:
> I am working with the python code below in ArcGIS to zoom into a
> shapefile's attribute table row features without selected until the end
> of table one by one.
>
> I am trying to use this code but this one requires that a row is
> selected.
Jens Thoms Toerring wrote:
> Hi,
>
>I hope that this isn't a stupid question, asked already a
> hundred times, but I haven't found anything definitive on
> the problem I got bitten by. I have two Python files like
> this:
>
> S1.py --
> import random
> import S2
>
> class R( ob
On Thu, 20 Dec 2012 10:08:20 -0800, balparmak wrote:
> Thank you for your reply Grant,
>
> I am trying to attach mxd's but no chance. As you said that i dont have
> much experience in python. I used to work with VBA but its not an option
> anymore with new ArcGIS 10.
>
> How can I add mxd's here
On 12/20/2012 03:39 PM, Jens Thoms Toerring wrote:
> Hi,
>
>I hope that this isn't a stupid question, asked already a
> hundred times, but I haven't found anything definitive on
> the problem I got bitten by. I have two Python files like
> this:
>
> S1.py --
> import random
> impor
I'm just learning Python, so I doubt I could be much help, but I'd like to see
how this progresses, maybe learn a little more about the language.
--
http://mail.python.org/mailman/listinfo/python-list
Hi Grant
can you help me with this?
I am working with the python code below in ArcGIS to zoom into a shapefile's
attribute table row features without selected until the end of table one by one.
I am trying to use this code but this one requires that a row is selected.
import arcpy
mxd = arcp
Hi,
I hope that this isn't a stupid question, asked already a
hundred times, but I haven't found anything definitive on
the problem I got bitten by. I have two Python files like
this:
S1.py --
import random
import S2
class R( object ) :
r = random.random( )
if __name__ == "_
On 2012-12-20 19:19, wxjmfa...@gmail.com wrote:
Fact.
In order to work comfortably and with efficiency with a "scheme for
the coding of the characters", can be unicode or any coding scheme,
one has to take into account two things: 1) work with a unique set
of characters and 2) work with a contigu
Le jeudi 20 décembre 2012 06:32:42 UTC+1, Terry Reedy a écrit :
> On 12/19/2012 10:12 PM, Westley Martínez wrote:
>
> > On Wed, Dec 19, 2012 at 09:54:20PM -0500, Terry Reedy wrote:
>
> >> On 12/19/2012 9:03 PM, Chris Angelico wrote:
>
> >>> On Thu, Dec 20, 2012 at 5:27 AM, Ian Kelly wrote:
>
>
Le mercredi 19 décembre 2012 22:23:15 UTC+1, Ian a écrit :
> On Wed, Dec 19, 2012 at 1:55 PM, wrote:
>
> > Yes, it is correct (or can be considered as correct).
>
> > I do not wish to discuss the typographical problematic
>
> > of "Das Grosse Eszett". The web is full of pages on the
>
> > sub
Le mercredi 19 décembre 2012 22:31:42 UTC+1, Ian a écrit :
> On Wed, Dec 19, 2012 at 2:18 PM, wrote:
>
> > latin-1 (iso-8859-1) ? are you sure ?
>
>
>
> Yes.
>
>
>
> sys.getsizeof('a')
>
> > 26
>
> sys.getsizeof('ab')
>
> > 27
>
> sys.getsizeof('aé')
>
> > 39
>
>
>
>
Fact.
In order to work comfortably and with efficiency with a "scheme for
the coding of the characters", can be unicode or any coding scheme,
one has to take into account two things: 1) work with a unique set
of characters and 2) work with a contiguous block of code points.
At this point, it shoul
On Thu, Dec 20, 2012 at 5:50 AM, wrote:
> Brought my laptop out of hibernation to do some work this morning. I
> attempted to run one of my ETLs and got the following error. I made no
> changes since it was running yesterday.
>
>
>
> [swright@localhost app]$ python etl_botnet_meta.py --mode dev
Maybe try posting them on your blog.
On Thu, Dec 20, 2012 at 12:08 PM, wrote:
> Thank you for your reply Grant,
>
> I am trying to attach mxd's but no chance. As you said that i dont have
> much experience in python. I used to work with VBA but its not an option
> anymore with new ArcGIS 10.
>
>
Thank you for your reply Grant,
I am trying to attach mxd's but no chance. As you said that i dont have much
experience in python. I used to work with VBA but its not an option anymore
with new ArcGIS 10.
How can I add mxd's here?
--
http://mail.python.org/mailman/listinfo/python-list
On Thursday, December 20, 2012 4:57:19 AM UTC-7, iMath wrote:
> how to detect the encoding used for a specific text data ?
The chardet package will probably do what you want:
http://pypi.python.org/pypi/chardet
--
http://mail.python.org/mailman/listinfo/python-list
If you set up 2 sample MDX files that are dead simple along with some
code to demonstrate what you are attempting, and some unit tests, then
you will be helping people to help you.
Most people probably do not have experience or familiarity with what
you are attemping.
On Thu, Dec 20, 2012 at 11:0
On Thursday, December 20, 2012 03:52:39 PM Johannes Bauer wrote:
> Hi group,
>
> I've run into a problem using Python3.2 and sqlite3 db access that I
> can't quite wrap my head around. I'm pretty sure there's a bug in my
> program, but I can't see where. Help is greatly appreciated. I've
> created
I need to come up with a Python code to automate a map creation process but I
am a little bit of lack of python knowledge. Any help would be much
appreciated.
My problem is that I have a 20 mxd file which need an update process in timely
manner(this is just one project) and pdf creation for ea
On 20/12/12 16:20:13, Johannes Bauer wrote:
> On 20.12.2012 16:05, Chris Angelico wrote:
>> On Fri, Dec 21, 2012 at 1:52 AM, Johannes Bauer wrote:
>>> def fetchmanychks(cursor):
>>> cursor.execute("SELECT id FROM foo;")
>>> while True:
>>> result = cursor.fetchmany(
On Fri, Dec 21, 2012 at 2:20 AM, Johannes Bauer wrote:
> Hmm, but this:
>
> result = cursor.fetchone()
> yield result
>
> Works nicely -- only the fetchmany() makes the example break.
Okay, now it's sounding specific to sqlite. I'll bow out. :)
>
>> Would
On 20.12.2012 16:05, Chris Angelico wrote:
> On Fri, Dec 21, 2012 at 1:52 AM, Johannes Bauer wrote:
>> def fetchmanychks(cursor):
>> cursor.execute("SELECT id FROM foo;")
>> while True:
>> result = cursor.fetchmany()
>> if len(result) == 0:
>>
On Fri, Dec 21, 2012 at 1:52 AM, Johannes Bauer wrote:
> def fetchmanychks(cursor):
> cursor.execute("SELECT id FROM foo;")
> while True:
> result = cursor.fetchmany()
> if len(result) == 0:
> break
> for x in
On 19.12.2012 16:40, Chris Angelico wrote:
> You may not be familiar with jmf. He's one of our resident trolls, and
> he has a bee in his bonnet about PEP 393 strings, on the basis that
> they take up more space in memory than a narrow build of Python 3.2
> would, for a string with lots of BMP cha
Hi group,
I've run into a problem using Python3.2 and sqlite3 db access that I
can't quite wrap my head around. I'm pretty sure there's a bug in my
program, but I can't see where. Help is greatly appreciated. I've
created a minimal example to demonstrate the phaenomenon (attached at
bottom).
Firs
Am 20.12.2012 12:57, schrieb iMath:
> how to detect the encoding used for a specific text data ?
You can't.
It's not possible unless the file format can specify the encoding
somehow, e.g. like XML's header .
Sometimes you can try and make an educated guess. But it's just a guess
and it may give
iMath writes:
> which package to use ?
Read the text in as a "bytes object" (bytes), then it has a .decode
method that you can experiment with. Strings (str) are Unicode and
have an .encode method. These methods allow you to specify a desired
encoding and and what to do when there are errors.
he
which package to use ?
--
http://mail.python.org/mailman/listinfo/python-list
On 20.12.2012, at 12:57, iMath wrote:
> how to detect the encoding used for a specific text data ?
http://pypi.python.org/pypi?%3Aaction=search&term=detect+encoding
--
Stefan H. Holek
ste...@epy.co.at
--
http://mail.python.org/mailman/listinfo/python-list
Brought my laptop out of hibernation to do some work this morning. I attempted
to run one of my ETLs and got the following error. I made no changes since it
was running yesterday.
[swright@localhost app]$ python etl_botnet_meta.py --mode dev -f
Traceback (most recent call last):
File "etl_bo
iMath writes:
> how to detect the encoding used for a specific text data ?
The practical thing to do is to try an encoding and see whether you
find the expected frequent letters of the relevant languages in the
decoded text, or the most frequent words. This is likely to help you
decide between s
how to detect the encoding used for a specific text data ?
--
http://mail.python.org/mailman/listinfo/python-list
* Ian Kelly [2012-12-19 17:54:44 -0700]:
> On Wed, Dec 19, 2012 at 5:07 PM, Terry Reedy wrote:
> > That says that my browser, Firefox 17, does not support HTML5. Golly gee. I
> > don't think any browser support5 all of that moving target, and Gecko
> > apparently supports about as large a subset
On Thu, Dec 20, 2012 at 8:37 PM, Pierre Quentel
wrote:
> I'm afraid I am going to disagree. The document is a tree structure, and
> today Python doesn't have a syntax for easily manipulating trees. To add a
> child to a node, using an operator instead of a function call saves a lot of
> typing
Le jeudi 20 décembre 2012 01:54:44 UTC+1, Ian a écrit :
> On Wed, Dec 19, 2012 at 5:07 PM, Terry Reedy wrote:
>
> > That says that my browser, Firefox 17, does not support HTML5. Golly gee. I
>
> > don't think any browser support5 all of that moving target, and Gecko
>
> > apparently supports a
Le jeudi 20 décembre 2012 01:07:15 UTC+1, Terry Reedy a écrit :
> On 12/19/2012 1:19 PM, Pierre Quentel wrote:
>
>
>
> > The objective of Brython is to replace Javascript by Python as the
>
> > scripting language for web browsers, making it usable on all
>
> > terminals including smartphones,
79 matches
Mail list logo