Re: How to run self-contained Python scripts who don't need Python installation?

2017-06-09 Thread Akira Li
"Juan C." writes: > I need to run some Python 3.6.0 scripts on the users' machines (W7 and > W10) in an enterprise environment, but I can't install Python on those > machines. I tried looking for those "py to exe", but sadly they don't > support Python 3.6.0. I've tried PyInstaller (development

Re: Is An Element of a Sequence an Object?

2017-06-04 Thread Akira Li
Jon Forrest writes: > I'm learning about Python. A book I'm reading about it > says "... > a string in Python is a sequence. correct. > A sequence is an ordered collection of objects". correct. https://docs.python.org/3/glossary.html#term-sequence > This implies that each character in a strin

Re: Transitioning from Linux to Windows

2017-06-04 Thread Akira Li
chitt...@uah.edu writes: > ... > Ideally, I would like to set up the user on their Windows 7/10 system > so that they can "login" to the ubuntu system (say putty) - change > working directory (to where desired) - run the script (on the ubuntu > system) - and scp the file back to the windows deskto

Re: Top Python Interview Questions

2017-05-26 Thread Akira Li
Terry Reedy writes: > On 5/26/2017 1:03 AM, Aarusha wrote: >> PYTHON INTERVIEW QUESTIONS >> >> Mindmajix has compiled Python Interview questions which would >> benefit the learners to attend the Python interviews. >> >> Q. How is Python executed? > > It depends on the implementation (interpreter

Re: User Interface Suggestions? (newbie)

2016-10-05 Thread Akira Li
Beverly Howard writes: >...snip... > A primary question would be, "What are options for building a display > that would update displayed values without scrolling?" To rewrite only the last character, you could use '\b': import os import itertools import time for c in map(str.encode, ite

Re: Interacting with Subprocesses

2016-05-04 Thread Akira Li
Terry Reedy writes: > On 5/4/2016 2:41 PM, Dick Holmes wrote: >> I am attempting to write a Python program that will interact with >> a (non-Python) process. The programs will run under MinGW. The >> process can use stdin/stdout commands and responses and can work >> with pipes. The problem I'm h

Re: Interacting with Subprocesses

2016-05-04 Thread Akira Li
s are redirected. See http://pexpect.readthedocs.io/en/stable/FAQ.html#whynotpipe btw, If pexpect module works in MingGW environment (if pty is available); you could try it to communicate with the process interactively. You might also find the list of Stackoverflow question related to the subproce

Re: threading bug in strptime

2015-10-06 Thread Akira Li
Larry Martell writes: > We have been trying to figure out an intermittent problem where a > thread would fail with this: > > AttributeError: 'module' object has no attribute '_strptime' > > Even though we were importing datetime. After much banging our heads > against the wall, we found this: > >

Re: Idiosyncratic python

2015-09-24 Thread Akira Li
Mark Lawrence writes: > On 24/09/2015 07:02, Steven D'Aprano wrote: >> I was looking at an in-house code base today, and the author seems to have a >> rather idiosyncratic approach to Python. For example: >> >> for k, v in mydict.items(): >> del(k) >> ... >> >> instead of the more obvio

Re: Modify environment variable for subprocess

2015-09-23 Thread Akira Li
loial writes: > I need to modify the LIBPATH environment variable when running a > process via subprocess, but otherwise retain the existing environment. > > Whats the best way to do that? Pass env=dict(os.environ, LIBPATH=value) parameter: import os import subprocess subprocess.check

Re: A little test for you Guys😜

2015-09-22 Thread Akira Li
Python_Teacher via Python-list writes: ... > Let's define the function plural : > > def plural(words): > plurals = [] > for word in words: >plurals.append(word + 's') > return plurals > > for word in plural(['cabagge','owl','toy']): > print word plural() should accept a s

Re: Lightwight socket IO wrapper

2015-09-20 Thread Akira Li
"James Harris" writes: ... > There are a few things and more crop up as time goes on. For example, > over TCP it would be helpful to have a function to receive a specific > number of bytes or one to read bytes until reaching a certain > delimiter such as newline or zero or space etc. The answer

Re: Lightwight socket IO wrapper

2015-09-20 Thread Akira Li
"James Harris" writes: > I guess there have been many attempts to make socket IO easier to > handle and a good number of those have been in Python. > > The trouble with trying to improve something which is already well > designed (and conciously left as is) is that the so-called improvement > can

Re: Shutting down a cross-platform multithreaded app

2015-09-18 Thread Akira Li
"James Harris" writes: ... > Needless to say, on a test Windows machine AF_UNIX is not present. The > only cross-platform option, therefore, seems to be to use each > subthread's select()s to monitor two AF_INET sockets: the one to the > client and a control one from the master thread. I would se

Re: Terminology: "reference" versus "pointer"

2015-09-14 Thread Akira Li
Ned Batchelder writes: > On Monday, September 14, 2015 at 3:32:46 PM UTC-4, Akira Li wrote: >> Ned Batchelder writes: >> ... >> > What do you feel is missing from Steven's diagram? >> >> I don't feel anything missing because I don't expect th

Re: Terminology: "reference" versus "pointer"

2015-09-14 Thread Akira Li
Ned Batchelder writes: ... > What do you feel is missing from Steven's diagram? I don't feel anything missing because I don't expect the model to be more detailed. -- https://mail.python.org/mailman/listinfo/python-list

Re: Terminology: "reference" versus "pointer"

2015-09-14 Thread Akira Li
Random832 writes: > On Mon, Sep 14, 2015, at 13:45, Akira Li wrote: >>[box + arrow pointing to] + object == parcel tag + object > > The problem is that if there are multiple namespaces, or if you've also > got to include references from within other objects such as lis

Re: Terminology: "reference" versus "pointer"

2015-09-14 Thread Akira Li
Random832 writes: > On Mon, Sep 14, 2015, at 10:48, Akira Li wrote: >> start, stop, step attributes (corresponding Python ints) may not exist >> ("the objects we've talking about have never been created") until you >> request them explicitly. > > That

Re: Terminology: "reference" versus "pointer"

2015-09-14 Thread Akira Li
Steven D'Aprano writes: > On Mon, 14 Sep 2015 01:23 pm, Akira Li wrote: > >> Steven D'Aprano writes: >> >>> On Mon, 14 Sep 2015 11:22 am, Akira Li wrote: >>>> Look at the last example: >>>> http://thread.gmane.org/gmane.comp.python

Re: Terminology: "reference" versus "pointer"

2015-09-14 Thread Akira Li
Random832 writes: ... > Why can't it describe range(1)? A range object in my model would include > the start, stop, and step; _not_ the contents of what you would get by > iterating over it; since that's not part of the physical structure of > the object, but the consequences of calling methods on

Re: Terminology: "reference" versus "pointer"

2015-09-13 Thread Akira Li
Steven D'Aprano writes: > On Mon, 14 Sep 2015 11:22 am, Akira Li wrote: >> Look at the last example: >> http://thread.gmane.org/gmane.comp.python.general/782626/focus=782704 > > > I'm afraid that page is broken in my browser. Can you not summarise, or link &

Re: Terminology: "reference" versus "pointer"

2015-09-13 Thread Akira Li
Chris Angelico writes: > On Mon, Sep 14, 2015 at 11:22 AM, Akira Li <4kir4...@gmail.com> wrote: >> Steven D'Aprano writes: >> >>> On Mon, 14 Sep 2015 09:17 am, Akira Li wrote: >>> >>>> I don't see why the model that can

Re: Terminology: "reference" versus "pointer"

2015-09-13 Thread Akira Li
Steven D'Aprano writes: > On Mon, 14 Sep 2015 09:17 am, Akira Li wrote: > >> I don't see why the model that can't describe range(1) in Python 3 >> pretends to be complete. > > > Please explain. > > range(1) returns a range instance. What is

Re: Terminology: "reference" versus "pointer"

2015-09-13 Thread Akira Li
Chris Angelico writes: > On Mon, Sep 14, 2015 at 9:17 AM, Akira Li <4kir4...@gmail.com> wrote: >> If you mean this quote from [1]: >> >> Although we commonly refer to "variables" even in Python (because it's >> common terminology), we real

Re: Terminology: "reference" versus "pointer"

2015-09-13 Thread Akira Li
Random832 writes: > Akira Li <4kir4...@gmail.com> writes: >> I'm not sure what "parcel tags" model is but if you mean these >> pictures[1] than it works in this case as well as any other (take *a*, >> *b* nametags, put them on the correspondin

Re: Terminology: "reference" versus "pointer"

2015-09-13 Thread Akira Li
Random832 writes: > Akira Li <4kir4...@gmail.com> writes: >>Rustom Mody writes: >>> viz. I have two variables (or names!) say a and b which look the same >>>>>> a >>> [[1,2],[1,2]] >>>>>> b >>> [[1,2],[1,2]] &

Re: Terminology: "reference" versus "pointer"

2015-09-12 Thread Akira Li
Rustom Mody writes: > On Saturday, September 12, 2015 at 11:26:18 PM UTC+5:30, Akira Li wrote: >> Rustom Mody writes: >> >> > On Saturday, September 12, 2015 at 8:11:49 PM UTC+5:30, Laura Creighton >> > wrote: >> >> In a message of Sat, 1

Re: Are there any "correct" implementations of tzinfo?

2015-09-12 Thread Akira Li
Random832 writes: > I was trying to find out how arithmetic on aware datetimes is "supposed > to" work, and tested with pytz. When I posted asking why it behaves this > way I was told that pytz doesn't behave correctly according to the way > the API was designed. The tzlocal module, on the other

Re: Terminology: "reference" versus "pointer"

2015-09-12 Thread Akira Li
Rustom Mody writes: > On Saturday, September 12, 2015 at 8:11:49 PM UTC+5:30, Laura Creighton wrote: >> In a message of Sat, 12 Sep 2015 05:46:35 -0700, Rustom Mody writes: >> >How about lay-English ontology in which "point to" and "refer to" are fairly >> >synonymous? >> >> This I have found is

Re: Context-aware return

2015-09-10 Thread Akira Li
Grant Edwards writes: > On 2015-09-10, Steven D'Aprano wrote: > >> I have a function which is intended for use at the interactive interpreter, >> but may sometimes be used non-interactively. I wish to change it's output >> depending on the context of how it is being called. > > [...] > > Sounds

Re: Python handles globals badly.

2015-09-08 Thread Akira Li
Vladimir Ignatov writes: >>> I had some experience programming in Lua and I'd say - that language >>> is bad example to follow. >>> Indexes start with 1 (I am not kidding) >> >> What is so bad about that? > > It's different from the rest 99.9% of languages for no particular reason. > > ( => perf

Re: passing double quotes in subprocess

2015-09-08 Thread Akira Li
loial writes: > I need to execute an external shell script via subprocess on Linux. > > One of the parameters needs to be passed inside double quotes > > But the double quotes do not appear to be passed to the script > > I am using : > > myscript = '/home/john/myscript' > commandline = myscript

Re: asyncio, coroutines, etc. and simultaneous execution

2015-08-23 Thread Akira Li
Charles Hixson writes: > If I understand correctly asyncio, coroutines, etc. (and, of course, > Threads) are not simultaneously executed, and that if one wants that > one must still use multiprocessing. But I'm not sure. The note is > still there at the start of threading, so I'm pretty sure ab

Re: Sandboxing Python

2015-08-23 Thread Akira Li
Mark Lawrence writes: > I was always led to believe that the subject was a difficult thing to > do, but here > https://www.reddit.com/r/learnpython/comments/3huz4x/how_to_do_math_inside_raw_input/ > is a safe solution in only 23 characters, or are there any discernable > flaws in it? Related: h

Re: Who uses IDLE -- please answer if you ever do, know, or teach

2015-08-07 Thread Akira Li
Terry Reedy writes: > There have been discussions, such as today on Idle-sig , about who > uses Idle and who we should design it for. If you use Idle in any > way, or know of or teach classes using Idle, please answer as many of > the questions below as you are willing, and as are appropriate >

Re: Convert between timezones

2015-07-31 Thread Akira Li
Thomas 'PointedEars' Lahn writes: > [X-Post & F'up2 comp.unix.shell] > > Chris Angelico wrote: > >> On Fri, Jul 31, 2015 at 6:15 PM, Cameron Simpson wrote: >>> Actually, bash has no timezone support but the date command _does_, and >>> probably neither better nor worse than Python. All one has t

Re: Matplotlib X-axis timezone trouble

2015-07-03 Thread Akira Li
Peter Pearson writes: > The following code produces a plot with a line running from (9:30, 0) to > (10:30, 1), not from (8:30, 0) to (9:30, 1) as I desire. > > If I use timezone None instead of pacific, the plot is as desired, but > of course that doesn't solve the general problem of which this i

Re: Simple background sound effect playback

2014-12-21 Thread Akira Li
but it won't be simple to configure. If you know other library that provides similar feature list while being less complex; do tell. -- Akira. -- https://mail.python.org/mailman/listinfo/python-list

Re: Creating interactive command-line Python app?

2014-12-13 Thread Akira Li
2exe, etc allow to create a standalone distribution i.e., you could ship your executable with a bundled Python interpreter. -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: How to make subprocess run for 60 sec?

2014-12-12 Thread Akira Li
sleep for n seconds whether the subprocess > takes that long or not. The answer on StackOverflow [1] shows how to avoid waiting n seconds if the subprocess finishes sooner. [1] http://stackoverflow.com/questions/27443480/how-to-make-subprocess-run-for-60-sec > If you just want a program that does this, and it doesn't have to be > in Python, you might try > http://stromberg.dnsalias.org/~strombrg/maxtime.html > It's in C, and is the product of considerable real-world use. It > exits almost immediately after its subprocess exits, FWIW. -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: time.monotonic() roll over

2014-12-05 Thread Akira Li
ock_nanosleep()) that allows us to choose whether we need a relative delay (e.g., kill a subprocess if it hasn't finished in 10 seconds) or an absolute deadline (e.g., these lights should be on 9pm-6am local time). *Both* use cases are valid. -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: time.monotonic() roll over

2014-12-04 Thread Akira Li
from power management" use case - corporations's computations are mostly virtualized -- possible "ressurected", "migrated" use case i.e., the opposite might be true -- non-virtualized PCs connected to AC are (becoming) minority. -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: Do you like the current design of python.org?

2014-12-04 Thread Akira Li
trade black friday > and cyber monkey sales for a box with a good old error message? I see that pythondotorg accepts pull requests and allows to report issues. https://github.com/python/pythondotorg -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: Iterate over text file, discarding some lines via context manager

2014-11-28 Thread Akira Li
g(line) > > This makes interesting_lines a pure filter, and doesn't care what sort > of sequence of strings it's operating on. This makes it easier to > test, and more flexible. The caller's code is also clearer in my > opinion. > > BTW: this example is taken verbatim from my PyCon presentation on > iteration, it you are interested: > http://nedbatchelder.com/text/iter.html The conditions could be combined in this case: def iter_rows(lines): for line in lines: items = line.split() if items and not items[0].startswith('#'): yield items # space-separated non-emtpy non-comment items with open(filename): for items in iter_rows(file): process(items) -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: Asyncio problem, looking for advice.

2014-11-28 Thread Akira Li
Benjamin Risher writes: > On Friday, November 28, 2014 6:12:20 AM UTC-6, Akira Li wrote: >> Benjamin Risher writes: >> >> > Hello all, >> > >> > I'm working on a project to learn asyncio and network programming. >> > What I'm try

Re: localization virt-manager

2014-11-28 Thread Akira Li
.UTF-8 some-program I don't know whether LANG has any meaning on Windows. [1] http://pubs.opengroup.org/onlinepubs/007908799/xbd/envvar.html -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: Asyncio problem, looking for advice.

2014-11-28 Thread Akira Li
in range(2): try: loop.run_until_complete(server.wait_closed()) except KeyboardInterrupt: if not closing: server.close() info('closing server') else: break info('done') loop.close() [1] https://docs.python.org/3/library/asyncio-task.html#example-parallel-execution-of-tasks [2] http://pastebin.com/g08YaJyz -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: Curious function argument

2014-11-27 Thread Akira Li
eed to define a class to create objects, in other cases a function is enough (and of course functions are objects too in Python). [1] http://stackoverflow.com/questions/13857/can-you-explain-closures-as-they-relate-to-python -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: html page mail link to webmail program

2014-11-27 Thread Akira Li
> passed to it, and, if not too much more, move the cursor to the > subject field. > > Surely this can be done in Python. > Related question: http://stackoverflow.com/questions/14288177/interact-with-other-programs-using-python -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: Moving a window on the screen

2014-11-08 Thread Akira Li
Terry Reedy writes: > On 11/8/2014 11:35 AM, Akira Li wrote: >> "ast" writes: >> >>> Ok, thx, it works now with: >>> >>> import tkinter >>> fen = tkinter.Tk() >>> >>> x=0 >>> >>> def moveW(): >

Re: Moving a window on the screen

2014-11-08 Thread Akira Li
ove at a time root.after(period - period % timer(), call_repeatedly, period, move, delta_x, root.winfo_screenwidth()) root.mainloop() [1]: http://stackoverflow.com/questions/8600161/executing-periodic-actions-in-python#comment26637231_8600301 [2]: http://stackoverflow.com/questions/24

Re: Challenge: optimizing isqrt

2014-11-01 Thread Akira Li
o you want to use your optimized isqrt(i)? There could be specialized algorithms that work only in narrow specific circumstances e.g., the inverse square root (1/sqrt(x)) implementation from Quake III Arena that has 0x5f3759df constant in it (only of historical interest now). If you want to work with very large (thousands, millions of digits) integers then gmp library might be faster then the default Python integer implementation. -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: Emulating py2exe for python version 3 and above

2014-10-31 Thread Akira Li
ial pygame's Windows installers for Python 3 at http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: Saving a file "in the background" -- How?

2014-10-31 Thread Akira Li
new data or it fails and 'backup' contains untouched ready-to-restore old data -- nothing in between. [1]: https://github.com/mitsuhiko/python-atomicfile/blob/master/atomicfile.py I don't know how ready atomicfile.py but you should be aware of the issues it is trying to solve if you want a reliable backup solution. -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: Timezones

2014-10-05 Thread Akira Li
/epochtime.html [4] http://www.ucolick.org/~sla/leapsecs/deltat.html -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: GCD in Fractions

2014-09-25 Thread Akira Li
at you are *too observant* because I've noticed that the order of the letters is different just now. http://english.stackexchange.com/questions/8628/is-it-true-that-only-the-positions-of-the-first-and-last-letter-in-a-word-matter [spoiler: it is not true in general but brains can do a lot of "error-correction" subconsciously] -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: CSV methodology

2014-09-15 Thread Akira Li
ll, see what's in there. > Tools that are worth mentioning: ipython notebook, pandas For example, http://nbviewer.ipython.org/github/twiecki/financial-analysis-python-tutorial/blob/master/1.%20Pandas%20Basics.ipynb -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: subprocess module usage

2014-09-01 Thread Akira Li
ausing this behavior? Is this expected or is there > something wrong with how I'm using the subprocess module? You shouldn't use shell=True with a list argument (sys.argv[1:] is a list). Specify the command as a string or use shell=False. See http://bugs.python.org/issue21347 -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: Reading from sys.stdin reads the whole file in

2014-08-28 Thread Akira Li
stdin.flush() > sys.stdout.flush() > > Then it works. > > ChrisA It looks like this bug http://bugs.python.org/issue3907 `python -u out.py | python -u slurp.py` could be used to avoid .flush() calls everywhere. Or reassign `sys.stdin = io.open(sys.stdin.fileno(), 'r', 1)`

Re: Media Conversion Using Python - Converting MP3 to Other Formats

2014-08-28 Thread Akira Li
om/vinta/awesome-python#audio Everybody needs to start somewhere. Having said that, a search query: “python mp3” [2] returns useful results for me. [2] https://duckduckgo.com/?q=python+mp3 -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: Efficiency, threading, and concurrent.futures

2014-08-20 Thread Akira Li
t more than one job per worker to ThreadPoolExecutor and avoid waiting for the each result synchronously. I don't know whether ThreadPoolExecutor starts all workers at once in the current CPython implementation. The name max_workers suggests that it may start them as needed. -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: How to look up historical time zones by date and location

2014-08-20 Thread Akira Li
multiple ways to get a timezone name from location [3]. [3] http://stackoverflow.com/questions/16505501/get-timezone-from-city-in-python-django -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: how to copy emails into local directory?

2014-08-20 Thread Akira Li
lbox in my gmail" > into local directory "g:\emails",how can i do that in python code? You could try an already-made application something like *gmvault* instead of implementing the functionality from scratch on top of imaplib. It is easy [1] to create a version that can perform the backup in ideal conditions but it is much harder to take into account all nuances to make it reliable. [1] http://stackoverflow.com/questions/348630/how-can-i-download-all-emails-with-attachments-from-gmail -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: pexpect - logging input AND output

2014-08-20 Thread Akira Li
the correct way to go about this? just can't get the > output! To be clear, expect() doesn't send anything to the device. expect() matches as little as possible therefore '.*:*' matches *nothing*. If it is Python 3 then use pexpect.spawnu(). Otherwise, assigning to child.logfile should work as is. There is a telnetlib module in stdlib. x/84 python telnet server might contain a client too. -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: how to change the time string into number?

2014-08-20 Thread Akira Li
,"Aug","Sep","Oct","Nov","Dec" ) month_number = months.index(month_abbr) # month_abbr == "Aug" Note: - time.strptime(month_abbr, "%b").tm_mon may fail in non-English locale - list(calendar.month_abbr).index(month_abbr) is also locale-specific -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: Test for an empty directory that could be very large if it is not empty?

2014-08-07 Thread Akira Li
s.listdir('C:/Test')) when > it is not empty? def is_empty_dir(dirpath): return next(scandir(dirpath), None) is None https://github.com/benhoyt/scandir -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Akira Li
ou need to add colors and move text in a terminal. It claims that it also supports colors on Windows if used with colorama. [3] https://pypi.python.org/pypi/blessings/ -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: Correct type for a simple "bag of attributes" namespace object

2014-08-03 Thread Akira Li
>> employee.position = "Python programmer" You could write it as: class Employee: name = "Johh Doe" position = "Python programmer" It also makes it clear that `type()` returns a *class Employee*, not its instance (Employee()) and therefore name, position are class attributes. -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: converting ISO8601 date and time string representations to datetime

2014-08-01 Thread Akira Li
some custom subset of ISO 8601. There is rfc 3339 [1] that describes a profile of the ISO 8601 standard. rfc 3339 combines human readability with the simplicity of machine parsing. [1] http://tools.ietf.org/html/rfc3339 -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: Bug with help (was Re: Getting a list of all modules)

2014-08-01 Thread Akira Li
Mark Lawrence writes: > On 31/07/2014 19:55, Akira Li wrote: >> Steven D'Aprano writes: >> >>> I'm looking for a programmatic way to get a list of all Python modules >>> and packages. Not just those already imported, but all those which >>

Re: What is best way to learn Python for advanced developer?

2014-07-31 Thread Akira Li
ww.reddit.com/r/learnpython/comments/1huuqk/im_doing_100_projects_in_python_to_learn_the Personal: learn both Python 2 & 3. -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: Getting a list of all modules

2014-07-31 Thread Akira Li
tp://stackoverflow.com/questions/3952513/python-get-available-modules -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: How to index an array with even steps?

2014-07-25 Thread Akira Li
..., 995] # Python 2 range(0, 1000, 5)# Python 3 -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: Unicode, stdout, and stderr

2014-07-22 Thread Akira Li
t; print(ascii('\u2119')) '\u2119' >>> '\u2119' 'ℙ' >>> repr('\u2119') "'ℙ'" >>> ascii('\u2119') "'\\u2119'" On Windows, try https://pypi.python.org/pypi/win_unicode_console C:\> pip install win-unicode-console C:\> py -i -m run It is alpha but your feedback may improve it https://github.com/Drekin/win-unicode-console/issues If you could also use a GUI console e.g.: C:\> py -3 -m idlelib Or http://ipython.org/notebook.html There are many other IDEs for Python e.g., http://stackoverflow.com/q/81584/what-ide-to-use-for-python -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: Multiple python versions, one dev environment???

2014-07-17 Thread Akira
Joep van Delft wrote: > Hello! > > The condensed version of the question would probably be: How does one > deal with multiple interpreters and one package where you want to try > some changes? You could use tox to test a package using different Python versions. -- A

Re: OOP with MyTime

2014-07-02 Thread Akira Li
uot;" return self._astuple() == other._astuple() See https://docs.python.org/3/library/functools.html#functools.total_ordering Example: >>> MyTime(1).inbetween(MyTime(0), MyTime(2)) True It is equivalent to: >>> MyTime(0) <= MyTime(1) < MyTime(2) True -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: How to get Timezone from latitude/longitude ?

2014-06-25 Thread Akira Li
le.net/tz map or use an online service instead http://stackoverflow.com/a/16519004 -- akira -- https://mail.python.org/mailman/listinfo/python-list

Re: asyncio: wrapping a subprocess in a server

2014-06-25 Thread Akira Li
script client <--> websocket <--> twisted server <--> subprocess Do you want the same but using asyncio module? -- Akira -- https://mail.python.org/mailman/listinfo/python-list

Re: Forking PyPI package

2014-06-06 Thread Akira Li
ps://github.com/abbot/pwdhash/issues/new Or better yet, submit a pull request that specifies the license to the standard you need? I've dealt with the author in the past. I see no reason, he would refuse to accept PR if license=BSD in setup.py is not enough. -- akira -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3.2 has some deadly infection

2014-06-06 Thread Akira Li
1] and Unicode collation algorithm http://www.unicode.org/reports/tr10/ concepts is also useful; if you want to work with text. [1]: http://www.unicode.org/reports/tr29/ -- akira -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3.2 has some deadly infection

2014-06-04 Thread Akira Li
uniq -c | sort -rn | sed ${1}q See http://www.leancrew.com/all-this/2011/12/more-shell-less-egg/ Whether or not a pipe is connected to a tty is a small detail. stdin/stdout is about pipes, not consoles. -- akira -- https://mail.python.org/mailman/listinfo/python-list

Re: Segmentation fault (core dumped) while using Cplex Python API

2014-06-01 Thread Akira Li
ied 180 coefficients. > Reduced MIP has 12840 rows, 29800 columns, and 136000 nonzeros. > Reduced MIP has 29800 binaries, 0 generals, 0 SOSs, and 0 indicators. > Presolve time = 0.49 sec. (368.57 ticks) > > I would be grateful if someone can help me fix this. Install and enable

Re: python3; ftplib: TypeError: Can't convert 'bytes' object to str implicitly

2014-05-14 Thread Akira Li
Antoon Pardon writes: > op 14-05-14 18:24, Akira Li schreef: >> Antoon Pardon writes: >> >>> This is the code I run (python 3.3) >>> >>> host = ... >>> user = ... >>> passwd = ... >>> >>> from ftplib import FTP >

Re: httplib with NETRC authentication

2014-05-14 Thread Akira Li
ond '=') Also, make sure that you use the correct case for the username. Userids might be case sensitive. -- akira -- https://mail.python.org/mailman/listinfo/python-list

Re: python3; ftplib: TypeError: Can't convert 'bytes' object to str implicitly

2014-05-14 Thread Akira Li
es' object to str implicitly > > The problem is that I do something like this in a backup program. > I don't know the locales that other people use. So I manipulate > all file and directory names as bytes. > > Am I doing something wrong? The error message shows that ftpl

Re: httplib with NETRC authentication

2014-05-14 Thread Akira Li
its authentication headers. Tip: It won't be "Authorization". "Authorization" is the appropriate header for basic http authentication: http://tools.ietf.org/html/rfc2617#section-2 Here's a code example for urllib2: https://gist.github.com/kennethreitz/973705#comment-56387 -- akira -- https://mail.python.org/mailman/listinfo/python-list

Re: Why is it that *dbm modules don't provide an iterator? (Language design question)

2009-04-11 Thread Akira Kitada
Opened a ticket for this and attached a patch. (experimental) http://bugs.python.org/issue5736 On Fri, Apr 10, 2009 at 8:39 AM, "Martin v. Löwis" wrote: I assumed there were some decisions behind this, rather than it's just not implemented yet. >>> I believe this assumption is wrong - i

Re: Why is it that *dbm modules don't provide an iterator? (Language design question)

2009-04-09 Thread Akira Kitada
keys() returns a list and my question was not about "how to" but more like "why"... I assumed there were some decisions behind this, rather than it's just not implemented yet. Best, On Friday, April 10, 2009, Joshua Kugler wrote: > Akira Kitada wrote: > >&g

Why is it that *dbm modules don't provide an iterator? (Language design question)

2009-04-09 Thread Akira Kitada
Hi, I was wondering why *dbm modules in Python do not give us an iterable interface? Take a look at an example below """ # Python 2.6 >>> import gdbm >>> d = gdbm.open("spam.db", "n") >>> d["key1"] = "ham" >>> d["key2"] = "spam" >>> >>> for k in d: ... print k ... Traceback (most recent call

Re: Performance of Python 3

2009-03-01 Thread Akira Kitada
Is this what you are looking for? http://shootout.alioth.debian.org/u32q/benchmark.php?test=all&lang=python3&lang2=yarv&box=1 On Sun, Mar 1, 2009 at 10:04 PM, Kless wrote: > Does anybody has seen the performance of Python 3? > Respect to speed it's the last language together to Ruby 1.8, but Rub

New book "The Python Programming Language" by Guido van Rossum

2009-02-12 Thread Akira Kitada
The Python Programming Language by Guido van Rossum, Raymond Hettinger, Jack Diedrich, David Beazley, David Mertz, Nicholas Coghlan to be published. http://www.amazon.co.uk/Python-Programming-Language-Guido-Rossum/dp/0132299690 Anyone found the TOC of this? Thanks, -- http://mail.python.org/mailm

Re: python3 tutorial for newbie

2009-02-10 Thread Akira Kitada
http://wiki.python.org/moin/Python3.0Tutorials On Wed, Feb 11, 2009 at 3:22 AM, Gary Wood wrote: > Can someone recommend a good tutorial for Python 3, ideally that has tasks > or assignments at the end of each chapter. > Please, > > -- > http://mail.python.org/mailman/listinfo/python-list > > --

Re: *.python.org broken?

2009-01-25 Thread Akira Kitada
http://downforeveryoneorjustme.com/ On Sun, Jan 25, 2009 at 10:06 AM, wrote: > Hi all, > > Is anybody else having trouble accessing sites (including www, docs, > wiki) in the python.org tree, or is it just me? (Or just .au?) > > Cheers, > > Tim > -- > http://mail.python.org/mailman/listinfo/pyth

Re: Pythonic list/tuple/dict layout?

2009-01-25 Thread Akira Kitada
> These are the only two that follow PEP 8; the others don't have > four-space indent levels. In those examples, the following sentence in PEP 8 would be applied. "Make sure to indent the continued line appropriately." > I actually use this style: > >foo = { >0: 'spam', >1: '

Re: Pythonic list/tuple/dict layout?

2009-01-25 Thread Akira Kitada
> BTW, there's no need to use such large examples. Three items per dict > would be sufficient to illustrate the styles, using ten items doesn't add > anything useful to the discussion. I worried to be told 'you can make it in a line like {"ham": "jam", "spam": "alot"}' ;) -- http://mail.python.org

Re: Pythonic list/tuple/dict layout?

2009-01-25 Thread Akira Kitada
> Wow! A Python debate over curly brace placement! Imagine that! PEP8 even deals with tabs vs spaces, where to put a blank line, etc :) -- http://mail.python.org/mailman/listinfo/python-list

Pythonic list/tuple/dict layout?

2009-01-25 Thread Akira Kitada
Hi, There is more than one way to write a list/tuple/dict in Python, and actually different styles are used in standard library. As a hobgoblin of little minds, I rather like to know which style is considered "Pythonic" in the community. I collected common layout from existing code and pasted the

Can I build Python with lthread instead of pthread?

2008-10-31 Thread Akira Kitada
python with it? Thanks in advance, Akira -- http://mail.python.org/mailman/listinfo/python-list

Re: Cannot build _multiprocessing, math, mmap and readline of Python 2.6 on FreeBSD 4.11 w/ gcc 2.95.4

2008-10-25 Thread Akira Kitada
t;[EMAIL PROTECTED]> wrote: > On 2008-10-25 08:39, Akira Kitada wrote: >> Hi list, >> >> I was trying to build Python 2.6 on FreeBSD 4.11 and found it failed >> to build some of the modules. >> >> """ >> Failed to find the necessary bits

Cannot build _multiprocessing, math, mmap and readline of Python 2.6 on FreeBSD 4.11 w/ gcc 2.95.4

2008-10-24 Thread Akira Kitada
/Python-2.6/Modules/readline.c:216: (Each undeclared identifier is reported only once /usr/home/build/dev/Python-2.6/Modules/readline.c:216: for each function it appears in.) /usr/home/build/dev/Python-2.6/Modules/readline.c:216: syntax error before `)' /usr/home/build/dev/Python-2.6/Modules/readline.c: At top level: /usr/home/build/dev/Python-2.6/Modules/readline.c:669: warning: `on_completion_display_matches_hook' defined but not used """ Because FreeBSD is not listed on http://www.python.org/dev/peps/pep-0011/, I suppose it's still a supported platform. Any help, suggestions would be appreciated. Thanks, Akira -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >