Recent versions of IPython ignore $TERM and blindly assume that you're
using something similar to xterm. Does it have an option to disable this
"feature"?
--
https://mail.python.org/mailman/listinfo/python-list
I have following errors running on Ubuntu 18, any insight how to fix it? Thank
you.
Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import inspect
Traceback (most recent call last):
File "", line
On Mon, 21 Nov 2016 14:53:35 +, BartC wrote:
> Also that the critical bits were not implemented in Python?
That is correct. You'll notice that there aren't any loops in numpy.cross.
It's just a wrapper around a bunch of vectorised operations (*, -, []).
If you aren't taking advantage of vect
On Mon, 24 Oct 2016 11:14:05 -0700, jladasky wrote:
> I gather that non-blocking keyboard input functions aren't the easiest
> thing to implement. They seem to depend on the operating system.
Indeed. It's somewhat harder to implement one on an OS which doesn't take
it for granted that the system
On Thu, 13 Oct 2016 15:06:25 +0100, Daiyue Weng wrote:
> I know that such try-catch usage is generally a bad practice, since it
> can't locate the root of the exceptions.
>
> I am wondering how to correct the code above
Either identify the specific exceptions you're expecting, or if you're
inter
On Tue, 20 Sep 2016 15:12:39 +0200, Peter Otten wrote:
> because they don't build lists only to throw them away.
The lists could have been avoided by using iterators, e.g.
import itertools as it
keys = xrange(256)
vals = it.imap(chr, keys)
max(it.imap(operator.setitem, it.repeat(d), keys, vals))
On Fri, 02 Sep 2016 18:18:08 +0200, Christian Gollwitzer wrote:
> 1e26 denotes a *floating point number* Floating point has finite
> precision, in CPython it is a 64bit IEEE number. The largest exact
> integer there is 2**53 (~10^16), everything beyond cannot be accurately
> represented.
Uh, t
On Tue, 30 Aug 2016 04:15:05 +1000, Chris Angelico wrote:
> Don't imagine; test.
Testing alone isn't really good enough. There may be perfectly valid
reasons to avoid the import which won't show up in anything less than the
most thorough testing imaginable.
Personally I wouldn't defer an import
On Mon, 01 Aug 2016 18:41:53 -0700, Lawrence D’Oliveiro wrote:
> Sometimes people load a library with ctypes like this:
>
> libc = ctypes.cdll.LoadLibrary("libc.so")
That specific example is unlikely to work on any modern Linux system, as
libc.so is typically a linker script rather than a sy
On Wed, 27 Jul 2016 22:47:15 -0400, Larry Martell wrote:
> Also let me add that initially I was calling Popen with shell=False and
> the arguments in a list, and that was failing with:
>
> arg 2 must contain only strings
That indicates that you're calling Popen() incorrectly.
> And when I debug
On Tue, 26 Jul 2016 07:10:18 -0700, Heli wrote:
> I sort a file with 4 columns (x,y,z, somevalue) and I sort it using
> numpy.lexsort.
>
> ind=np.lexsort((val,z,y,x))
>
> myval=val[ind]
>
> myval is a 1d numpy array sorted by x,then y, then z and finally val.
>
> how can I reshape correctly my
On Fri, 15 Jul 2016 21:39:31 +1000, Steven D'Aprano wrote:
> prod *= (m1*m2)
Should be:
prod = m1*m2
or:
prod *= m1
(in the latter case, there's no point in decomposing prod).
Of course, if the result overflows, it's going to overflow whether you use
the naive approach
Some common ways to handle the boundary condition:
1. Generate clamped indices, test for validity and substitute invalid
entries with an "identity" element. E.g.
ijk = np.mgrid[:a,:b,:c]
i,j,k = ijk
i0,j0,k0 = np.maximum(0,ijk-1)
i1,j1,k1 = np.minimum(np.array(a,b,c).T-1,ijk+1)
n1 = (i>
On Mon, 11 Jul 2016 10:52:08 -0700, jonas.thornvall wrote:
> What kind of statistic law or mathematical conjecture or is it even a
> physical law is violated by compression of random binary data?
You can't create an invertable mapping between a set with 2^N elements
(e.g. the set of all N-bit bi
On Sat, 04 Jun 2016 12:28:33 +1000, Steven D'Aprano wrote:
>> OTOH, a Free software licence is unilateral; the author grants the user
>> certain rights, with the user providing nothing in return.
>
> That's not the case with the GPL.
>
> The GPL requires the user (not the end-user, who merely av
On Fri, 03 Jun 2016 09:15:55 -0700, Lawrence D’Oliveiro wrote:
>> [quoted text muted]
>
> A licence is quite different from a contract. A contract requires some
> indication of explicit agreement by both parties, a licence does not.
More precisely, it requires "mutual consideration", i.e. each p
On Wed, 18 May 2016 09:19:25 -0700, Ned Batchelder wrote:
> Is there a way to know how large the C stack can grow,
Yes. For the main thread, getrlimit(RLIMIT_STACK). For other threads,
pthread_attr_getstacksize().
> and how much it will grow for each Python function call?
No.
Depending upon th
On Sat, 23 Apr 2016 00:56:33 +1000, Steven D'Aprano wrote:
> I want to remove a directory, including all files and subdirectories under
> it, but without following symlinks. I want the symlinks to be deleted, not
> the files pointed to by those symlinks.
Note that this is non-trivial to do secure
On Thu, 21 Apr 2016 18:05:40 +1000, Steven D'Aprano wrote:
> The specific problem I am trying to solve is that I have a sequence of
> strings (in this case, error messages from a Python traceback) and I'm
> looking for repeated groups that may indicate mutually recursive calls. E.g.
> suppose I
On Sat, 26 Mar 2016 23:30:30 +, John Pote wrote:
> So I have sympathy with the OP, I would expect the compiler to pick this
> up
Why? The code is valid, the compiler knows how to generate the
appropriate bytecode for it.
The compiler isn't "lint".
Reporting code which is actually invalid is
> What you want is called *transposing* the array:
>
> http://docs.scipy.org/doc/numpy/reference/generated/numpy.transpose.html
>
> That should be a sufficiently fast operation.
Transposing itself is fast, as it just swaps the strides and dimensions
without touching the data (i.e. it returns a n
On Mon, 15 Feb 2016 15:28:27 +1100, Ben Finney wrote:
> The behaviour is already implemented in the standard library. What I'm
> looking for is a way to use it (not re-implement it) that is public API
> and isn't scolded by the library documentation.
So, basically you want (essentially) the exact
On Thu, 17 Dec 2015 14:03:25 +0100, Siegfried Kaiser wrote:
> I have a problem with os.walk - it does not walk into a mounted cdrom, I
> do not see the cdrom in the walk at all.
> What can I do to walk into cdrom?
1. Are you sure that the directory tree contains the actual mount point,
not just
On Wed, 16 Dec 2015 06:04:37 -0800, fsn761304 wrote:
> pixbufObj = Gdk.pixbuf_get_from_window(window, x, y, width, height) ...
> image = Image.frombuffer("RGB", (width, height),
> pixbufObj.get_pixels(), 'raw', 'RGB', 0, 1)
The second-to-last argument should proba
On Wed, 25 Nov 2015 14:51:23 +0100, Antoon Pardon wrote:
> Am I missing something?
The issue is with lambdas rather than with list comprehensions per se.
Python's lambdas capture free variables by reference, not value.
> x = 3
> f = lambda y: x + y
> f(0)
3
On Wed, 04 Nov 2015 14:23:04 +1100, Steven D'Aprano wrote:
>> Its very name indicates that its default mode most certainly is regular
>> expressions.
>
> I don't even know what grep stands for.
>From the ed command "g /re/p" (where "re" is a placeholder for an
arbitrary regular expression). Test
On Mon, 02 Nov 2015 18:52:55 +1100, Steven D'Aprano wrote:
> In Python 2, stderr is unbuffered.
>
> In most other environments (the shell, C...) stderr is unbuffered.
>
> It is usually considered a bad, bad thing for stderr to be buffered. What
> happens if your application is killed before the
On Sun, 20 Sep 2015 23:11:20 +0200, Baladjy KICHENASSAMY wrote:
> i tried this
>
> def save():
> Canevas.update()
> Canevas.postscript(file=tkFileDialog.asksaveasfilename(),
> colormode='color')
> subprocess.call(["ps2pdf", "-dEPSCrop", "test.ps", "test.pdf"])
>
>
> i got the ps
On Mon, 14 Sep 2015 09:13:47 +0200, ast wrote:
> is it advised to always write programs like that ?
If global (module-scope) variables are initialised by main, then those
variables won't exist unless main() is run, which means that you can't use
it as a module, only as a script.
IMHO, global var
On Thu, 10 Sep 2015 22:05:07 -0500, Seb wrote:
> The key to my solution was to use numpy's meshgrid to generate the
> coordinates for defining the sub-units. However, it seems awfully
> complex and contrived,
Half a dozen lines of code is "complex and contrived"?
Also, you should lose marks for
On Sun, 16 Aug 2015 09:53:32 -0700, Sven Boden wrote:
> Anyone knows how to handle a "#N/A" cell in Excel in the proper way?
0x800A07FA is how xlErrNA (error 2042) is marshalled. This isn't specific
to Python; you'll get the same value using e.g C# or VB.NET.
There's a fairly thorough article on
On Fri, 05 Jun 2015 13:11:13 +, Paul Appleby wrote:
> (I'd have thought that id(a[1]) and id(b[1]) would be the same if they
> were the same element via different "views", but the id's seem to change
> according to rules that I can't fathom.)
First, a[1] and b[1] aren't views, they're scalars
On Sun, 05 Apr 2015 12:20:48 -0700, Daniel Ellis wrote:
> This only seems to print from the parent process. I read that I need to
> do the os.read call for the fork to happen. I've also tried printing
> *after* the os.read call.
The child process has its std{in,out,err} attached to the newly-cr
On Tue, 24 Mar 2015 12:08:24 -0700, Tobiah wrote:
> But if I want to send a string to stdin, how can I do that without
> stdin.write()?
p.communicate(string)
> This seems to work:
Only because the amounts of data involved are small enough to avoid
deadlock.
If both sides write more dat
On Mon, 02 Feb 2015 14:20:56 +0100, Antoon Pardon wrote:
> I need to have a program construct a number of designs. Of course I can
> directly use a pfd surface and later use a pdf viewer to check. But that
> becomes rather cumbersome fast. But if I use a cairo-surface for on the
> screen I suddenl
On Thu, 08 Jan 2015 09:56:50 -0800, Rustom Mody wrote:
> Given a matrix I want to shift the 1st column 0 (ie leave as is) 2nd by
> one place, 3rd by 2 places etc.
>
> This code works.
> But I wonder if numpy can do it shorter and simpler.
def shiftcols(mat):
iy,ix = np.indices(mat.shape)
On Tue, 16 Dec 2014 00:46:16 -0500, Jason Swails wrote:
> I liked this problem because naive solutions scale as O(2^N), begging for
> a more efficient approach.
Project Euler has this one, twice; problems 18 and 67.
The difference between the two is that problem 18 has 15 rows while
problem 67 h
To: pengsir
On Tue, 09 Dec 2014 00:14:15 -0800, pengsir wrote:
> localpath = 'c:'
> sftp.get(filepath, localpath)
> with open(localpath, 'wb') as fl:
> PermissionError: [Errno 13] Permission denied: 'c:'
It's trying to open "c:", which is a drive, as if it was a file.
You have to specify
On Tue, 09 Dec 2014 00:14:15 -0800, pengsir wrote:
> localpath = 'c:'
> sftp.get(filepath, localpath)
> with open(localpath, 'wb') as fl:
> PermissionError: [Errno 13] Permission denied: 'c:'
It's trying to open "c:", which is a drive, as if it was a file.
You have to specify the destinati
On Thu, 04 Dec 2014 16:25:44 +0100, ast wrote:
> There is no roll over problem with time.time() since the very
> first one in planned far in the future, but time.time() can go
> backward when a date update throught NTP server is done.
> time.monotonic() is monotonic but roll over often (every 49.
On Tue, 02 Dec 2014 21:41:33 +, John Gordon wrote:
> GET shouldn't cause any business data modifications, but I thought it was
> allowed for things like logging out of your session.
GET isn't supposed to have observable side-effects. "Observable" excludes
things like logs and statistics, but
On Mon, 01 Dec 2014 11:28:42 -0900, Israel Brewster wrote:
> I'm running to a problem, specifically from
> Safari on the Mac, where I start to type a URL, and Safari auto-fills the
> rest of a random URL matching what I started to type, and simultaneously
> sends a request for that URL to my serve
On Thu, 13 Nov 2014 15:48:32 -0800, satishmlmlml wrote:
> import sys
> for stream in (sys.stdin, sys.stdout, sys.stderr):
>print(stream.fileno())
>
>
> io.UnsupportedOperation: fileno
>
> Is there a workaround?
Try:
sys.stdin.buffer.fileno()
or maybe
sys.stdin
On Thu, 30 Oct 2014 08:30:49 -0400, C@rlos wrote:
> thanks U, but the real problem is:
>
> i have a path C:\Users\yanet\Desktop\áaaéeeíiiióooúuuñnn this path
> is correct, áaaéeeíiiióooúuuñnn is the name of a directory but when
> i try to use os.walk() usin this path, dont work, for os this path
On Mon, 27 Oct 2014 17:14:58 +0200, Marko Rauhamaa wrote:
> In POSIX, a write(2) system call on file blocks until all bytes have been
> passed on to the file system. The only exception (no pun intended) I know
> is the reception of a signal.
Writing to a file (or block device) will return a short
On Sat, 18 Oct 2014 18:42:00 -0700, Dan Stromberg wrote:
> On Sat, Oct 18, 2014 at 6:34 PM, Dan Stromberg wrote:
>>> Once the "nc" process actually write()s the data to its standard
>>> output (i.e. desriptor 1, not the "stdout" FILE*)
>> I'm not sure why you're excluding stdout, but even if nc i
On Sat, 18 Oct 2014 12:32:07 -0500, Tim Chase wrote:
> On 2014-10-18 17:55, Nobody wrote:
>> On Fri, 17 Oct 2014 12:38:54 +0100, Empty Account wrote:
>>
>> > I am using netcat to listen to a port and python to read stdin and
>> > print to the consol
On Fri, 17 Oct 2014 12:38:54 +0100, Empty Account wrote:
> I am using netcat to listen to a port and python to read stdin and print
> to the console.
>
> nc -l 2003 | python print_metrics.py
>
> sys.stdin.flush() doesn’t seem to flush stdin,
You can't "flush" an input stream.
> so I am using t
On Wed, 13 Nov 2013 15:35:56 -0500, bob gailer wrote:
> I joined a week or so ago.
>
> The subject line was copied from the description of comp.lang.python aka
> python-list@python.org.
>
> I am very disappointed to see so much energy and bandwidth going to
> conversations that bash individual
On Fri, 01 Nov 2013 14:55:38 -0400, random832 wrote:
> If it's possible to get this information with only the fd, then why does
> socket.fromfd require them?
The only person who can answer that is whoever came up with
socket.fromfd() in the first place.
I initially suspected that it might have b
On Thu, 31 Oct 2013 12:16:23 -0400, Roy Smith wrote:
> I want to do getpeername() on stdin. I know I can do this by wrapping a
> socket object around stdin, with
>
> s = socket.fromfd(sys.stdin.fileno(), family, type)
>
> but that requires that I know what the family and type are. What I want
On Mon, 28 Oct 2013 09:50:19 +, Wolfgang Maier wrote:
> So my question is: is there an agreed-upon generally best way of dealing
> with this?
Yes. Just leave the test inside the loop.
If you're sufficiently concerned about performance that you're willing to
trade clarity for it, you shouldn'
On Sat, 26 Oct 2013 20:41:58 -0500, Tim Chase wrote:
> I'd be just as happy if Python provided a "sloppy string compare"
> that ignored case, diacritical marks, and the like.
Simply ignoring diactrics won't get you very far.
Most languages which use diactrics have standard conversions, e.g.
ö ->
On Sat, 12 Oct 2013 05:43:22 -0600, Ian Kelly wrote:
> Easier said than done. The module is currently written in pure
> Python, and the comment "Note: Please keep this module compatible to
> Python 1.5.2" would appear to rule out the use of ctypes to call the
> glibc function.
Last I heard, ther
On Thu, 10 Oct 2013 14:12:36 +, Grant Edwards wrote:
> Nope. "i" is electical current (though it's more customary to use upper
> case).
"I" is steady-state current (either AC or DC), "i" is small-signal
current.
--
https://mail.python.org/mailman/listinfo/python-list
On Wed, 09 Oct 2013 08:37:39 -0700, tspiegelman wrote:
> I am trying to use socket to send / receive a packet (want to recreate
> some functionality of hping3 and port it to windows and mac as a tcp
> ping). I am having some problems with the recv functionality of socket.
> Below is the script I
On Tue, 08 Oct 2013 23:10:16 -0700, John Nagle wrote:
> I only need affine transformations. This is just moving
> the coordinate system of a point, not perspective rendering. I have to do
> this for a lot of points, and I'm hoping numpy has some way to do this
> without generating extra garba
On Sat, 05 Oct 2013 00:38:51 -0700, galeomaga wrote:
> #!/usr/bin/python
> import time
> f = open('/home/martin/Downloads/a.txt')
> while 1:
> for line in f:
> print line;
> time.sleep(1);
So you're trying to implement "tail -f"?
First, check that "tail -f" actually wor
On Thu, 26 Sep 2013 10:26:48 +0300, Νίκος wrote:
> How can i wrote the two following lines so for NOT to throw out
> KeyErrors when a key is missing?
>
> city = gi.time_zone_by_addr( os.environ['HTTP_CF_CONNECTING_IP'] ) or
> gi.time_zone_by_addr( os.environ['REMOTE_ADDR'] ) or
> "ÎγνÏÏÏη
On Sat, 21 Sep 2013 21:39:07 -0700, John Ladasky wrote:
> However, neither Screen.ontimer() not Screen.onkeypress() appear to give
> me a way to pass arguments to functions of my own. Why don't they? Is
> this some limitation of Tk? I have worked with other GUI's before, and I
> don't remember
On Fri, 13 Sep 2013 01:27:53 +1000, Chris Angelico wrote:
> That said, though: These sorts of keystrokes often can be represented
> with escape sequences (I just tried it in xterm and Alt-D came out as
> "\e[d"),
Technically, that would be Meta-D (even if your Meta key has "Alt" printed
on it).
On Wed, 11 Sep 2013 00:53:53 +, Steven D'Aprano wrote:
> and most routines that handle file names accept either text strings or
> bytes strings:
I was going to say "that just leaves environ and argv". But I see that
os.environb was added in 3.2. Which just leaves argv.
--
https://mail.pyth
On Wed, 11 Sep 2013 07:26:32 -0700, Wanderer wrote:
> How do I send the command 'Alt+D' to subprocess.PIPE?
You don't. GUI programs don't read stdin, they receive key press events
from the windowing system.
--
https://mail.python.org/mailman/listinfo/python-list
On Tue, 10 Sep 2013 17:07:09 +1000, Ben Finney wrote:
> * Python requires every programmer to know, or quickly learn, the basics
> of Unicode: to know that text is not, and never will be again,
> synonymous with a sequence of bytes.
If only the Python developers would learn the same lesson ..
On Mon, 09 Sep 2013 10:39:43 -0700, eamonnrea wrote:
> Is there a way to detect if the user presses a key in Python that works on
> most OS's? I've only seen 1 method, and that only works in Python 2.6 and
> less.
There's no "generic" solution to this.
At a minimum, there's getting "key presses"
On Sun, 08 Sep 2013 03:37:15 +, Dave Angel wrote:
> You can run a 32bit Python on 64bit OS, but not the oter way
> around. And most people just match the bitness of Python against the
> bitness of the OS.
AFAICT, most people run 32-bit Python on any version of Windows.
[And this isn't limit
On Sat, 07 Sep 2013 03:55:02 -0700, larry.mart...@gmail.com wrote:
> I have a python script and when I run it directly from the command line
> it runs to completion. But I need to run it from another script. I do
> that like this:
>
> p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subp
On Mon, 02 Sep 2013 09:44:20 +, Steven D'Aprano wrote:
> One factor I don't see very often mentioned is that static typing
> increases coupling between distant parts of your code. If func() changes
> from returning int to MyInt, everything that calls func now needs to be
> modified to accep
On Thu, 29 Aug 2013 17:00:21 -0800, Tim Johnson wrote:
> ## This appears to be what works.
> def __exec(self,args) :
> """Run the process with arguments"""
>p =
>subprocess.Popen(args,stderr=subprocess.PIPE,stdout=subprocess.PIPE)
>while 1 :
>output
On Wed, 28 Aug 2013 18:09:22 -0300, Joe Junior wrote:
> Of course I don't want to check isistance(), I like duck typing, but
> should I check if hasattr() and callable() before adding to the container?
That won't tell you if the object has a quack() method but with
incompatible semantics (e.g. wr
On Tue, 13 Aug 2013 16:10:41 -0700, Jack Bates wrote:
> Is there anything like os.pipe() where you can read/write both ends?
There's socket.socketpair(), but it's only available on Unix.
Windows doesn't have AF_UNIX sockets, and anonymous pipes (like the ones
created by os.pipe()) aren't bidirec
On Tue, 13 Aug 2013 05:25:34 -0700, rlkling wrote:
> Or, asking another way, are there any python libraries that display images
> to 10 bit monitors as 10 bit images, and not scaled to 8 bit?
This should be possible using PyOpenGL and GLUT, with:
glutInitDisplayString("red=10 green=10 bl
On Fri, 09 Aug 2013 21:12:20 +0100, Nobody wrote:
> Try:
>
> command = ['sudo', 'tee', config_file]
> p = subprocess.Popen(command, stdout=subprocess.PIPE,
> stderr=subprocess.PIPE)
> out, _ = p.communicate('channel')
Oops; you also need st
On Thu, 08 Aug 2013 23:11:09 -0500, Adam Mercer wrote:
> I'm trying to write a script that writes some content to a file root
> through sudo, but it's not working at all. I am using:
> command = ['echo', '-n', channel, '|', 'sudo', 'tee', config_file]
You can't create a pipeline like this. All
On Tue, 23 Jul 2013 15:11:43 +0200, Peter Otten wrote:
> The conversion to int introduces a rounding error that accumulates over
> time.
Most floating point calculations introduce a rounding error. If the
calculations are iterated, the error will accumulate.
In general, you want to avoid accumu
On Mon, 22 Jul 2013 14:19:57 +0200, Gilles wrote:
> Incidently, how do ISP MTAs find whether the remote MTA is legit or
> running on some regular user's computer?
Look up the IP address in a database. If they don't have a database,
perform a reverse DNS lookup and reject anything which looks like
On Thu, 11 Jul 2013 08:32:34 -0700, Metallicow wrote:
> How do I get the OS System Font Directory(Cross-Platform) in python?
What makes you think the system *has* a system font directory?
In the traditional X11 model, the only program which needs fonts is the X
server, and that can be configured
On Wed, 10 Jul 2013 22:57:09 -0600, Jason Friedman wrote:
> Other than using a database, what are my options for allowing two processes
> to edit the same file at the same time? When I say same time, I can accept
> delays.
What do you mean by "edit"? Overwriting bytes and appending bytes are
sim
On Thu, 04 Jul 2013 13:38:09 +0300, Νίκος wrote:
> So you are also suggesting that what gesthostbyaddr() returns is not
> utf-8 encoded too?
The gethostbyaddr() OS function returns a byte string with no specified
encoding. Python 3 will doubtless try to decode that to a character string
using so
On Wed, 19 Jun 2013 23:03:05 +, Joseph L. Casale wrote:
> I am trying to invoke a binary that requires dll's in two places all of
> which are included in the path env variable in windows. When running this
> binary with popen it can not find either, passing env=os.environ to open
> made no dif
On Sat, 15 Jun 2013 03:56:28 +1000, Chris Angelico wrote:
> With a few random oddities:
>
bool(float("nan"))
> True
>
> I somehow expected NaN to be false. Maybe that's just my expectations
> that are wrong, though.
In general, you should expect the behaviour of NaN to be the opposite of
w
On Fri, 14 Jun 2013 16:49:11 +, Steven D'Aprano wrote:
> Unlike Javascript though, Python's idea of truthy and falsey is actually
> quite consistent:
Beyond that, if a user-defined type implements a __nonzero__() method then
it determines whether an instance is true or false. If it implement
On Fri, 14 Jun 2013 19:30:27 +, Grant Edwards wrote:
> 2. Returning one the objects that result from the evaluation of the
> operands instead of returning True or False.
>
> This is what seems to be confusing him. This is much less common
> than short-circuit evaluation.
FWIW,
On Fri, 14 Jun 2013 18:16:05 +0300, Nick the Gr33k wrote:
> My question is why the expr (name and month and year) result in the
> value of the last variable whic is variable year?
For much the same reason that an OR expression returns the first true
value.
"or" and "and" only evaluate as many a
On Thu, 13 Jun 2013 01:23:27 +, Steven D'Aprano wrote:
> Python does have a globally-global namespace. It is called "builtins", and
> you're not supposed to touch it. Of course, being Python, you can if you
> want, but if you do, you are responsible for whatever toes you shoot off.
>
> Modify
On Thu, 13 Jun 2013 12:01:55 +1000, Chris Angelico wrote:
> On Thu, Jun 13, 2013 at 11:40 AM, Steven D'Aprano
> wrote:
>> The *mechanism* of UTF-8 can go up to 6 bytes (or even 7 perhaps?), but
>> that's not UTF-8, that's UTF-8-plus-extra-codepoints.
>
> And a proper UTF-8 decoder will reject "\
On Wed, 12 Jun 2013 14:23:49 +0300, Νικόλαος Κούρας wrote:
> So, how many bytes does UTF-8 stored for codepoints > 127 ?
U+..U+007F 1 byte
U+0080..U+07FF 2 bytes
U+0800..U+ 3 bytes
>=U+1 4 bytes
So, 1 byte for ASCII, 2 bytes for other Latin characters, Greek, Cyrillic,
Arabi
On Tue, 11 Jun 2013 01:50:07 +, Joseph L. Casale wrote:
> I am using Popen to run the exe with communicate() and I have sent stdout
> to PIPE without luck. Just not sure what is the proper way to iterate over
> the stdout as it eventually makes its way from the buffer.
The proper way is:
On Sun, 09 Jun 2013 03:44:57 -0700, Νικόλαος Κούρας wrote:
>>> Since 1 byte can hold up to 256 chars, why not utf-8 use 1-byte for
>>> values up to 256?
>
>>Because then how do you tell when you need one byte, and when you need
>>two? If you read two bytes, and see 0x4C 0xFA, does that mean tw
On Fri, 07 Jun 2013 08:53:03 -0700, letsplaysforu wrote:
> I was planning on making a small 2D game in Python. Are there any
> libraries for this? I know of:
[snip]
There's also Pyglet.
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 06 Jun 2013 03:55:11 +1000, Chris Angelico wrote:
> The HTTP header is completely out of band. This is the best way to
> transmit encoding information. Otherwise, you assume 7-bit ASCII and start
> parsing. Once you find a meta tag, you stop parsing and go back to the
> top, decoding in th
On Tue, 04 Jun 2013 00:58:42 -0700, Νικόλαος Κούρας wrote:
> Τη Τρίτη, 4 Ιουνίου 2013 10:39:08 π.μ. UTC+3, ο
> χρήστης Nobody έγραψε:
>
>> Chrome didn't choose ISO-8859-1, the server did; the HTTP response says:
>> Content-Type: text/html;charset=ISO-8859-1
>
On Mon, 03 Jun 2013 23:28:21 -0700, nagia.retsina wrote:
> I can't believe Chrome whcih by default uses utf8 chosed iso-8859-1 to
> presnt the filenames.
Chrome didn't choose ISO-8859-1, the server did; the HTTP response says:
Content-Type: text/html;charset=ISO-8859-1
--
http://mail.python
On Sat, 01 Jun 2013 08:44:36 -0700, Νικόλαος Κούρας wrote:
> CalledProcessError: Command '/home/nikos/public_html/cgi-bin/files.py'
> returned non-zero exit status 1
> args = (1, '/home/nikos/public_html/cgi-bin/files.py')
> cmd = '/home/nikos/public_html/cgi-bin/files.py'
>
On Fri, 31 May 2013 02:12:58 -0700, BIBHU DAS wrote:
> I am a python novice;request all to kindly bear with me.
>
> fd = open('/etc/file','w')
> fd.write('jpdas')
> fd.close()
>
>
> The above snippet fails with:
> IOError: [Errno 13] Permission denied: '/etc/file'
As it should.
> Any Idea ho
On Thu, 30 May 2013 19:38:31 -0400, Dennis Lee Bieber wrote:
> Measuring 1 foot from the 1000 foot stake leaves you with any error
> from datum to the 1000 foot, plus any error from the 1000 foot, PLUS any
> azimuth error which would contribute to shortening the datum distance.
First, let's
On Thu, 30 May 2013 12:07:40 +0300, Jussi Piitulainen wrote:
> I suppose this depends on the complexity of the process and the amount
> of data that produced the numbers of interest. Many individual
> floating point operations are required to be within an ulp or two of
> the mathematically correct
On Mon, 27 May 2013 13:11:28 -0700, Ahmed Abdulshafy wrote:
> On Sunday, May 26, 2013 2:13:47 PM UTC+2, Steven D'Aprano wrote:
>
>> What the above actually tests for is whether x is so small that (1.0+x)
>> cannot be distinguished from 1.0, which is not the same thing. It is
>> also quite arbitrar
On Sun, 26 May 2013 04:11:56 -0700, Ahmed Abdulshafy wrote:
> I'm having a hard time wrapping my head around short-circuit logic that's
> used by Python, coming from a C/C++ background; so I don't understand why
> the following condition is written this way!>
>
> if not allow_zero and abs(x)
On Thu, 23 May 2013 17:20:19 +1000, Chris Angelico wrote:
> Aside: Why was PHP's /e regexp option ever implemented?
Because it's a stupid idea, and that's the only requirement for a feature
to be implemented in PHP.
--
http://mail.python.org/mailman/listinfo/python-list
1 - 100 of 721 matches
Mail list logo