On Sun, 15 Nov 2009 10:50:43 -0800, Aahz wrote:
> Anyone remember or know why Python slices function like half-open
> intervals? I find it incredibly convenient myself, but an acquaintance
> familiar with other programming languages thinks it's bizarre and I'm
> wondering how it happened.
How el
On Mon, 16 Nov 2009 04:58:00 -0800, sturlamolden wrote:
> On 16 Nov, 13:50, Kuhl wrote:
>
>> Python 2.2.3 (#1, Feb 2 2005, 12:22:48)
>
>> What's the mistake that I am making? How to solve it?
>
> Your Python version is too old.
Your Python version is *way* too old.
If you're lucky, people w
On Mon, 16 Nov 2009 07:19:49 -0800, Carlo DiCelico wrote:
> I need to convert JPEG and PNG files to SVG. I'm currently using PIL
> to generate the JPEG/PNG files to begin with. However, I need to be
> able to scale the generated images up in size without a loss of image
> quality. Using SVG seems
On Mon, 16 Nov 2009 08:54:28 -0800, Steve Ferg wrote:
> For a long time I've wondered why languages still use blocks
> (delimited by do/end, begin/end, { } , etc.) in ifThenElse statements.
>
> I've often thought that a language with this kind of block-free syntax
> would be nice and intuitive:
>
On Tue, 17 Nov 2009 17:31:18 +, MRAB wrote:
>> And if I ever find the genius who had the brilliant idea of using =
>> to mean assignment then I have a particularly nasty dungeon reserved
>> just for him. Also a foul-smelling leech-infested swamp for those
>> language designers and compiler wr
On Mon, 16 Nov 2009 14:19:16 -0800, hong zhang wrote:
>> print >>f, mcs
>
> This assigns decimal value, how can I assign Hex here to mcs?
print >>f, "%x" % mcs
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 16 Nov 2009 23:30:09 +, Rhodri James wrote:
> Quote the filenames or escape the spaces:
>
> C:\Python26\Python.exe C:\echo.py "C:\New Folder\text.txt"
>
> We've been living with this pain ever since windowed GUIs encouraged users
> to put spaces in their file names (Apple, I'm look
On Tue, 17 Nov 2009 11:47:46 -0800, Gerry wrote:
> How about this:
>
> lastarg = " ".join(sys.argv[2:])
What about it?
IOW, why would you want to do that?
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 17 Nov 2009 23:57:55 +, Rhodri James wrote:
>>> Quote the filenames or escape the spaces:
>>>
>>> C:\Python26\Python.exe C:\echo.py "C:\New Folder\text.txt"
>>>
>>> We've been living with this pain ever since windowed GUIs encouraged
>>> users
>>> to put spaces in their file names (A
On Wed, 18 Nov 2009 12:25:14 +0100, Jean-Michel Pichavant wrote:
> I'm currently inspecting my Linux process list, trying to parse it in
> order to get one particular process (and kill it).
> I ran into an annoying issue:
> The stdout display is somehow truncated (maybe a terminal length issue,
On Wed, 18 Nov 2009 13:55:52 +0100, Thomas Lotze wrote:
> I wonder what Python XML library is best for writing a program that makes
> small modifications to an XML file in a minimally intrusive way. By that I
> mean that information the program doesn't recognize is kept, as are
> comments and whit
On Thu, 19 Nov 2009 06:21:09 -0800, Bas wrote:
> Below is the script I use to automatically kill firefox if it is not
> behaving, maybe you are looking for something similar.
> lines = os.popen('ps ax|grep firefox').readlines()
This isn't robust. It will kill any process with "firefox" anywhere
On Fri, 20 Nov 2009 09:51:49 -0800, sturlamolden wrote:
> You can make a user-space scheduler and run a 10 tasklets on a
> threadpool. But there is a GIL in stackless as well.
>
> Nobody wants 10 OS threads, not with Python, not with Go, not with
> C.
>
> Also
On Fri, 20 Nov 2009 17:12:36 -0800, Aahz wrote:
> Comparing Go to another computer language -- do you recognize it?
"Here is a language so far ahead of its time that it was not only an
improvement on its predecessors but also on nearly all its successors."
- C. A. R. Hoare (although he was actu
On Sun, 22 Nov 2009 03:43:31 +0100, Ivan Voras wrote:
> The problem is: poll() always returns that the fd is ready (without
> waiting), but read() always returns an empty string. Actually, it
> doesn't matter if I turn O_NDELAY on or off. select() does the same.
Regular files are always "ready" f
On Mon, 23 Nov 2009 17:45:24 +0100, Thomas Lotze wrote:
>> What's your real problem, or use case? Are you just concerned with
>> diffing, or are others likely to read the xml, and want it formatted the
>> way it already is?
>
> I'd like to put the XML under revision control along with other st
On Tue, 24 Nov 2009 02:23:19 +0100, Christian Heimes wrote:
> Gregory Ewing wrote:
>> ntpath.join('d:\\foo', '\\bar')
>>> '\\bar'
>>
>> This does seem like a bug, though -- the correct result
>> should really be 'd:\\bar', since that's what you would
>> get if you used the name '\\bar' with '
On Mon, 23 Nov 2009 22:06:29 +0100, Alf P. Steinbach wrote:
> 10. It says UnicodeDecodeError on mail nr. something something.
That's what you get for using Python 3.x ;)
If you must use 3.x, don't use the standard descriptors. If you must use
the standard descriptors in 3.x, call detach() on the
On Mon, 23 Nov 2009 23:08:25 +0100, Diez B. Roggisch wrote:
> Try printing
>
>stdout.write('\r-->%d')
^M-->0^M-->1^M-->2^M-->3... ;)
But it's probably good enough for the OP's purposes.
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 30 Jan 2010 16:58:34 +, tanix wrote:
>>I'm not familiar with Ruby, but most languages are cleaner than Python
>>once you get beyond the "10-minute introduction" stage.
>
> I'd have to agree. The only ones that beat Python in that department are
> Javascript and PHP. Plus CSS and HTML
On Sun, 31 Jan 2010 03:01:51 -0800, rantingrick wrote:
>> That's also true for most functional languages, e.g. Haskell and ML, as
>> well as e.g. Tcl and most shells. Why require "f(x)" or "(f x)" if "f x"
>> will suffice?
>
> yuck! wrapping the arg list with parenthesis (python way) makes the mo
On Sat, 30 Jan 2010 11:28:47 -0800, KB wrote:
>> > I have a service I subscribe to that uses javascript to stream news.
>
>> There's a Python interface to SpiderMonkey (Mozilla's JavaScript
>> interpreter):
>>
>> http://pypi.python.org/pypi/python-spidermonkey
>
> Thanks! I don't see a documenta
On Sun, 31 Jan 2010 13:41:55 -0600, Tim Chase wrote:
> The previous absolute-path fails in cmd.exe for a variety of apps because
> the "/" is treated as a parameter/switch to the various programs.
> Fortunately, the Python path-handling sub-system is smart enough to do the
> right thing, even whe
On Sun, 31 Jan 2010 22:36:32 +, Steven D'Aprano wrote:
>> for example, in if you have a function 'f' which takes two parameters to
>> call the function and get the result you use:
>>
>> f 2 3
>>
>> If you want the function itself you use:
>>
>>f
>
> How do you call a function of no ar
On Mon, 01 Feb 2010 14:35:57 -0800, Jonathan Gardner wrote:
>> If it was common-place to use Curried functions and partial application in
>> Python, you'd probably prefer "f a b c" to "f(a)(b)(c)" as well.
>
> That's just the point. It isn't common to play with curried functions
> or monads or an
On Mon, 01 Feb 2010 14:13:38 -0800, Jonathan Gardner wrote:
> I judge a language's simplicity by how long it takes to explain the
> complete language. That is, what minimal set of documentation do you
> need to describe all of the language?
That's not a particularly good metric, IMHO.
A simple "
On Sun, 31 Jan 2010 20:57:31 +0100, Robert wrote:
> I tried lxml, but after walking and making changes in the element
> tree, I'm forced to do a full serialization of the whole document
> (etree.tostring(tree)) - which destroys the "human edited" format
> of the original HTML code.
> makes it r
the directory contain the file performing the import rather
than in the process' CWD.
As it stands, imports are dynamically scoped, when they should be
lexically scoped.
>> The general
>> pattern is:
>>
>> 1) You have something which refers to a resource by name.
>&
On Tue, 02 Feb 2010 15:07:05 -0800, Aahz wrote:
>>If you have a problem and you think that regular expressions are the
>>solution then now you have two problems. Regex is really overkill for
>>the OP's problem and it certainly doesn't improve readability.
>
> If you're going to use a quote, it w
On Wed, 03 Feb 2010 08:07:50 +1100, Astan Chee wrote:
> Sorry for being vague but here my question about converting an xml into
> a dict. I found some examples online but none gives the dict/result I
> want.
> Which is kinda wrong. I expect the dict to have the "Space usage
> summary", but it
On Tue, 02 Feb 2010 10:38:53 -0800, Carl Banks wrote:
>> I don't know if that's necessary. Only supporting the "foo.h" case would
>> work fine if Python behaved like gcc, i.e. if the "current directory"
>> referred to the directory contain the file performing the import rather
>> than in the proce
On Wed, 03 Feb 2010 21:33:08 -0600, Michael Gruenstaeudl wrote:
> I am fairly new to Python and need advice on the urllib.urlopen()
> function. The website I am trying to open automatically refreshes
> after 5 seconds and remains stable thereafter. With
> urllib.urlopen().read() I can only r
On Thu, 04 Feb 2010 04:28:20 -0800, Ashok Prabhu wrote:
> I m trying a read the output of a process which is running
> continuously with subprocess.Popen. However the readline() method
> hangs for the process to finish. Please let me know if the following
> code can be made to work with subprocess
On Fri, 05 Feb 2010 03:57:17 -0800, Ashok Prabhu wrote:
> I very badly need this to work. I have been googling out for a week
> with no significant solution. I open a process p1 which does keeps
> running for 4+ hours. It gives some output in stdout now and then. I
> open this process with subproc
On Fri, 05 Feb 2010 21:05:53 -0800, darnzen wrote:
> I've written an app using the wck library (widget construction kit,
> see http://www.effbot.org), in addition to the wckGraph module. What
> I'd like to do, is take the output of one of my windows (happens to be
> a graph), and save it as a *.pn
On Sat, 06 Feb 2010 11:09:31 -0800, Jim wrote:
> I generate some HTML and I want to include in my unit tests a check
> for syntax. So I am looking for a program that will complain at any
> syntax irregularities.
>
> I am familiar with Beautiful Soup (use it all the time) but it is
> intended to
On Sun, 07 Feb 2010 00:26:36 +, Steven D'Aprano wrote:
>> So there isn't such a routine just because some of the regular
>> expressions cannot be enumerated.
No. There isn't a routine because no-one has yet felt any need to write
one.
>> However, some of them can be
>> enumerated. I guess I
On Sat, 06 Feb 2010 21:31:52 +0100, Alf P. Steinbach wrote:
> The size-8 tabs look really bad in an editor configured with tab size 4,
> as is common in Windows. I'm concluding that the CPython programmers
> configure their Visual Studio's to *nix convention.
8-column tabs aren't a "*nix conventi
On Sun, 07 Feb 2010 05:49:28 +, Nobody wrote:
>> The size-8 tabs look really bad in an editor configured with tab size 4,
>> as is common in Windows. I'm concluding that the CPython programmers
>> configure their Visual Studio's to *nix convention.
>
> 8-col
On Wed, 10 Feb 2010 21:23:08 +, Steven D'Aprano wrote:
> The solution to this is to remember that Windows accepts forward slashes
> as well as backslashes, and always use the forward slash. So try:
>
> open("D:/file")
>
> and see if that works.
The solution is not to hard-code pathnames i
On Wed, 10 Feb 2010 15:23:42 -0800, Peng Yu wrote:
> I'm wondering there is already a function in python library that can
> merge intervals. For example, if I have the following intervals ('['
> and ']' means closed interval as in
> http://en.wikipedia.org/wiki/Interval_(mathematics)#Excluding_the
On Wed, 10 Feb 2010 12:17:51 -0800, Anthony Tolle wrote:
> 4. Consider switching to Python 3.x, since there is only one string
> type (unicode).
However: one drawback of Python 3.x is that the repr() of a Unicode string
is no longer restricted to ASCII. There is an ascii() function which
behaves
On Wed, 10 Feb 2010 23:03:29 -0500, Steve Holden wrote:
>> intervals = sorted(intervals, key = lambda x: x[0])
>
> Since Python uses lexical sorting and the intervals are lists isn't the
> key specification redundant here?
Yes, but I wanted to make it explicit.
Well, omitting the key= would
On Fri, 12 Feb 2010 19:21:22 -0500, Echavarria Gregory, Maria Angelica
wrote:
> I am developing a program using Python 2.5.4 in windows 32 OS. The amount
> of data it works with is huge. I have managed to keep memory footprint
> low, but have found that, independent of the physical RAM of the mach
On Sun, 14 Feb 2010 21:43:22 +0100, Christian Heimes wrote:
>> Below is a test case that demonstrates this. Tests 1 & 2 concatenate the
>> command and the argument, Tests 3 & 4 mimic the python docs and use the form
>> Popen(["mycmd", "myarg"], ...), which never seems to work.
>
> It doesn't work
On Tue, 16 Feb 2010 00:11:36 +0800, R (Chandra) Chandrasekhar wrote:
> One other question I forgot to ask is this why is there a terminal
> backslash in
>
>> subprocess.call("""\
>
> Removing the backslash makes the function fail.
>
> I wonder why, because """ is supposed to allow multi-line s
On Mon, 22 Feb 2010 22:27:54 -0800, [email protected] wrote:
> Basically, multiprocessing is always hard--but it's less hard to start
> without shared everything. Going with the special case (sharing
> everything, aka threading) is by far the stupider and more complex way
> to approach multipro
On Wed, 24 Feb 2010 12:22:05 +1300, Lawrence D'Oliveiro wrote:
>> Java - The JVM code been hacked to death by Sun engineers (optimised)
>> Python - The PVM code has seen speed-ups in Unladen or via Pyrex..
>> ad-infinitum but nowhere as near to JVM
>
> Python is still faster, though. I think a ke
On Wed, 03 Mar 2010 03:37:44 +0100, Victor Stinner wrote:
>> I see, makes perfect sense. This then raises the question whether it's
>> important to have a 100% fool proof python sandbox without help from
>> the OS, or this goal is not only too ambitious but also not really a
>> useful one.
>
> T
On Wed, 03 Mar 2010 09:05:47 -0800, enda man wrote:
> cl_path = ms_vc_path + '\VC\bin'
The backslash is used as an escape character within string literals.
Either use raw strings:
cl_path = ms_vc_path + r'\VC\bin'
or escape the backslashes:
cl_path = ms_vc_path + '\\VC\\bin'
o
On Fri, 12 Mar 2010 08:15:49 -0500, Steve Holden wrote:
> For shell=True I believe you should provide the command as a single
> string, not a list of arguments.
Using shell=True with an argument list is valid.
On Unix, it's seldom what you want: it will invoke /bin/sh to execute the
first argume
On Fri, 26 Mar 2010 13:23:25 +, Harishankar wrote:
> Have you people embraced Python 3.x or still with 2.5 or 2.6?
Still with 2.6, and probably will be indefinitely.
I use Python mostly for Unix scripting: the kind of task which would
traditionally have used Bourne shell. For that purpose,
On Sun, 14 Nov 2010 19:47:55 +, Tim Harig wrote:
> On 2010-11-14, Camille Harang wrote:
>> # pg_dump prompts for password so I inject it in stdin.
>> pgsql.stdin.write('MY_PASSWORD' + '\n')
>
> For security reasons, some programs use direct access to the TTY system
> for password entry rathe
On Mon, 22 Nov 2010 11:37:22 +0100, Peter Otten wrote:
>> is there a convenient way to read bz2 files into a numpy array?
>
> Try
> f = bz2.BZ2File(filename)
> data = numpy.fromstring(f.read(), numpy.float32)
That's going to hurt if the file is large.
You might be better off either extracting
On Mon, 22 Nov 2010 20:33:08 -0500, Neal Becker wrote:
> I don't see anything in linux man-page about the underlying C mmap function
> not accepting 0-length files.
My mmap(2) manpage says:
ERRORS
...
EINVAL (since Linux 2.6.12) length was 0.
--
http://mail.pyth
On Sat, 27 Nov 2010 18:23:48 -0500, Terry Reedy wrote:
>> Therefore, to implement this multiplication operation I need to have a
>> way to verify that the float tuples C and D are "equal".
>
> I might try the average relative difference:
> sum(abs((i-j)/(i+j)) for i,j in zip(C,D))/n # assuming le
On Mon, 29 Nov 2010 21:26:23 -0800, Dan Stromberg wrote:
> Does anyone know what I need to do to read filenames from stdin with
> Python 3.1 and subsequently open them, when some of those filenames
> include characters with their high bit set?
Use "bytes" rather than "str". Everywhere. This means
On Tue, 30 Nov 2010 18:53:14 +0100, Peter Otten wrote:
>> I think this is wrong. In Unix there is no concept of filename
>> encoding. Filenames can have any arbitrary set of bytes (except '/' and
>> '\0'). But the filesystem itself neither knows nor cares about
>> encoding.
>
> I think you mi
On Wed, 01 Dec 2010 02:14:09 +, MRAB wrote:
> If the filenames are to be shown to a user then there needs to be a
> mapping between bytes and glyphs. That's an encoding. If different
> users use different encodings then exchange of textual data becomes
> difficult.
OTOH, the exchange of binar
On Wed, 01 Dec 2010 10:34:24 +0100, Peter Otten wrote:
>> Python 3.x's decision to treat filenames (and environment variables) as
>> text even on Unix is, in short, a bug. One which, IMNSHO, will mean that
>> Python 2.x is still around when Python 4 is released.
>
> For filenames in Python 3 the
On Thu, 02 Dec 2010 07:28:30 +, Harishankar wrote:
> When I run pychecker through my modules I get the message that
> comparisons with "False" is not necessary and that it might yield
> unexpected results.
>
> Yet in some situations I need to specifically check whether False was
> returned
On Thu, 02 Dec 2010 12:17:53 +0100, Peter Otten wrote:
>> This was actually a critical flaw in Python 3.0, as it meant that
>> filenames which weren't valid in the locale's encoding simply couldn't be
>> passed via argv or environ. 3.1 fixed this using the "surrogateescape"
>> encoding, so now it'
On Thu, 02 Dec 2010 03:12:42 -0800, yegorov-p wrote:
> I have sniffed some packet and now I would like to send it with the
> help of python.
> But for some reason python send that:
> As you can see, python ignores my headers and creates its own.
It isn't Python doing that, but the OS. At least
On Mon, 06 Dec 2010 08:32:18 -0500, Mel wrote:
> Apparently, at the end of his research, Alan Turing was trying out the idea
> of 'oracles', where a computable process would have access to an
> uncomputable process to get particular results. I would imagine that the
> idea here was to clarify
Rob Randall wrote:
> I am trying to understand how much memory is available to a 64 bit python
> process running under Windows XP 64 bit.
>
> When I run tests just creating a series of large dictionaries containing
> string keys and float values I do not seem to be able to grow the process
> bey
On Fri, 10 Dec 2010 11:51:44 -0800, Ross wrote:
> Since I can't control the encoding of the input file that users
> submit, how to I get past this? How do I make such comparisons be
> True?
On Fri, 10 Dec 2010 12:07:19 -0800, Ross wrote:
> I found I could import codecs that allow me to read the
On Sat, 11 Dec 2010 12:04:01 -0500, Roy Smith wrote:
> I just wrote an annoying little piece of code:
>
> try:
> os.unlink("file")
> except OSError:
>pass
>
> The point being I want to make sure the file is gone, but am not sure if
> it exists currently. Essentially, I want to do what "
On Fri, Dec 17, 2010 at 17:57, Sebastian Alonso wrote:
> Hey everyone, I'm working on a script which uses subprocess to launch a
> bunch of installers, but I'm getting problems with .msi installers
> although .exe ones work fine. The output I get is this:
>
import subprocess
p = subproce
On Wed, 22 Dec 2010 23:54:34 +0100, Stefan Sonnenberg-Carstens wrote:
> Normally (what is normal, anyway?) such files are auto-generated,
> and are something that has a apparent similarity with a database query
> result, encapsuled in xml.
> Most of the time the structure is same for every "row"
On Wed, 22 Dec 2010 15:49:31 -0800, Dan Stromberg wrote:
> def generator():
> i = 0
> while True:
> yield i
> i += 1
Shorter version:
from itertools import count as generator
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 25 Dec 2010 14:41:29 -0500, Roy Smith wrote:
>> XML works extremely well for large datasets.
One advantage it has over many legacy formats is that there are no
inherent 2^31/2^32 limitations. Many binary formats inherently cannot
support files larger than 2GiB or 4Gib due to the use of 32
On Sun, 26 Dec 2010 01:05:53 +, Tim Harig wrote:
>> XML is typically processed sequentially, so you don't need to create a
>> decompressed copy of the file before you start processing it.
>
> Sometimes XML is processed sequentially. When the markup footprint is
> large enough it must be. Qu
On Thu, 30 Dec 2010 13:46:35 -0800, harijay wrote:
> Each Thread receives a dynamically generated shell script from some
> classes I wrote and then runs the script using
>
> subprocess.call(["shell_script_file.sh"])
> But I get the same "OSError: [Errno 26] Text file busy" error
"Text file bus
On Tue, 04 Jan 2011 12:20:42 -0800, Google Poster wrote:
> The indentation-as-block is unique,
Not at all. It's also used in occam, Miranda, Haskell and F#.
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 01 Feb 2011 08:30:19 +, John O'Hagan wrote:
> I can't keep reading because that will block - there won't be any more
> output until I send some input, and I don't want it in any case.
>
> To try to fix this I added:
>
> proc.stdout = os.path.devnull
>
> which has the effect of stopp
On Thu, 03 Feb 2011 06:31:49 +, Steven D'Aprano wrote:
> On Wed, 02 Feb 2011 20:46:12 -0800, harryos wrote:
>
>> In windows ,I tried this
>>
>> p1 = "C:\Users\me\Documents"
>> p2 = "..\Pictures\images\my.jpg"
Don't do this; backslash is significant within Python string literals. If
want to
On Fri, 04 Feb 2011 15:48:55 +, John O'Hagan wrote:
> But I'm still a little curious as to why even unsuccessfully attempting to
> reassign stdout seems to stop the pipe buffer from filling up.
It doesn't. If the server continues to run, then it's ignoring/handling
both SIGPIPE and the EPIPE
On Thu, 10 Feb 2011 08:35:24 +, John O'Hagan wrote:
>> > But I'm still a little curious as to why even unsuccessfully attempting
>> > to reassign stdout seems to stop the pipe buffer from filling up.
>>
>> It doesn't. If the server continues to run, then it's ignoring/handling
>> both SIGPIPE
On Thu, 17 Feb 2011 01:47:10 +0100, Alexander Kapps wrote:
>> Having said that I'm possibly arriving at the conclusion that a quick
>> perl script might be the simplest/easiest and most secure option - I
>> read perl includes code to safely run suid perl scripts - will dig out
>> my perl tomes.
>
On Fri, 18 Feb 2011 07:23:35 -0800, Tim wrote:
> When LaTeX encounters a problem it stops processing, asks the user
> what to do (like abort/retry, kind-of), and does whatever the user
> says. The daemon.py script handles that okay from the command line,
> but if I'm understanding you this will be
On Tue, 22 Feb 2011 19:34:21 -0800, moerchendiser2k3 wrote:
> Hi, I embedded Py2.6.1 in my app and I use UTF-8 encoded strings
> everywhere in the interface, so the interface between my app and
> Python is UTF-8 so I can simply write:
>
> print u"\uC042"
> print u"\uC042".encode("utf_8")
>
> and
On Wed, 23 Feb 2011 04:14:29 -0800, Chris Rebert wrote:
>> Ok, but that the interface handles UTF-8 strings
>> are still ok? The defaultencoding is still ascii.
>
> Yes, that's fine. UTF-8 is an excellent encoding choice, and
> encoding/decoding should always be done explicitly in Python, so the
On Wed, 07 Apr 2010 18:25:36 -0700, Patrick Maupin wrote:
>> Regular expressions != Parsers
>
> True, but lots of parsers *use* regular expressions in their
> tokenizers. In fact, if you have a pure Python parser, you can often
> get huge performance gains by rearranging your code slightly so th
On Tue, 04 May 2010 23:02:29 +1000, Charles wrote:
> I am by no means an expert in this area, but what I think happens (and I
> may well be wrong) is that the directory is deleted on the file system.
> The link from the parent is removed, and the parent's link count is
> decremented, as you observ
On Tue, 04 May 2010 20:08:36 +1200, Gregory Ewing wrote:
>> except that Python objects can form a generalized graph, and Unix
>> filesystems are constrained to be a tree.
>
> Actually I believe that root is allowed to create arbitrary hard links to
> directories in Unix, so it's possible to turn
On Mon, 03 May 2010 06:18:55 -0700, Chris Rebert wrote:
>> but how can python determine the
>> parent directory of a directory that no longer exists?
>
> Whether or not /home/baz/tmp/xxx/ exists, we know from the very structure
> and properties of directory paths that its parent directory is, *by
On Tue, 04 May 2010 14:36:06 +0100, Baz Walter wrote:
> this will work so long as the file is in a part of the filesystem that can
> be traversed from the current directory to the root. what i'm not sure
> about is whether it's possible to cross filesystem boundaries using this
> kind of technique
On May 4, 2010, at 5:37 PM, [email protected] wrote:
> Is there a way to exclusively lock a file to prevent other processes
> from reading it while we have it open?
> My environment is Python 2.6.4 (32-bit) under Windows, but I'm looking
> for a cross-platform solution if that's possible.
Some
On Wed, 05 May 2010 02:41:09 +0100, Baz Walter wrote:
> i think the algorithm also can't guarantee the intended result when
> crossing filesystem boundaries. IIUC, a stat() call on the root directory
> of a mounted filesystem will give the same inode number as its parent.
Nope; it will have the s
On Wed, 05 May 2010 13:23:03 +0100, Baz Walter wrote:
>>> so
>>> if several filesystems are mounted in the same parent directory, there is
>>> no way to tell which of them is the "right" one.
>>
>> The only case which would cause a problem here is if you mount the same
>> device on two different s
On Thu, 06 May 2010 10:21:45 +1000, Cameron Simpson wrote:
> Look at the st_rdev field (== the device holding this inode).
> When that changes, you've crossed a mount mount point.
st_dev reports the device on which the inode resides.
st_rdev is only meaningul if the inode type is block device (S
On Tue, 11 May 2010 00:24:22 +1200, Samuel Williams wrote:
> Is Python a functional programming language?
Not in any meaningful sense of the term.
> Is this a paradigm that is well supported by both the language syntax and
> the general programming APIs?
No.
> I heard that lambdas were limited
On Tue, 11 May 2010 17:48:41 +1200, Lawrence D'Oliveiro wrote:
>> I was working with regex on a very large text, really large but I have
>> time constrained.
>
> “Fast regex” is a contradiction in terms.
Not at all. A properly-written regexp engine will be limited only by
memory bandwidth, provi
On Tue, 11 May 2010 07:36:30 -0700, Paul Rubin wrote:
> Offhand I can't tell that imperative and procedural mean something
> different. Both basically mean that the programmer specifies a series of
> steps for the computer to carry out. Functional languages are mostly
> declarative; for example,
On Tue, 11 May 2010 23:13:10 +1200, Lawrence D'Oliveiro wrote:
>> But the beauty is that Python is multi-paradigm ...
>
> The trouble with “multi-paradigm” is that it offends the zealots on
> all sides.
Is that how you view people who like languages to exhibit a degree of
consistency? Some peopl
On Tue, 11 May 2010 18:31:03 -0700, Paul Rubin wrote:
>>> is called an "equation" rather than an "assignment". It declares "x is
>>> equal to 3", rather than directing x to be set to 3. If someplace else
>>> in the program you say "x = 4", that is an error, normally caught by
>>> the compiler, s
On Thu, 13 May 2010 12:29:08 +1200, Lawrence D'Oliveiro wrote:
>> Some people would prefer to have a manageable set of rules rather than
>> having to remember the results of all of the possible combinations of
>> interactions between language features.
>
> What are you accusing Python of, exactly
On Fri, 14 May 2010 10:50:49 -0400, J wrote:
> someone smarter than me can correct me, but file.write() will write when
> it's buffer is filled, or close() or flush() are called.
And, in all probability, seek() will either flush it immediately or cause
the next write() to flush it before writing
On Fri, 14 May 2010 18:38:55 -0400, J wrote:
>>> someone smarter than me can correct me, but file.write() will write when
>>> it's buffer is filled, or close() or flush() are called.
>>
>> And, in all probability, seek() will either flush it immediately or cause
>> the next write() to flush it bef
On Sat, 22 May 2010 17:16:40 -0700, Lanny wrote:
> Ideally roomlist['start_room'].exits would equal {'aux_room' : 'west',
> 'second_room' : 'north'} but it doesn't. Sorry if this is unclear or too
> long, but I'm really stumped why it is giving bad output
Just to condense a point which the other
401 - 500 of 721 matches
Mail list logo