Le Wed, 06 Jan 2010 12:03:36 +0100, wiso a écrit :
> from time import time
> t = time(); xxx=map(to_dict,l); print time() - t # 0.5 t = time();
> xxx=map(to_if,l); print time() - t # 1.0
Don't define your own function just for attribute access. Instead just
write:
xxx = map(month_dict.__geti
Le Wed, 06 Jan 2010 12:12:08 -0800, Phlip a écrit :
>
> And I, not my language, should pick and chose how to be rigorous. The
> language should not make the decision for me.
And that's why there is the "try: ... except: ..." construct.
Your rant is getting tiring.
--
http://mail.python.org/mai
> that point, its reference count is 0.
tuple objects and others already have such a caching scheme, so you could
download the Python source and look at e.g. Objects/tupleobject.c to see
how it's done.
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
Le Mon, 18 Jan 2010 11:30:16 +0100, Stefan Behnel a écrit :
> Anand Vaidya, 18.01.2010 10:58:
>> Is there a generic python benchmark suite in active development? [...]
>> PS: I think a benchmark should cover file / network, database I/O,
>> data structures (dict, list etc), object creation/manipul
ccbench, trying to measure interpreter efficiency in the face of multi-
threaded workloads
(*) http://svn.python.org/view/sandbox/trunk/
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
Le Mon, 18 Jan 2010 15:32:36 +0100, ted a écrit :
>
> And, a good library for access to database (mysql, sql server, oracle) ?
If you want something high-level: http://www.sqlalchemy.org/
You won't regret it :)
--
http://mail.python.org/mailman/listinfo/python-list
Le Mon, 18 Jan 2010 21:05:26 -0800, Anand Vaidya a écrit :
> @Antoine, Terry,
>
> Thanks for the suggestions.
>
> I will investigate those. I just ran the pybench, doesn't run on 3.x,
> 2to3 fails.
You just have to use the pybench version that is bundled with 3.x (
Le Sun, 24 Jan 2010 11:28:53 -0800, Aahz a écrit :
>
> Again, your responsibility is to provide a patch and a spectrum of
> benchmarking tests to prove it. Then you would still have to deal with
> the objection that extensions use the list internals -- that might be an
> okay sell given the effor
bugs.python.org
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
Le Wed, 27 Jan 2010 02:20:53 -0800, Floris Bruynooghe a écrit :
>
> Is a list or tuple better or more efficient in these situations?
Tuples are faster to allocate (they are allocated in one single step) and
quite a bit smaller too.
In some situations, in Python 2.7 and 3.1, they can also be igno
Le Thu, 28 Jan 2010 00:19:24 +, Steven D'Aprano a écrit :
> 4. Python 3 will make you irresistible to women.
>
> FALSE - Python 3 coders are no more likely to get a date than any
> other programmer.
They spend less time coding, so they /can/ get more "dates" (what a
strange English w
le-time (and also at
runtime), I don't think there's much of a contention actually.
The other changes probably aren't controversial, although I haven't
looked at them.
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
e be a big win if the occurrence is
near the start of the string and the string is very long
So, to sum it up:
* "in" is faster by a small fixed cost advantage
* "find" and "index" are almost exactly equivalent
* "count" will often be slower because it can't early exit
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
Le Fri, 29 Jan 2010 13:16:11 +1100, Ben Finney a écrit :
>
> I think the reason “date” was initially used is because dates are most
> familiar to us as fleshy, dark brown, wrinkled, compressed points.
>
> My interests in etymology and scatology unite here.
Ah, I suppose it explains the strange A
> when it succeeds, clears the exception indicators.
If you know an error occurred and need to retain it somewhere, just use
PyErr_Fetch() and PyErr_Restore().
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
Solaris vs.
Linux but rather CPU power. You should try to run a generic (non-Python) CPU
benchmark (*) on both systems, perhaps this 6-8 factor is expected. If only
Python shows such a performance difference, on the other hand, perhaps you can
give us more precisions on those systems.
Regards
tel or AMD CPU
is totally expected.
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
Le Wed, 14 Oct 2009 22:39:14 -0700, John Nagle a écrit :
>
> Note that multithreaded compute-bound Python programs really suck
> on multiprocessors. Adding a second CPU makes the program go slower,
> due to a lame mechanism for resolving conflicts over the global
> interpreter lock.
I'm not
itching between CPUs) may reduce overall performance. I agree with
> you that it is difficult to understand when this overhead were really
> significant.
For what it's worth, I just wrote a little benchmark script to measure
this kind of things:
http://svn.python.org/view/sandbox/trunk/
Hello,
> Anyone have python 3.1.1 installed on Solaris 10 ? (sparc or x86)
>
> I've tried several times on sparc, I keep getting:
[snip]
If you don't get an answer on this list, I encourage you to file an issue on
http://bugs.python.org
Thank you
Antoine.
--
htt
Le Fri, 23 Oct 2009 09:45:06 +0200, Olof Bjarnason a écrit :
>
> So I think my first question is still interesting: What is the point of
> multiple cores, if memory is the bottleneck?
Why do you think it is, actually? Some workloads are CPU-bound, some
others are memory- or I/O-bound.
You will
by "enthusiast" websites, it shows exactly that)
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
n()
will do the same thing, but faster.
So just write:
f = open(EXCLUDED_KEYWORDS_FILE, 'r', encoding='utf-8')
and you'll get a fast file object giving you str (unicode) objects after
an implicit utf-8 decoding of file data.
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
Le Sun, 08 Nov 2009 04:40:26 -0800, sven a écrit :
>
> I really don't get that. If the reason would be that it is too much
> work to
> implement, then I could accept it.
It would probably be a lot of work and even then it would still be unsafe.
Read for example:
http://msdn.microsoft.com/en-us/
which is effectively thread cancellation.
Can you give an example of such "cancellation"?
In any case, this would be a side-effect of the current implementation, not
officially supported behaviour.
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
Le Sun, 08 Nov 2009 21:04:06 -0800, John Nagle a écrit :
> Antoine Pitrou wrote:
>> John Nagle animats.com> writes:
>>> I'd argue against general thread cancellation. Inter-thread
>>> signals, though, have safety problems no worse than the first-thread
&g
et of code which reproduces
the problem reliably.
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
Le Mon, 23 Nov 2009 02:36:33 -0600, Robert Kern a écrit :
>
> I think there is an overall design sensibility, it's just not a
> human-facing one. They claim that they designed the syntax to be very
> easily parsed by very simple tools in order to make things like syntax
> highlighters very easy an
Le Mon, 23 Nov 2009 11:54:19 -0600, Robert Kern a écrit :
>
> Not really. The idea was to make the language easily parsed and lexed
> and analyzed by *other* tools, not written in Go, that may have limited
> capabilities.
Well, if Go doesn't allow you to write libraries usable from other low-
lev
Le Mon, 23 Nov 2009 15:30:16 -0600, Robert Kern a écrit :
> particularly constrained environments like editors that may not be
> extensible at all.
I'm not really an expert on this, but I think most good editors /are/
extensible (through plugins, scripts or other things).
> You can get away wit
nterpreter could grow CISC-like
opcodes so as to collapse "is not None" (or generically "is not
") into a single JUMP_IF_IS_NOT_CONST opcode. Actually, it is
the kind of optimizations wpython does (http://code.google.com/p/
wpython/).
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
how the multiprocessing module works.
>
> It does not.
Actually, it is how multiprocessing works under Windows (for lack of the
fork() function), except that it uses pickle by default (but it does have
xmlrpc support).
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
Le Tue, 24 Nov 2009 15:11:29 +, Antoine Pitrou a écrit :
> Hello,
>
> Le Tue, 24 Nov 2009 14:41:19 +0100, mk a écrit :
>>
>> As Rob pointed out (thanks):
>>
>> 11 31 LOAD_FAST0 (nonevar)
>> 34 JUMP_IF_FALSE
Le Tue, 24 Nov 2009 09:27:24 -0800, sturlamolden a écrit :
>
> Windows does not have daemons, so this is obviously incorrect. (There
> are something called Windows Services, but multiprocessing does not use
> them.)
This is nitpicking. Technically it might not be a daemon but it's used as
such.
Le Tue, 24 Nov 2009 08:58:40 -0800, Paul Boddie a écrit :
> As you
> point out, a lot of this RISC vs. CISC analysis (and inferences drawn
> from Python bytecode analysis) is somewhat academic: the cost of the
> JUMP_IF_FALSE instruction is likely to be minimal in the context of all
> the activity
Le Tue, 24 Nov 2009 22:08:19 +, Benjamin Peterson a écrit :
>
>> Would it be worth in-lining the remaining part of PyObject_IsTrue in
>> ceval?
>
> Inlining by hand is prone to error and maintainability problems.
Which is why we like to do it :-))
--
http://mail.python.org/mailman/listinf
useful work?
Regardless, it probably isn't easy to do such measurements. I once tried
using AMD's CodeAnalyst (I have an AMD CPU) but I didn't manage to get
any useful data out of it; the software felt very clumsy and it wasn't
obvious how to make it take into ac
27;t recognize the new
buffer API which is needed to accept bytearray objects.
(it does in 3.1, because the old buffer API doesn't exist anymore there)
You could open an issue on the bug tracker for this.
Thank you
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
Le Mon, 01 Feb 2010 03:30:56 +0100, Martin v. Loewis a écrit :
>
>> Is this a bug in Python 2.6 or a deliberate choice regarding
>> implementation concerns I don't know about?
>
> It's actually a bug also that you pass an array; doing so *should* give
> the very same error.
Well, if you can give
Le Mon, 01 Feb 2010 01:33:09 -0800, Stephen.Wu a écrit :
>
> actually, I just use file.read(length) way, i just want to know what
> exactly para of length I should set, I'm afraid length doesn't equal to
> the amount of physical memory after trials...
There's no exact length you "should" set, jus
Le Tue, 02 Feb 2010 00:12:34 +0100, Martin v. Loewis a écrit :
>> recv_into() should simply be fixed to use the new buffer API, as it
>> does in 3.x.
>
> I don't think that's the full solution. The array module should also
> implement the new buffer API, so that it would also fail with the old
> r
Le Sat, 06 Feb 2010 22:26:55 +, Benjamin Peterson a écrit :
> Neil Hodgson gmail.com> writes:
>>This would damage the usefulness of source control histories (svn
>> annotate) as all of the converted lines would show this recent cosmetic
>> change rather than the previous change which is li
event loop mechanism in order to process pages serially, in the
order of arrival
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
Le Fri, 12 Feb 2010 17:14:57 +, Steven D'Aprano a écrit :
>
> What Python does is called "pass by sharing", or sometimes "pass by
> object reference". It is exactly the same as what (e.g.) Ruby and Java
> do, except that confusingly the Ruby people call it "pass by reference"
> and the Java pe
b[:] = t
...
>>> x, y = [1], [2]
>>> exchange(x, y)
>>> x, y
([2], [1])
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
the same semantics as in more archaic
languages. This is no reason, IMO, to refuse using the term "pass by
reference". The state of art in computing languages evolves, and it
wouldn't be constructive to remain stuck with definitions from the 1960s.
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
as a one-line statement that it's foolish
to want to make a Python function for it...
cheers
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
Le Sun, 07 Mar 2010 22:40:36 +0800, pingooo a écrit :
> I'm writing an open source python client for a web service. The client
> may be used in all kinds of environments - Linux, Mac OS X, Windows, web
> hosting, etc by others. It is not impossible to have twisted as a
> dependency, but that makes
ect has its own bookkeeping which adds a bit
of execution time.
But I would suggest measuring the performance of *actual* seeks to
different file offsets, before handwaving about the supposed "slowness"
of file seeks in Python.
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
ding and writing of unicode files is available in Python
2.7 and 3.1, using the new `io` module.
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
Le Mon, 22 Mar 2010 23:40:16 +, tan a écrit :
>
>>Remember that the original use case was to load a dictionary from a text
>>file. For this use case, a trie can be very wasteful in terms of memory
>>and rather CPU cache unfriendly on traversal, whereas hash values are a)
>>rather fast to calcu
Le Tue, 23 Mar 2010 02:57:56 -0700, Paul Rubin a écrit :
>
> It is unlikely to happen by accident. You might care that it can happen
> on purpose. See: http://www.cs.rice.edu/~scrosby/hash/ that I cited in
> another post. The article shows some sample attacks on Python cgi's.
Certainly interes
Le Tue, 23 Mar 2010 10:33:33 -0700, nn a écrit :
> I know that unicode is the way to go in Python 3.1, but it is getting in
> my way right now in my Unix scripts. How do I write a chr(253) to a
> file?
>
> #nntst2.py
> import sys,codecs
> mychar=chr(253)
> print(sys.stdout.encoding)
> print(mycha
; something, and wondering what may that be.
It's possibly one of those things that haven't been implemented simply
because no one thought about it yet, or bothered enough to do it.
In other words, you can open a feature request at
http://bugs.python.org, and even provide a patch.
R
ve never seen a good use of cooperative multiple inheritance in
Python. My own experience trying to use it suggests me that I would
have been better with independent "handler" classes (urllib2-style).
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
nged. The `io`
module is available in 2.6/2.7 so that you can experiment with some 3.x
features without switching, and in this case it's much faster than 2.6.
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
he latest 3.2alpha4 (*) and check if this is fixed?
If not, then could you please open a bug on http://bugs.python.org ?
(*) http://python.org/download/releases/3.2/
Thank you
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
of the contained values (which is where the
difference is here).
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
.stdin.buffer (which is the binary non-unicode counterpart of
sys.stdin).
If they are the same, then I guess you can open an issue, provided you
give enough indications for people to reproduce :)
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
orld does not revolve around Python. Unix filenames have been
> encoding-agnostic long before Python was around. If Python3 does not
> support this then it's a regression on Python's part.
Python 3 does support it, see other messages about using bytes
filenames.
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
uld), then at least you can try using OS threads.
Then, depending on the tolerable latency for I2C operation, you can try
to run it as an OS thread, or a separate process (if running as a
separate process, make sure it cannot block while sending IO to the
master process).
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 1 Dec 2010 11:50:46 +
Jack Keegan wrote:
> Hi Antoine,
>
> On Wed, Dec 1, 2010 at 9:24 AM, Antoine Pitrou wrote:
> >
> >
> > The main question IMO: the I2C bus operates at 400kHz, but how much
> > received data can it buffer? That will give you a hi
s why separate processes might be a
better answer if the latency requirements are tight - especially on
Python 2.x-3.1 where the GIL is badly implemented)
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
eable. They will certainly have slightly different behaviour
in corner cases. The io module is much more tested since it's the
official way to do I/O in Python 3, so its own corner cases are
probably better than those in the codecs module :)
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
because of the trailing :s, at least not with FireFox.
Work fine here. The problem isn't Firefox, it is your e-mail or news
client.
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
sing? When you go past the available RAM, your process
starts swapping and everything becomes incredibly slower.
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
know what exactly you're trying to do (is this an actual
application? or just some random test you're doing?), but relying on
the pagefile to have more available memory than the system RAM is a
very bad idea IMO.
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
d" messages such as warnings and various
optional information. stdout is used to output whatever data the user
asked for (which generally isn't errors and warnings). If you redirect
said data to a file, you don't want out of band information to end up
mingled with it.
Re
/docs.python.org/c-api/index.html
Thank you
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
e python list:
> it can only contain numerical data (also char, byte).
>
> But don't know the timing pattern of array objects, only that they are *way*
> faster then lists.
Why do you say there're much faster?
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
uper()). »
With a very simple example in the register() doc:
http://docs.python.org/library/abc.html#abc.ABCMeta.register
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
inspect module.
If you start looking inside the pants of the object model, you can have
surprises :)
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
ng the existing Nagios instead of re-inventing the
> wheel, and you accuse *them* of suffering from NIH syndrome.
Well, I don't know about Tcl but Nagios was re-written in Python:
http://www.shinken-monitoring.org/features/
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
- object is also in 3.x
- NotImplemented is not an exception type, it's a built-in singleton
like None
- you forgot VMSError (only on VMS) :-)
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
PyString_*, PyInt_* functions are available?
> Is it possible to have distutils make a .lib file for me?
I don't know. I'd say "probably" :S
Otherwise you can use the PyCapsule system, but that seems quite a bit
more involved: http://docs.python.org/c-api/capsule.html
Regards
You would never have reacted this way if the same question had been
phrased by a regular poster here (let alone on python-dev). Taking
cheap shots at newcomers is certainly not the best way to welcome
them.
Thank you
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
when the original message doesn't look like the
usual blunt, impolite and typo-ridden "can you do my homework" message.
Also, I would expect someone familiar with the textwrap module's (lack
of) unicode capabilities would have been able to answer the first
message without
thon.org/devguide/#contributing if you need more
info on how to contribute.
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 17 Jan 2011 11:08:52 -0800 (PST)
AlexLBasso wrote:
> I am recruiting for a 9 month contract (with contract extension
> potential) for a company in North Austin.
Please post on the job board instead:
http://python.org/community/jobs/
Thank you
Antoine.
--
http://mail.pyth
tes this?
Math? UTF-8 is simply a byte-oriented (rather than word-oriented)
encoding. There is no math involved, it just works by construction.
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
ll I have to agree that moving to the beginning using move_to_end()
with a "last" argument looks completely bizarre and unexpected.
"Parallels popitem()" is not really convincing since popitem() doesn't
have "end" its name.
> Those were the design considerations. Sorry you didn't like the
> result.
Design considerations? Where were they discussed?
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 18 Jan 2011 09:10:48 -0800 (PST)
rantingrick wrote:
>
> Well don't get wrong i want to join in --not that i have all the
> solutions--
Take a look at http://docs.python.org/devguide/#contributing
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 18 Jan 2011 10:33:45 -0800 (PST)
rantingrick wrote:
>
> On Jan 18, 11:56 am, Antoine Pitrou wrote:
> > On Tue, 18 Jan 2011 09:10:48 -0800 (PST)
> >
> > rantingrick wrote:
> >
> > > Well don't get wrong i want to join in --not that i have a
On Wed, 19 Jan 2011 11:34:53 + (UTC)
Tim Harig wrote:
> That is why the FAQ I linked to
> says yes to the fact that you can consider UTF-8 to always be in big-endian
> order.
It certainly doesn't. Read better.
> Essentially all byte based data is big-endian.
This is pure nonsense.
--
htt
your own foolish
interpretation of it. UTF-8 does not have any endianness since it is a
byte stream and does not care about "machine words".
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
" > toto.py
$ __svn__/python -m compileall -l .
Listing . ...
Compiling ./toto.py ...
$ rm toto.py
$ __svn__/python __pycache__/toto.cpython-32.pyc
3.2rc1+ (py3k:88095M, Jan 18 2011, 17:12:15)
[GCC 4.4.3]
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 19 Jan 2011 16:03:11 + (UTC)
Tim Harig wrote:
>
> For many operations, it is just much faster and simpler to use a single
> character based container opposed to having to process an entire byte
> stream to determine individual letters from the bytes or to having
> adaptive size contai
ript,
using __file__ and os.path.dirname. Nothing complicated AFAICT.
(by the way, the fact that pyc files are version-specific should
discourage any use outside of version-specific directories,
e.g. /usr/lib/pythonX.Y/site-packages)
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 19 Jan 2011 18:02:22 + (UTC)
Tim Harig wrote:
> On 2011-01-19, Antoine Pitrou wrote:
> > On Wed, 19 Jan 2011 16:03:11 + (UTC)
> > Tim Harig wrote:
> >>
> >> For many operations, it is just much faster and simpler to use a single
> >> c
On Wed, 19 Jan 2011 19:18:49 + (UTC)
Tim Harig wrote:
> On 2011-01-19, Antoine Pitrou wrote:
> > On Wed, 19 Jan 2011 18:02:22 + (UTC)
> > Tim Harig wrote:
> >> Converting to a fixed byte
> >> representation (UTF-32/UCS-4) or separating all of the byte
t; Now I can print non-ascii characters if they are
> properly encoded.
You can *always* print characters if they are properly encoded. What
you are asking is for Python to guess and do the encoding by itself,
which is a different matter (and a poorly supported one under 2.x;
Python 3 behaves muc
n 2.4.6.
You can probably use whatever version of Python comes with Solaris, no
need to build your own.
Oh, and tell the Mailman guys that their recommendations are totally
obsolete.
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
Le Sun, 11 Apr 2010 16:16:45 +0100, Baz Walter a écrit :
> On 11/04/10 15:37, Stefan Behnel wrote:
>> The codecs module does not support universal newline parsing (see the
>> docs). You need to use the new io module instead.
>
> thanks.
>
> i'd completely overlooked the io module - i thought it w
Le Sun, 18 Apr 2010 22:37:30 -0700, John Nagle a écrit :
>
> The cert file is the same PEM file I use with M2Crypto, and it's derived
> from Firefox's cert file.
>
> Why am I getting a "private key" related error? I'm not submitting a
> keyfile, just a cert file.
I'm not an expert but this is w
encoded text and then two raw bytes which are invalid utf-8)
Another possibility is to open the file in binary mode and do the
encoding yourself when writing text. This might actually be a better
solution, since I'm not sure RTF uses utf-8 by default.
Regards
Antoine.
--
http://mail.python.org/mailman/listinfo/python-list
) "Return the string of one character whose Unicode codepoint is
>> the integer i."
>>
>> I want to convert a ASCII code back to a character under python 3, not
>> Unicode.
>>
>> How can I do that?
>
> Just use chr().
Or, if you want a bytes o
Le Tue, 27 Apr 2010 02:43:19 -0700, King a écrit :
>
> Python is compiled and installed successfully. However the
> modules(_socket.so, _random.so etc) are two big in terms of file size.
> They are around 4.5-5.0 mb each. I have used "strip strip-all *.so", but
> still size is around 1.5 mb each.
e/path/%s" % x, 'rb')
> print(f.read())
print() implicitly converts its arguments to str (i.e. unicode strings)
and then writes them to sys.stdout, which is a text IO wrapper.
If you want to bypass the unicode layer, you have to use
sys.stdout.buffer instead.
That is:
sys.st
Le Thu, 29 Apr 2010 12:53:53 +0200, Dodo a écrit :
>
> @Antoine : It not sys.stdout.buffer.write but sys.stdout.write()
> instead. But it still doesn't work, now I have empty content
Let me insist: please use sys.stdout.buffer.write().
You'll also have to call sys.stdout.flus
sys.stdout.buffer.write( f.read() )
> sys.stdout.flush()
Sorry, I should have been clearer. You have to flush sys.stdout before
using sys.stdout.buffer, such that the unicode layer doesn't keep any
unwritten data. So this should be:
sys.stdout.flush()
sys.stdout.buf
101 - 200 of 332 matches
Mail list logo