On Sun, Aug 18, 2019 at 12:35:52PM +0800, Thejal Ramesh wrote:
> Hi, i have a question regarding this question. I'm not quite sure what the
> question is asking.
Ask your tutor. We can help you with learning Python the programming
language, not graph theory.
On Wed, Aug 14, 2019 at 09:58:35AM +1000, Cameron Simpson wrote:
> On 11Aug2019 22:58, James Hartley wrote:
> >I am lacking in understanding of the @staticmethod property.
> >Explanation(s)/links might be helpful. I have not found the descriptions
> >found in the Internet wild to be particularly
Part 3.
On Sun, Aug 11, 2019 at 10:58:37PM -0500, James Hartley wrote:
> from collections import namedtuple
>
> class Foo():
> Dimensions = namedtuple('Dimensions', ['height', 'width'])
> _dimensions = Dimensions(3, 4)
>
> def dimensions():
> print('id =
On Thu, Aug 01, 2019 at 05:11:04PM +0800, Sinardy Xing wrote:
> I have error look like in the wrapper.
>
> Can someone point to me where is the issue
No, but you can.
When the error occurs, Python will print a traceback containing a list
of the lines of code being executed, and the final
On Thu, Jul 25, 2019 at 07:04:52PM +, Mahima Daya wrote:
> hi there, please could you assist.
Yes, certainly. If you have questions about Python, you can ask
concrete, specific questions. If you ask vague questions like "please
help" expect to be ignored or told to do your own homework.
Hi Taishi, and welcome.
On Wed, Jul 24, 2019 at 03:21:03AM +, TAISHI KAWAMURA wrote:
[...]
> I'm suspecting that Anaconda might keep raising the error, or simply
> there are bugs in the codes. However, I can't be sure what the real
> cause is.
Almost certainly it will be a bug in your
On Wed, Jul 24, 2019 at 11:26:26AM +1200, David L Neil wrote:
> Clarifying the difference/similarity in appearance between a generator
> expression and a tuple, it might help to think that it is the comma(s)
> which make it a tuple!
David makes an excellent point here. Except for the special
On Tue, Jul 23, 2019 at 10:36:01PM +0530, Animesh Bhadra wrote:
> Hi All,
>
> Need one help in understanding generator expression/comprehensions.
>
> This is my sample code.
Lots of missing spaces in your code! Don't forget to hit the space bar
between words :-)
Also missing indentation,
On Fri, Jul 19, 2019 at 10:44:36PM -0400, C W wrote:
> Hello all,
>
> I have a date time string that looks like the following.
>
> 02015-07-01 00:01:44.538420-08:00
> 12015-07-01 00:27:58.717530-08:00
> 22017-07-01 07:07:48.391376-08:00
I assume that the leading number and spaces "0
On Thu, Jul 18, 2019 at 11:34:09AM -0700, Anirudh Tamsekar wrote:
> My script below is blowing index out of range after adding the args.
> version = sys.argv[1]
> Traceback (most recent call last):
> File "/Users/atamsekar/Projects/PulseSO/trunk/swrelease/samplexls.py",
> line 5, in
>
On Tue, Jul 16, 2019 at 04:29:15PM -0500, James Hartley wrote:
> I ask this having more C++ knowledge than sense.
>
> There is an adage in the halls of everything Stroustrup that one needs to
> think about how resource allocation will be unwound if an exception is
> thrown. This gets watered
On Tue, Jul 16, 2019 at 12:08:10PM +, AHIA Samuel wrote:
> Please what are references in Python development?
x = 19
y = x
The name "x" is a reference to the int 19; the name y is a reference to
the same int.
x = "Hello world"
Now the name "x" is a reference to the string "Hello world". y
On Fri, Jul 12, 2019 at 11:53:16AM +, Shall, Sydney via Tutor wrote:
> Thanks Mike,
>
> But I am still not clear.
Neither is your question.
> do I write:
>
> def f([x,y,z]) ?
> How exactly do one write the function and how does one ensure that each
> positional argument is accounted for.
On Sat, Jul 13, 2019 at 09:59:16AM +1000, Cameron Simpson wrote:
> Mike has probably confused this with tuples. Because tuples are
> delineated with parentheses, there is ambiguity between a tuple's
> parentheses and normal "group these terms together" parentheses.
There are no "tuple
On Fri, Jun 21, 2019 at 10:01:43AM +1000, mhysnm1...@gmail.com wrote:
> I have reviewed the collection module and do not understand mappings. I have
> seen this in other languages and have never got the concept. Can someone
> explain this at a very high level.
It might help if you remember
On Thu, Jun 20, 2019 at 08:39:35PM -0300, Markos wrote:
> Hi,
>
> I'm studying Numpy and I don't understand the difference between
>
> >>>vector_1 = np.array( [ 1,0,1 ] )
>
> with 1 bracket and
>
> >>>vector_2 = np.array( [ [ 1,0,1 ] ] )
>
> with 2 brackets
I'm not really sure what you don't
Hi Sean,
Your subject line says "word printing issue", but the body of your email
says nothing about an issue printing words.
Have you tried print(word)?
Further comments and questions below.
On Thu, Jun 20, 2019 at 08:44:06PM +1000, mhysnm1...@gmail.com wrote:
> I have a list of strings
On Sat, Jun 15, 2019 at 02:53:43PM +1000, mhysnm1...@gmail.com wrote:
> All,
>
>
>
> In C, Perl and other languages. While only uses a conditional statement and
> for uses an iteration. In python while and for seems to be the same and I
> cannot see the difference.
Python ``while`` uses a
On Fri, Jun 14, 2019 at 11:35:53AM +0500, Sijin John wrote:
> I am trying to Download audios & videos using web scraping from news
> website (eg: https://www.bbc.com/news/video_and_audio/headlines) or
> Facebook & I could't. So in real scenario is it really possible to
> download audios/videos
In case you are still confused, we can simplify the whole process by
eliminating the unnecessary use of an external module.
blank = {}
feeds = {}
feeds['a'] = blank
feeds['a'][1] = "Hello"
print(blank)
# will print {1: 'Hello'}
We can see that the dict named "blank" and the dict named
On Tue, Jun 04, 2019 at 11:37:23PM +, nathan tech wrote:
> globals.py:
>
> feeds={}
> blank_feed={}
> blank_feed["checked"]=1
> blank_feed["feed"]=0
That is more easily, and better, written as:
feeds = {}
blank_feed = {"checked": 1, "feed": 0}
> main file:
>
> import globals as g
> #
Hi Sean,
On Sat, Jun 01, 2019 at 12:53:00PM +1000, mhysnm1...@gmail.com wrote:
> I have had a look and cannot find an example where I can interactively edit
> a content of a variable at the command line. I do not want to use GUI at
> all. As this is a simple program only requiring CLI. I have no
On Sun, May 19, 2019 at 10:37:56AM +1000, Steven D'Aprano wrote:
> That's not quite right -- case sensitivity of the OS isn't important,
> case sensitivity of the *file system* is. And the standard file system
> on Mac OS, HFS+, defaults to case-preserving but case-in
On Sat, May 18, 2019 at 11:52:29AM +0100, Alan Gauld via Tutor wrote:
> On 18/05/2019 03:14, Richard Damon wrote:
>
> > The same directory, running the same program under Mac OS X, which also
> > is a case insensitive file system,
>
> That is your mistake. Darwin, the core of the MacOS X system
On Sat, May 18, 2019 at 09:51:39PM +0530, Arup Rakshit wrote:
> Here, why super(Role, self).__init__(**kwargs) is used instead of
> super().__init__(**kwargs) ? What that Role and self argument is
> instructing the super() ?
The Role and self arguments are the owning class and current
Hi Stephen,
My responses are interleaved with your comments below. Please excuse the
length of my post, but your problem is a complicated one.
On Wed, May 15, 2019 at 08:16:02AM -0400, Stephen P. Molnar wrote:
> I am writing scripts to semi-automate some of my Quantum Chemistry
> software and
On Tue, Apr 30, 2019 at 12:47:02AM +0530, Arup Rakshit wrote:
> I really didn't write that code by myself. The day I'll you will not see
> me here everyday :) . I was watching a PyCon video
> https://youtu.be/81S01c9zytE?t=8172 where the author used this code. But
> his explanation is not
On Mon, Apr 29, 2019 at 11:25:51PM +0530, Arup Rakshit wrote:
> Now I am not getting how the __set__() method from NonBlank is being
> called inside the __init__() method. Looks like some magic is going on
> under the hood. Can anyone please explain this how self.name and
> self.email
On Sun, Apr 28, 2019 at 03:00:12PM +1000, Nathan D'Elboux wrote:
> this is a learning exercise for me so how do more experienced python coders
> approach modules like this, when you encounter a module that has sparse
> documentation how do you learn more about the functionality of said module?
>
On Fri, Apr 26, 2019 at 06:18:32PM +0530, Arup Rakshit wrote:
> BTW, one thing I would like to know about this list is that, everytime I
> send an email I see it the in list after 2 hours approx. Is this for me
> or everybody? I am just curious.
Just you, I think.
Looking at the headers of
On Thu, Apr 25, 2019 at 02:52:07PM +0530, Arup Rakshit wrote:
> Here it is: *3.3.2.1. Customizing module attribute access*
> (https://docs.python.org/3/reference/datamodel.html#customizing-module-attribute-access)
Oh! That's brand new in 3.7, no wonder I didn't know about it.
I did see the
On Thu, Apr 25, 2019 at 05:40:18PM +0530, Arup Rakshit wrote:
> I have a small app like this:
Please simplify your code to the minimum needed to demonstrate the
problem you are asking about. This bit is excellent:
> pizza-shop$ tree .
> .
> └── pizzapy
> ├── __init__.py
> ├── menu.py
>
On Thu, Apr 25, 2019 at 10:46:31AM -0700, Roger Lea Scherer wrote:
> with open('somefile') as csvDataFile:
> csvReader = csv.reader(csvDataFile)
> for row in range(100):
> a = "Basic P1"
> str.replace(a, "")
> print(next(csvReader))
I'm not quite sure what you
On Thu, Apr 25, 2019 at 11:30:28AM +0530, Arup Rakshit wrote:
> On 25/04/19 3:52 AM, Alan Gauld via Tutor wrote:
> >On 24/04/2019 12:22, Arup Rakshit wrote:
> >>In the simple code like what are the advantages we get from?
> >I'm not really sure what you are asking about?
>
> Ok. My question is
On Tue, Apr 23, 2019 at 08:22:56PM +0530, Arup Rakshit wrote:
> I read today 2 methods regarding the customizing the attribute
> access:__getattr__ and __getattribute__ from
> https://docs.python.org/3/reference/datamodel.html#special-method-names.
> What I understood about them is that
On Tue, Apr 23, 2019 at 08:27:15PM +0530, Arup Rakshit wrote:
> >You probably want:
> >
> > def __init__(self, list=None):
> > if list is None:
> > list = []
> > self.list = list
>
> That is really a new thing to me. I didn't know. Why list=None in the
>
On Tue, Apr 23, 2019 at 11:46:58AM +0530, Arup Rakshit wrote:
> Hi,
>
> I wrote below 2 classes to explore how __getitem__(self,k) works in
> conjuection with list subscriptions. Both code works. Now my questions
> which way the community encourages more in Python: if isinstance(key,
> slice):
On Sat, Apr 20, 2019 at 04:51:11PM -0400, Ju Bo wrote:
> con = "y"
> while con == "y":
> AMT = float(input("What is the price of the item? $"))
> con = input("Would you like to continue? [y/n]")
> price = float(sum(AMT + AMT))
That's a good first attempt.
Rather than
On Thu, Apr 18, 2019 at 11:18:02AM -0400, Pushkar vaity wrote:
> Hi,
>
> I am using Python 3.7 with anaconda install in PyCharm
> I am trying to traverse some directories using the os module and grab some
> tcl procedures and put the proc names in python dictionary as keys. Values
> are some
On Sat, Mar 30, 2019 at 10:13:16PM -0500, boB Stepp wrote:
> So my main question is how does one know in which Python version a
> deprecated module will be removed? I'm not too concerned about the
> imp module, but _do_ want to know how the removal process works for
> deprecated standard library
> I don't understand this error message. Thank you so much, Glenn Dickerson
>
> Traceback (most recent call last):
> File "/home/glen/app.py", line 1, in
> import Student
> File "/home/glen/Student.py", line 2
> def__init__(self, name, major, gpa, is_on_probation):
>
Hi Glenn, and welcome.
On Fri, Mar 15, 2019 at 09:54:41PM -0400, Glenn Dickerson wrote:
> class Student():
> def__init__(self, name, major, gpa, is_on_probation):
> self.name = name
> self.major = major
> self.gpa = gpa
> self.is_on_probation = is_on_probation
Hi Edward, and welcome.
Please remember that we're volunteers, doing this for free. Unless your
problem is really interesting, you're not likely to get people
volunteering to spend a long time slogging through multiple attachments,
screenshots, at least five seperate attempts, etc.
By the
Sorry, I hit send too quick...
I realise you haven't written a busy loop, but the way you wrote your
scheduler, you can only schedule jobs to the nearest 5 seconds. That's
probably okay for a backup process that might take a few hours to run,
but it is hardly a good solution to things that
On Thu, Feb 28, 2019 at 02:45:59PM +, nathan tech wrote:
> Hi there,
>
> I recently started working on a backup program, and the one big feature
> everyone wants in backup programs is the ability to schedule backups, right?
>
> but I'm thinking, should I do this?
[...]
> Is that wise? Is
On Tue, Feb 26, 2019 at 01:34:33PM -0700, shaef...@q.com wrote:
> I am learning python. I wanted to test my ability by making a program to
> keep track of the flip of a coin to find how many consecutive times it came
> up heads and tails.
Here's how to count the number of times it comes up
On Tue, Feb 26, 2019 at 09:09:56AM +, AdamC wrote:
> def createObjects(f):
> '''Takes a file object and iterates through entries, passing them to
> create
> object, depending on what object it is.'''
> for line in f:
> count = count + 1
This cannot be the code you are
On Wed, Feb 06, 2019 at 02:03:01PM +, beech 48 wrote:
> Hi i am totally new to this, i am not a coder and am lost.
We are coders and we are still lost, because we can't read your mind and
we have no idea what you are talking about.
Instagram? How is that relevant?
You say you are entering
On Thu, Jan 24, 2019 at 03:03:28PM +1100, Riley Harris wrote:
> When I try to install packages in python this error occurs.
Please copy and paste (don't summarise or re-type from memory) the
actual command you are running and the exact error message you receive.
--
Steve
Hi Ello, and welcome!
On Mon, Jan 21, 2019 at 01:14:55AM +0100, Ello Solcraft wrote:
> # currLocation doesn't use the updated variable.
How do you know?
I'm sorry, but it is impossible for me to tell what is going on here.
There simply isn't enough information to understand your code.
We
On Thu, Jan 17, 2019 at 03:05:17PM -0600, David Rock wrote:
> In [7]: nan == nan
> Out[7]: False
>
> In [8]: a = 1.1
>
> In [9]: a ==a
> Out[9]: True
> both a and nan are floats, so why does a == a work, but nan == nan
> doesn’t?
They both "work", because they both do what they are designed
On Thu, Jan 17, 2019 at 09:57:03AM +, Alan Gauld via Tutor wrote:
> The algorithm is probably described somewhere in the documentation
> but my understanding is that it looks something like this(in pdeudo code):
List, tuple and string comparisons are defined as lexicographical order:
On Sun, Jan 13, 2019 at 01:16:10PM +1100, mhysnm1...@gmail.com wrote:
> Issue, following error is generated after trying to sort a list of strings.
>
> description.sort()
> TypeError: unorderable types: float() < str()
That tells you that you don't have a list of strings. You have a list of
On Sat, Jan 12, 2019 at 09:44:21AM -0600, Joseph Gulizia wrote:
> Thanks in advance as I've gotten wordy.
>
> I want to integrate the following working code into a website:
[...]
Start with a simpler question: how would you integrate *any* Python code
into a website?
Few (i.e. no) browsers
On Mon, Jan 07, 2019 at 09:59:31PM +0530, Amit Yadav wrote:
> How can simply typing
>
> print "hello world"
>
> work?
> Like without including any header file or import statements how can it work.
Why shouldn't it work? Python is not C and doesn't use header files.
In Python, the interpreter
On Mon, Jan 07, 2019 at 03:36:01PM +0530, mousumi sahu wrote:
> Dear Sir,
> I am trying to install python 2.7.10 on HPC. Python 2.6 has already been
> install on root. I do not have root authority. Please suggest me how can I
> do this.
What's HPC?
If you don't have root permission, do you have
On Sun, Jan 06, 2019 at 02:14:10PM +, nathan tech wrote:
> My question is, is python really the way to go for game servers?
*shrug*
Do game servers have unique requirements that are different from (say)
mailing list servers and other servers? That's not a rhetorical
question. I don't know
Hello David, and welcome!
On Sat, Jan 05, 2019 at 11:18:04AM -0500, David Lynch wrote:
[...]
> From what I've read about functions I should be able to define a function
> with 2 variables? And then I can add all of my code into that function by
> indenting it.
So far so good! Here's an example
On Wed, Jan 02, 2019 at 08:39:53PM +0530, Asad wrote:
> Hi All ,
>
> Need advice on the following piece of code :
Let me write it in a more "Pythonic" style:
PATCH = r'\?/patch/\d{8}/\d{8}/admin/load.sql'
APPLY = r'Starting\s+apply\s+for\s+patch\s+\d{8}/\d{8}'
ERROR = r'set_metadata'
tail =
On Sun, Dec 30, 2018 at 11:07:19AM -0500, Avi Gross wrote:
> Steve,
>
> I had the same thoughts and many more when I played with these ideas
> last night.
Pity that one of those thoughts wasn't "I shouldn't suggest a bad
solution on a mailing list populated by beginners who won't recognise
On Sun, Dec 30, 2018 at 12:07:20AM -0500, Avi Gross wrote:
[...]
> Or on a more practical level, say a function wants an input from 1 to 10.
> The if statement above can be something like:
>
> >>> def hello(a, *n, **m) :
> if not (1 <= a <= 10) : a=5
> print(a)
> print(*n)
>
>
On Sat, Dec 29, 2018 at 11:42:16AM +0530, Karthik Bhat wrote:
> Hello,
>
> I have the following piece of code. In this, I wanted to make use
> of the optional parameter given to 'a', i.e- '5', and not '1'
>
> def fun_varargs(a=5, *numbers, **dict):
[...]
>
>
On Fri, Dec 28, 2018 at 10:39:53PM -0500, Avi Gross wrote:
> I will answer this question then head off on vacation.
You wrote about 140 or more lines, but didn't come close to answering
the question: how to randomly split data from a dictionary into training
data and reserved data.
--
Steve
On Fri, Dec 28, 2018 at 03:34:19PM -0500, Avi Gross wrote:
[...]
> You replied to one of my points with this about a way to partition data:
>
> ---
> The obvious solution:
>
> keys = list(mydict.keys())
> random.shuffle(keys)
> index = len(keys)*3//4
> training_data = keys[:index]
> reserved =
On Fri, Dec 28, 2018 at 12:58:00AM -0500, Avi Gross wrote:
[...]
> Copying and pasting multiple lines into the interpreter fails in mysterious
> ways, unless they are a logical single entity.
>
> Is there a way to change this behavior, or perhaps an editor/environment
> that feeds multiple lines
On Thu, Dec 27, 2018 at 09:48:02PM -0500, Avi Gross wrote:
> Sometimes when I post something I get back comments and evaluate them and
> learn quite a bit. I then reply and debate every little point and it can
> continue for a few rounds.
I think you sent this to the wrong mailing list. The
On Thu, Dec 27, 2018 at 08:40:12PM +0530, Asad wrote:
> Hi All ,
>
> I trying find a solution for my script , I have two files :
>
> file1 - I need a search a error say x if the error matches
>
> Look for the same error x in other file 2
>
> Here is the code :
> I have 10 different
On Wed, Dec 26, 2018 at 11:02:07AM -0500, Avi Gross wrote:
> I often find that I try to make a main point ad people then focus on
> something else, like an example.
I can't speak for others, but for me, that could be because of a number
of reasons:
- I agree with what you say, but don't feel
On Thu, Dec 27, 2018 at 07:03:18PM +, Mark Lawrence wrote:
> On 26/12/2018 00:00, Avi Gross wrote:
> >[Long enough that some should neither read nor comment on.]
> >
>
> PLEASE GO AWAY YOU ARE REALLY IRRITATING.
People in glass houses...
Mark, you're not the arbiter of who is allowed to
On Tue, Dec 25, 2018 at 11:56:21PM -0500, Avi Gross wrote:
> I find that many people are fairly uncomfortable with abstraction and
> tend to resist a pure top down approach by diving to any solutions
> they may envision.
https://blog.codinghorror.com/it-came-from-planet-architecture/
> As
On Tue, Dec 25, 2018 at 10:25:50PM -0500, Avi Gross wrote:
> class chainable_list(list):
> """Same as list but sort() can now be chained"""
> def chainsort(this, *args, **kwargs):
> this.sort(*args, **kwargs)
> return this
In Python, it is traditional to use "self" rather
On Wed, Dec 26, 2018 at 01:06:04AM +, Alan Gauld via Tutor wrote:
> In Smalltalk the default return value from
> any method is self. In Python it is None.
>
> self allows chaining of methods, None does not.
You might be interested in this simple recipe for retrofitting method
chaining
On Thu, Dec 20, 2018 at 10:47:44PM +0100, Aine Gormley wrote:
> Hello, could somebody take a quick look at my code? I am unsure why I am
> getting a loop error?
That's hard to do if you don't show us the code :-)
Please COPY AND PASTE (don't try to retype it from memory) the MINIMUM
amount of
On Thu, Dec 20, 2018 at 10:49:25AM -0500, Mary Sauerland wrote:
> I want to get rid of words that are less than three characters
> f1_name = "/Users/marysauerland/Documents/file1.txt"
> #the opinions
> f2_name = "/Users/marysauerland/Documents/file2.txt"
> #the constitution
Better than
On Thu, Dec 13, 2018 at 11:07:59PM -0500, Avi Gross wrote:
> Python may claim to be straightforward but I can easily see ways
> to fool people in python too with dunder methods or function closures or
> decorators or ...
Dunder methods shouldn't fool anyone. Each dunder method has a
On Thu, Dec 13, 2018 at 11:07:59PM -0500, Avi Gross wrote:
[...]
> There are cases where it may make sense to have a long like connected by AND
> or OR given how python does short-circuiting while returning the last thing
> or two it touched instead of an actual True/False. For example, you may
On Fri, Dec 14, 2018 at 01:03:55AM +, Alan Gauld via Tutor wrote:
> I'd probably suggest
>
> stgs = ''.join([
> "long string",
> "another string",
> ...
> "last string"
> ])
That's certainly better than using the + operator, as that will be quite
inefficient for large numbers of strings.
On Thu, Dec 13, 2018 at 12:36:27PM -0500, Avi Gross wrote:
> Simple question:
>
> When lines get long, what points does splitting them make sense and what
> methods are preferred?
Good question!
First, some background:
Long lines are a potential code smell: a possible sign of excessively
On Wed, Dec 12, 2018 at 06:57:09AM -0600, Ravi Kumar wrote:
> I know this occurs when the api response is nulls but how do I handle this?
if response is None:
handle None case
else:
handle non-None case
--
Steve
___
Tutor maillist -
Hi Dat, and welcome!
On Wed, Dec 12, 2018 at 11:26:30AM +0600, Hoang Quoc Dat wrote:
[...]
> After a while, I went on and search on the internet and
> find out 1 similar program but the coding logic is like: The computer keeps
> guessing the middle number of the range and narrow down the range by
On Wed, Dec 12, 2018 at 12:52:09AM -0500, Avi Gross wrote:
> Asad,
>
> I wonder if an import from __future__ happened, perhaps in the version of
> collections you used. Later versions of 2.x allow optional use of the 3.x
> style of print.
The effect of __future__ imports, like any other import,
On Tue, Dec 11, 2018 at 09:07:58PM +0530, Asad wrote:
> Hi All,
>
> I used your solution , however found a strange issue with deque :
No you haven't. You found a *syntax error*, as the exception says:
> >>> print 'Deque:', d
> File "", line 1
> print 'Deque:', d
>
On Sun, Dec 09, 2018 at 03:45:07PM +0530, Asad wrote:
> Hi All ,
>
> I have the following code to search for an error and prin the
> solution .
Please tidy your code before asking for help optimizing it. We're
volunteers, not being paid to work on your problem, and your code is too
On Sun, Dec 09, 2018 at 03:45:07PM +0530, Asad wrote:
> Hi All ,
>
> I have the following code to search for an error and prin the
> solution .
>
> /A/B/file1.log size may vary from 5MB -5 GB
[...]
> The problem I am facing in performance issue it takes some minutes to print
> out the
This is not a request for help, but a demonstration of what can go wrong
with text processing in Python 2.
Following up on the "Special characters" thread, one of the design flaws
of Python 2 is that byte strings and text strings offer BOTH decode and
encode methods, even though only one is
On Sun, Dec 09, 2018 at 09:23:59AM +1100, Cameron Simpson wrote:
> On 07Dec2018 21:20, Steven D'Aprano wrote:
# Python 2
> >>>>txt = "abcπ"
> >
> >but it is a lie, because what we get isn't the string we typed, but the
> >interpreters *bad gue
On Fri, Dec 07, 2018 at 12:30:18PM -0500, Avi Gross wrote:
> # > I have often seen something like this done with methods, such as to
> # > emulate decorator functionality where a method is created in an
> # > object with a name
> # > and the very next method created has the same name with
On Fri, Dec 07, 2018 at 05:59:22PM +, Alan Gauld via Tutor wrote:
[...]
> > ... In languages without garbage collection, reusing
> > the same name, like "index" repeatedly might save some
> > small amount of space.
>
> Garbage collection only helps if the variable loses
> its assignment.
On Thu, Dec 06, 2018 at 09:13:01PM -0500, Avi Gross wrote:
> But so much code I see in python does not only reuse the same variable names
> but in a confusing way.
>
> file = "some name"
> file = open(file, "r")
> file = some_wrapper(file)
I agree this is confusing: you have the same name,
On Fri, Dec 07, 2018 at 02:17:55AM +, nathan tech wrote:
> Hello all!
>
> My name is nate, and I am relatively new to this list, relatively being
> just signed up.
>
> I have a question that you would think would be obvious, but alas I have
> struggled to figure out.
>
> How do I play
On Fri, Dec 07, 2018 at 02:06:16PM +0530, Sunil Tech wrote:
> Hi Alan,
>
> I am using Python 2.7.8
That is important information.
Python 2 unfortunately predates Unicode, and when it was added some bad
decisions were made. For example, we can write this in Python 2:
>>> txt = "abcπ"
but it
On Fri, Dec 07, 2018 at 01:28:18PM +0530, Sunil Tech wrote:
> Hi Tutor,
>
> I have a trouble with dealing with special characters in Python
There are no special characters in Python. There are only Unicode
characters. All characters are Unicode, including those which are also
ASCII.
Start
On Thu, Dec 06, 2018 at 08:17:23AM -0600, Ravi Kumar wrote:
> I know I am asking a lot
Yes you are. Please read this:
http://sscce.org/
It is written for Java programmers, but it applies equally to all
languages, including Python.
Think about how difficult a job you are giving us: we don't
On Thu, Dec 06, 2018 at 10:41:37AM +, Alan Gauld via Tutor wrote:
> On 06/12/2018 00:45, Steven D'Aprano wrote:
>
> > As for what is "not worth prosecuting", there are no copyright police
> > who troll the internet looking for copied lines of code. Nobody is go
On Wed, Dec 05, 2018 at 07:49:58PM +, Mark Lawrence wrote:
> On 05/12/2018 16:22, Avi Gross wrote:
>
> [huge snip]
>
> Please take yourself to another forum, your ramblings have no place on
> the *PYTHON TUTOR* mailing list.
Steady on Mark, a lot of what Avi says is misinformed or close to
On Wed, Dec 05, 2018 at 11:22:35AM -0500, Avi Gross wrote:
> I am NOT advocating copying code. Not even "free" code.
>
> I am saying there may be times you want to package the code for special
> purposes.
"Packaging" the code IS copying the code.
> Perhaps someone can enlighten me on a subtle
On Wed, Dec 05, 2018 at 11:39:49AM +1100, Matthew Polack wrote:
> Hi All,
>
> We're using Python with our Year 9 and 10 students to teach programming.
Yay! And I see you're a fellow Aussie :-)
> I've started with basic console programming...doing simple games like a
> quiz game etc.
>
>
On Wed, Dec 05, 2018 at 08:44:14AM +, Alan Gauld via Tutor wrote:
> On 04/12/2018 23:52, James Stapleton-Cotton wrote:
>
> > USERs-MacBook-Pro:~ user$ python hello.py
> > python: can't open file 'hello.py': [Errno 2] No such file or directory
>
> You need to provide the full path to the
Avi,
Why do you keep changing the subject line? You started a new thread
about "borrowing" (copying) code, people responded to that thread, and
you've immediately changed the subject to "Copyleft" even though you
talk about much more than copyleft licences.
(You barely mention copyleft at all
On Tue, Dec 04, 2018 at 11:43:05PM +, Alan Gauld via Tutor wrote:
> On 04/12/2018 19:31, Avi Gross wrote:
>
> > But some packages are simply python code that you can
> > simply insert into your own python files.
>
> If they are fully public domain that's probably true.
Almost nothing
1 - 100 of 3202 matches
Mail list logo