luca72 wrote:
> Hy the code is this:
>
> Pok\xe9mon
That's not what I meant, I meant a piece of Python source code. This piece
has to be large enough to demonstrate the problem but with everything else
removed. The point is that guessing what is wrong in your program is just
futile; In order to h
luca72 wrote:
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in
> position 8: ordinal not in range(128)
>
> I have solve in this way:
>
> file_ricerca = codecs.open('ri', 'wb', 'ISO-8859-15', 'repalce')
That should be 'replace' instead of 'repalce', I assume you just mistyped
Rafe wrote:
> I tried to post some follow-ups to some issues I posted in the hopes
> of helping others, but I only get "reply to author" and "forward", but
> no "reply" option (using GoogleGroups). Is there some kind of time
> limit to reply?
Two things:
1. Google Groups is by far not the best int
Rafe wrote:
> Can you recommend anything? I would like to avoid 1,000s of emails
> flooding my account though.
I like knode from KDE for browsing the Usenet. The Mozilla suite also
contains a newsreader. Other than that, use a webmail account and configure
a filter to file everything Pythonic into
Hi!
I have a socket from which I would like to parse some data, how would I do
that? Of course, I can manually read data from the socket until unpack()
stops complaining about a lack of data, but that sounds rather inelegant.
Any better suggestions?
Uli
--
Sator Laser GmbH
Geschäftsführer: Tho
Greg Miller wrote:
> I would like to know if there is a way of starting the GUI
> without the DOS window having to launch?
Use pythonw.exe instead of python.exe.
Uli
--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
--
http://mail.python.org/mailman/listinf
Raymond Hettinger wrote:
>> The idea is to make numbering formatting a little easier with
>> the new format() builtin:
>> http://docs.python.org/library/string.html#formatspec
[...]
> Scanning the web, I've found that thousands separators are
> usually one of COMMA, PERIOD, SPACE, or UNDERSCORE. T
mattia wrote:
> How can I convert the following string:
>
> 'AAR','ABZ','AGA','AHO','ALC','LEI','AOC',
> EGC','SXF','BZR','BIQ','BLL','BHX','BLQ'
>
> into this sequence:
>
> ['AAR','ABZ','AGA','AHO','ALC','LEI','AOC',
> EGC','SXF','BZR','BIQ','BLL','BHX','BLQ']
import string
string.split("a,b,c
Grant Edwards wrote:
> with open(filename,"rb") as f:
> while True:
> buf = f.read(1)
> if not buf: break
> # do something
The pattern
with foo() as bar:
# do something with bar
is equivalent to
bar = foo()
if bar:
# do something with bar
except
Doerte wrote:
> from pylab import *
> from numpy import *
> from scipy import *
> from math import *
Don't do this, read the style guide on writing Python code.
> res = integrate.quad(func=f, a=x0, b=x1)
[...]
> NameError: name 'integrate' is not defined
# try this instead
from scipy import inte
grbgooglefan wrote:
> How can I build a release and not the debug version of libpython.a?
> I have seen that there are assert, abort statements in lot many
> functions in Python code. I would like to avoid those when compiling
> the libpython.a library because when this libpython gets used for
> pr
Gilles Ganault wrote:
> test = "t...@gmail.com"
> isp = ["gmail.com", "yahoo.com"]
> for item in isp:
> if test.find(item):
> print item
> === output
> gmail.com
> yahoo.com
> ===
>
> Any idea why I'm also getting "yahoo.com"?
find() returns the index where it is found or -1 if it is not
Greetings!
I'm currently using Python to implement a set of tests for code that is
otherwise written in C. This code was wrapped using Boost.Python and is
then loaded into Python as module.
What I often have in C is this:
// bitfield (several flags combined)
#define STATUS_OVERTEMP 1u
#def
Ulrich Eckhardt wrote:
[how to handle bitfields and enumerations in Python]
Thanks to all that answered. The important lessons I learned:
* You can modify classes, other than in C++ where they are statically
defined. This allows e.g. adding constants.
* __repr__ should provide output suitable
Johannes Bauer wrote:
> What I'd like to add: I want the GUI users to supply plugin scripts,
> i.e. offer some kind of API. That is, I want the user to write short
> Python pieces which look something like
>
> import guiapp
>
> class myplugin():
> def __init__(self):
> guiapp.add_menu("foobar")
>
Carbon Man wrote:
> self.dataUpdate.write(u"\nentry."+node.tagName+ u" = " + cValue)
> cValue contains a unicode character. node.tagName is also a unicode string
> though it has no special characters in it.
> Getting the error:
> UnicodeEncodeError: 'ascii' codec can't encode character u'\x93' in
>
Steven D'Aprano wrote:
> On Fri, 24 Apr 2009 03:00:26 -0700, GC-Martijn wrote:
>> t = Test()
>> if (t == 'Vla':
>> print t # must contain Vla
>
>
> What's wrong with that?
It unnecessarily injects the name 't' into the scope.
Uli
--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amts
Justin Rajewski wrote:
> I need to print variables out over serial, however I need them to not be
> in ASCII, ie if the variable is 5 then print 5 not "5".
>
> The function that writes to the serial port requires a string and I can
> send non-variables out with the string "/x05" for 5.
Take a loo
Hi!
We have a few tests for some module here. These tests are under development
and applied to older versions (with less features) of the module, too. That
means that if I have module version 42, tests A and B can not possibly
work. I don't want to have test failures but I also don't want to fork
Adam Gaskins wrote:
> Long story short, I'm tired of doing things in such a hackish manner
> and want to write applications that are cross platform (I'd like to
> get our production dept on linux eventually) and truely object
> oriented.
Adam, there is one notion here that I seriously dislike: yo
Steve Ferg wrote:
> On the one hand, there are developers who love big IDEs with lots of
> features (code generation, error checking, etc.), and rely on them to
> provide the high level of support needed to be reasonably productive
> in heavy-weight languages (e.g. Java).
>
> On the other hand the
boblat...@googlemail.com wrote:
> this is the conversion I'm looking for:
>
> ['1.1', '2.2', '3.3'] -> (1.1, 2.2, 3.3)
>
> Currently I'm "disassembling" the list by hand, like this:
>
> fields = line.split('; ')
> for x in range(len(fields)):
> fields[x] = float(fields[x])
>
Stef Mientki wrote:
> I've to distribute both python files and data files.
> Everything is developed under windows and now the datafiles contains
> paths with mixed \\ and /.
For your info: Some (!!!) parts of MS Windows understand forward slashes as
path separators and disallows them in file name
Asun Friere wrote:
> Well you have to be careful in case some smartarse comes back with a
> class with something like this in it:
>
> def __eq__ (self, other) :
> if self is other : return False
That's pretty paranoid. :)
Who said that? (:
Uli
--
Sator Laser GmbH
Geschäftsführer: Thorsten
[EMAIL PROTECTED] wrote:
> I have an if-elif chain in which I'd like to match a string against
> several regular expressions. Also I'd like to use the match groups
> within the respective elif... block. The C-like idiom that I would
> like to use is this:
>
> if (match = my_re1.match(line):
> #
lue? (a clue what I try to say and how to help?!)
Thanks a lot in advance!!
Ulrich
--
http://mail.python.org/mailman/listinfo/python-list
Chris wrote:
> On May 28, 11:08 am, [EMAIL PROTECTED] wrote:
>> Say I have a file, utf8_input, that contains a single character, é,
>> coded as UTF-8:
>>
>> $ hexdump -C utf8_input
>> c3 a9
>> 0002
[...]
> weird thing is 'c3 a9' is é on my side... and copy/pasting the é
> gives me 'e
deepest1 wrote:
> bjam --build-dir="D:\Program Files\boost_1_35_0" --toolset=gcc stage
>
> I got 12 failures and 8 warnings from this (other few hundrds were ok)
Hmm, I remember trying to use Boost 1.35 with Python 2.5 on my Debian system
and also having problems, are you sure that at least the P
Thomas Guettler wrote:
> I tried PIL for image batch processing. But somehow I don't like it
> - Font-Selection: You need to give the name of the font file.
> - Drawing on an image needs a different object that pasting and saving.
> - The handbook is from Dec. 2006.
>
> What image libraries
Jesse Aldridge wrote:
> I've got a module that I use regularly. I want to make some extensive
> changes to this module but I want all of the programs that depend on
> the module to keep working while I'm making my changes. What's the
> best way to accomplish this?
You simply run the module's uni
André Malo wrote:
> As mentioned in another posting revision control is a good thing as well.
> Not just for that task.
From my point of view revision control is not a question but a fact.
Seriously, if you are not using any RCS already, it is about time you start
doing so. I even use it for my pr
Tim Roberts wrote:
> Thomas Guettler <[EMAIL PROTECTED]> wrote:
>>
>>I tried PIL for image batch processing. But somehow I don't like it
>> - Font-Selection: You need to give the name of the font file.
>> - Drawing on an image needs a different object that pasting and saving.
>> - The handbook i
John Dann wrote:
> Let's say I define the class in a module called comms.py. The class
> isn't really going to inherit from any other class (except presumably
> in the most primitive base-class sense, which is presumably automatic
> and implicit in using the class keyword). Let's call the class
> s
Lie wrote:
> I think it's not that hard to see that it's just a pseudo code
"...in comms.py I have: ..." actually explicitly says that it is actual code
from a file.
*shrug*
Uli
--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
--
http://mail.python.org/ma
Hi!
I'm still mostly learning Python and there is one thing that puzzles me
about string formatting. Typical string formatting has these syntaxes:
"%s is %s" % ("GNU", "not Unix")
"%(1)s %(2)s" % ("1":"one", "2":"two")
What I'm surprised is that this isn't supported:
"%(1)s %(2)s" % ("zer
Ulrich Eckhardt wrote:
> What I'm surprised is that this isn't supported:
>
> "%(1)s %(2)s" % ("zero", "one", "two")
Thanks Terry and Matimus, actually I'm using 2.4 and considering upgrading
now. ;)
Uli
--
Sator Laser GmbH
G
norseman wrote:
> In this case it's [MS Windows] (still) 'cooking' the writes even
> with 'rwb' and O_RDWR|O_BINARY in (proper respective) use.
>
> Specific: python created and inspected binary file ends:
> 00460: 0D 1A(this is correct)
I'm not actually sure what the 0x1a is supposed to
甜瓜 wrote:
> Another question is about the future of C++. I am a C++ programmer.
> Since I studied python, most of my projects becomes written in python
> because of the better and simpler OOP representation. As a supplement,
> I use python C extension for computational extensive jobs. Therefore,
>
karthikbalaguru wrote:
> [EMAIL PROTECTED] hello]# Analyzer hello_input
^^
This is often a bad idea. Anyhow, that has nothing to do with Python.
> Loading debug info: hello_input
> Traceback (most recent call last):
> File "/usr/local/SDK/host/bin/Analyzer", line 694, in ?
> app.d
ssecorp wrote:
> def str_sort(string):
> s = ""
> for a in sorted(string):
> s+=a
> return s
>
>
> if i instead do:
>
> def str_sort(string):
> s = ""
> so = sorted(string)
> for a in so:
> s+=a
> return s
>
> will that be faster or the interpreter can figure out that it o
Anish Chapagain wrote:
> I'm new to python and have a task for Wrapping up an old program
> written in C(20.c files), to provide GUI and chart,graph feature in
> Python. I've tried using SWIG but am not getting well in windows
> system, wish to receive guidelines for initiating the task...
Two way
Nikolaus Rath wrote:
> I need to synchronize the access to a couple of hundred-thousand
> files[1]. It seems to me that creating one lock object for each of the
> files is a waste of resources, but I cannot use a global lock for all
> of them either (since the locked operations go over the network,
[EMAIL PROTECTED] wrote:
> hellomodule.cpp(9) : fatal error C1083: Cannot open include file:
> 'boost/python/module.hpp': No such file or directory
You need to tell it where to find the Boost includes. I suggest you first
try to get some header-only Boost library going as example, if you have
that
[EMAIL PROTECTED] wrote:
> The "test.py" is working in every machine that I use except in my home
> machine.
[...]
> c:\>test.py
> A rendszer nem tudja végrehajtani a megadott programot.
>
> c:\>
>
>
> Sorry for non english, I try to translate it:
> "The system cannot execute the pro
一首诗 wrote:
> I read this interesting post comparing Boost.Python with Pyd:
>
> http://pyd.dsource.org/vsboost.html
>
> What's your opinion about it?
>
> What's your first choice when you have write a C/C++ module for Python?
There is no such thing as a C/C++ language. Seriously, both are really
icarus top-posted:
> one more question...
...deserves a separate thread.
> how do I create a pythonw standalone executable that works on w32,
> linux, mac, etc..?
Either it is Python, then it is portable but no executable, or it is an
executable, then it is standalone but not portable. I'm afrai
sa6113 wrote:
> I want to connect form a windows machine to a Linux one using SSH (I use
> Paramiko) and simply copy a file to Linux machine.
> Would you please help me how should I start?
For starters, I'd take a look at 'scp'. Other than that, what does the
question you asked have to do with Pyt
eric.frederich wrote:
> Is there a way to set up environment variables in python itself
> without having a wrapper script.
Yes, sure, you can set environment variables...
> The wrapper script is now something like
>
> #!/bin/bash
>
> export LD_LIBRARY_PATH="/some/thing/lib:$LD_LIBRARY_PATH"
Hi!
I'm trying to write some code to diff two fonts. What I have is every
character (glyph) of the two fonts in a list. I know that the list is sorted
by the codepoints of the characters. What I'd like to ask is whether there
is a more elegant solution to the loop below or whether there are any
Lie Ryan wrote:
> On 12/4/2009 8:28 AM, Ulrich Eckhardt wrote:
>> I'm trying to write some code to diff two fonts. What I have is every
>> character (glyph) of the two fonts in a list. I know that the list is
>> sorted by the codepoints of the characters. What I'd
dpapathanasiou wrote:
> I have two methods for writing binaries files: the first works with
> data received by a server corresponding to a file upload, and the
> second works with data sent as email attachments.
Hmmm, no. Looking at your code, the first of your functions actually treats
its argume
Peng Yu wrote:
> Could somebody let me know how the python calls and exceptions are
> dispatched? Is there a reference for it?
I'm not a Python expert, but I have read some parts of the implementation.
Hopefully someone steps up if I misrepresent things here...
In order to understand Python exce
vsoler wrote:
> class stepper:
> def __getitem__(self, i):
> return self.data[i]
>
> X=stepper()
> X.data="Spam"
> for item in X:
> print item,
>
> ... what I get is S p a m which seems logical to me since the
> loop stops after the 4th character.
I think you're mistaking
Jens Müller wrote:
> I try to decode a string,e.g.
> u'M\xfcnchen, pronounced [\u02c8m\u028fn\xe7\u0259n]'.decode('cp1252',
> 'ignore')
> but even thoug I use errors='ignore'
> I get UnicodeEncodeError: 'charmap' codec can't encode character u'\u02c8'
> in position 21: character maps to
>
> How c
Dan Stromberg wrote:
> My new version formats an SD card and preallocates some file space in
> about 3 minutes with "Optimize Performance" selected, and in about 30
> minutes with "Optimize for Quick Removal" selected. Needless to say, I
> don't like the 27 minute penalty much.
For performance, t
Hi!
I'm looking at the 'threading' module and see that other than the 'thread'
module it doesn't have a simple function to start a new thread. Instead,
you first have to instantiate a threading object and then start the new
thread on it:
t = threading.Thread(target=my_function)
t.start()
Wha
sturlamolden wrote:
> On 8 Okt, 09:17, Ulrich Eckhardt wrote:
>
>> I'm looking at the 'threading' module and see that other than the
>> 'thread' module it doesn't have a simple function to start a new thread.
>> Instead, you first have to in
Laszlo Nagy wrote:
> Ulrich Eckhardt írta:
>> Hi!
>>
>> I'm looking at the 'threading' module and see that other than the
>> 'thread' module it doesn't have a simple function to start a new thread.
>> Instead, you first have to instan
Irmen de Jong wrote:
> [...] is there any reason why you would go the route of embedding python
> in C++ ? Why not just stick to (pure) Python? Embedding C or C++ stuff
> as extension modules in Python (if you really need to do this) is easier
> than the other way around, in my experience.
If you
Christopher Lloyd wrote:
> I'm a relatively inexperienced programmer, and have been learning some
> basic C++ and working through the demos in Ron Penton's "MUD Game
> Programming" book. In it, Python modules are run from inside a C++
> program.
[...]
> If I try to compile this in MS Visual C++ 200
Gabriel Genellina wrote:
>> #ifdef _DEBUG
>> #undef _DEBUG
>> #include
>> #define _DEBUG
>> #else
>> #include
>> #endif
[...to keep Python from linking against non-existant debug libraries.]
>
> No, don't do that. Just compile your application in release mode.
Why not, does it break anything?
Ole Streicher wrote:
> I am curious when one should implement a "__call__()" and when a
> "__getitem__()" method.
>
> For example, I want to display functions and data in the same plot.
Wait: The term 'function' is overloaded. In Python and programming in
general, a function is a piece of code wi
arve.knud...@gmail.com wrote:
> On Oct 19, 3:48 pm, Ethan Furman wrote:
>> arve.knud...@gmail.com wrote:
[...]
>>> def create():
>>> f = file("tmp", "w")
>>> raise Exception
>>>
>>> try:
>>> create()
>>> finally:
>>> os.remove("tmp")
>>>
[...]
>> When an exception is raised, the e
Tommy Grav wrote:
> I have created a binary file that saves this struct from some C code:
>
>struct recOneData {
> char label[3][84];
> char constName[400][6];
> double timeData[3];
> long int numConst;
> double AU;
> double EMRAT;
> long
Aaron Watters wrote:
> In the last couple months on a few occasions
> I've tried various Python libraries (and I'm not going to
> name names) and run into some problem.
>
> Following the documented procedure [...]
Documented where?
> [...] I eventually post the problem to the "support" list
Whi
Santiago Romero wrote:
> Well, In the above concrete example, that would work, but I was
> talking for multiple code lines, like:
>
>
> #define LD_r_n(reg) (reg) = Z80ReadMem(r_PC++)
>
> #define LD_rr_nn(reg) r_opl = Z80ReadMem(r_PC); r_PC++; \
> r_oph = Z80ReadMem(r_PC
Ethan Furman wrote:
> Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> print u'\xed'
> í
> >>> print u'\xed'.encode('cp437')
> í
> >>> print u'\xed'.encode('cp850')
> í
> >>> pr
Diez B. Roggisch wrote:
> kj schrieb:
>> lol = [[] for _ in xrange(500)]
>
> If you call that hideous, I suggest you perform the same exercise in
> Java or C++ - and then come back to python and relax
I might be missing something that's not explicitly mentioned here, but I'd
say that all n
Hia!
I need to read a file containing packed "binary" data. For that, I find the
struct module pretty convenient. What I always need to do is reading a chunk
of data from the file (either using calcsize() or a struct.Struct instance)
and then parsing it with unpack(). For that, I repeatedly wri
Just for the record: Neither of the below methods actually produce a
multiline string. They only spread a string containing one line over
multiple lines of source code.
lallous wrote:
> Maybe that's already documented, but it seems the parser accepts to
> build a long string w/o really using the f
Hi!
I'm looking for a way to write code similar to this C code:
while(rq = get_request(..)) {
handle_request(rq);
}
Currently I'm doing
while True:
rq = get_request(...)
if not rq:
break
handle_request(rq)
in Python 2.6. Any suggestions how to rewrite tha
Peter Otten wrote:
> Duncan Booth wrote:
>> for rq in incoming_requests(...):
>>handle_request(rq)
>
> ...and a likely implementation would be
>
> def incoming_requests(...):
> while True:
> rq = ... # inlined version of get_request()
> if not rq:
> break
>
asit wrote:
> pattern = raw_input("Enter the file pattern to search for :\n")
> commandString = "find " + pattern
> commandOutput = commands.getoutput(commandString)
> findResults = string.split(commandOutput, "\n")
> print "Files : "
> print commandOutput
> print "=
Alex Hall wrote:
> Now, though, when I press ctrl-shift-c (keystroke 11), nothing
> happens.
Control-C sends a special signal to the console, like Control-Break.
> Pressing any other keystroke after that will crash the program
> with some sort of Python internal com server exception that I
> have
Alex Hall wrote:
> I have a dll I am trying to use, but I get a Windows error 126, "the
> specified module could not be found". Here is the code segment:
> nvdaController=ctypes.windll.LoadLibrary("nvdaControllerClient32.dll")
In addition to Alf's answer, this can also happen when the OS can't fin
Alex Hall wrote:
> On 3/15/10, Ulrich Eckhardt wrote:
>> Alex Hall wrote:
>>> I have a dll I am trying to use, but I get a Windows error 126, "the
>>> specified module could not be found". Here is the code segment:
>>> nvdaController=ctypes.
Chris Rebert wrote:
> You're a bit behind the times.
> If my calculations are right, that comic is over 2 years old.
import timetravel
Uli
--
http://mail.python.org/mailman/listinfo/python-list
Jimbo wrote:
> Can you help me figure out why I am getting this compile error with my
> program. The error occurs right at the bottom of my code & I have
> commented where it occurs.
[...]
> def main():
> programEnd = False;
>
> while (programEnd == False):
> #ERROR HERE?? - Error=
Eric Frederich wrote:
> I am trying to create an extension on Windows and I may be over my
> head but I have made it pretty far.
>
> I am trying to create bindings for some libraries which require me to
> use Visual Studio 2005.
>
> I set up the spammodule example and in VS set the output file to
Eric Frederich wrote:
> Do I put them [DLL dependencies] in some environment variable?
> Do I put them in site-packages along with the .pyd file, or in some
> other directory?
Take a look at the LoadLibrary() docs:
http://msdn.microsoft.com/en-us/library/ms684175(VS.85).aspx
These further lead
Hi!
I'm writing tests and I'm wondering how to achieve a few things most
elegantly with Python's unittest module.
Let's say I have two flags invert X and invert Y. Now, for testing these, I
would write one test for each combination. What I have in the test case is
something like this:
def test
Roy Smith wrote:
> Writing one test method per parameter combination, as you suggested, is
> a reasonable approach, especially if the number of combinations is
> reasonably small.
The number of parameters and thus combinations are unfortunately rather
large. Also, sometimes that data is not static
Richard Thomas wrote:
[batch-programming different unit tests]
> You could have a parameter to the test method and some custom
> TestLoader that knows what to do with it.
Interesting, thanks for this suggestion, I'll look into it!
Uli
--
Domino Laser GmbH
Geschäftsführer: Thorsten Föcking, Amt
Ian Kelly wrote:
> On 11/22/2010 4:38 AM, Ulrich Eckhardt wrote:
>> Also, I'd rather construct the error message from the data
>> instead of maintaining it in different places, because
>> manually keeping those in sync is another, errorprone burden.
>
> I'm
Hi!
Note up front: I'm using Python2.6 still, I guess with 2.7 test discovery, I
could get better results easier, right?
Now, my problem is I have a directory containing test scripts which I all
want to run. I used to run them individually and manually, but want to
avoid this overhead in the futu
Steven D'Aprano wrote:
> On Tue, 23 Nov 2010 11:36:05 +0100, Ulrich Eckhardt wrote:
>> PS: I've been trying a few things here, and stumbled across another
>> thing that could provide a solution. I can "from tests import *", but
>> then all these modules
Short update on what I've settled for generating test functions for various
input data:
# test case with common test function
class MyTest(unittest.TestCase):
def _test_invert_flags(self, input, flags, expected):
res = do_invert(input, flags)
self.assertEqual(res, expected)
#
Leo Jay wrote:
> I'd like to know how do you guys find out what's happening in your
> code if the process seems not work.
> In java, I will use jstack to check stacks of threads and lock
> status. But I don't know how to do it in python.
import pdb
pdb.set_trace()
Generally, searching "python de
OW Ghim Siong wrote:
> I have a big file 1.5GB in size, with about 6 million lines of
> tab-delimited data.
How many fields are there an each line?
> I have to perform some filtration on the data and
> keep the good data. After filtration, I have about 5.5 million data left
> remaining. As you m
goldtech wrote:
> I tried this but nothing changed, I thought this might convert it and
> then I'd paerse the new file - didn't work:
>
> uc = open(r'E:\sc\ppb4.xml').read().decode('utf8')
> ascii = uc.decode('ascii')
> mex9 = open( r'E:\scrapes\ppb5.xml', 'w' )
> mex9.write(ascii)
This doesn't m
gry wrote:
> I have a little data generator that I'd like to go faster... any
> suggestions?
> maxint is usually 9223372036854775808(max 64bit int), but could
> occasionally be 99.
> width is usually 500 or 1600, rows ~ 5000.
>
> from random import randint
>
> def row(i, wd, mx):
> first = ['
Steven D'Aprano wrote:
> Replacing "while True" with "while 1" may save a tiny bit of overhead.
> Whether it is significant or not is another thing.
Is this the price for an intentional complexity or just a well-known
optimizer deficiency?
Just curious...
Uli
--
Domino Laser GmbH
Geschäftsführ
Thank you for the explanation, Ryan!
Uli
--
Domino Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
--
http://mail.python.org/mailman/listinfo/python-list
Dmitry Groshev wrote:
> Is there any way to use a true lists (with O(c) insertion/deletion
> and O(n) search) in python?
Inserting/deleting in the middle requires shuffling elements around, since
Python's list is an array/vector. If you don't rely on the ordering, insert
or delete at the end ins
Yan Cheng CHEOK wrote:
> Currently, I have the following text file
>
(https://sites.google.com/site/yanchengcheok/Home/TEST.TXT?attredirects=0&d=1)
> written by C++ wostringstream.
Stringstream? I guess you meant wofstream, or? Anyway, the output encoding
of C++ iostreams is implementation-defined
Hi!
I'm trying to solve a computational problem and of course speed and size is
important there. Apart from picking the right algorithm, I came across an
idea that could help speed up things and keep memory requirements down. What
I have is regions described by min and max coordinates. At first
Daniel Fetchinson wrote:
> I believe what you are looking for is (some variant of) the singleton
> pattern:
>
> http://en.wikipedia.org/wiki/Singleton_pattern
Actually, no. What I want is the flyweight pattern instead:
http://en.wikipedia.org/wiki/Flyweight_pattern
...but thank you for the appr
Terry Reedy wrote:
> What sort of numbers are the coordinates? If integers in a finite range,
> your problem is a lot simpler than if float of indefinite precision.
Yes, indeed, I could optimize the amount of data required to store the data
itself, but that would require application-specific hand
Steven D'Aprano wrote:
class InternedTuple(tuple):
> ... _cache = {}
> ... def __new__(cls, *args):
> ... t = super().__new__(cls, *args)
> ... return cls._cache.setdefault(t, t)
That looks good. The only thing that first bothered me is that it creates an
obje
Zdenko wrote:
> Please, can anybody write me a simple recursive matrix multiplication
> using multiple threads in Python, or at least show me some guidelines
> how to write it myself
No problem, I just need your bank account data to withdraw the payment and
the address of your teacher whom to send
301 - 400 of 489 matches
Mail list logo